5 Commits

Author SHA1 Message Date
Christoph Giesche
d0269d83d3 Updated tests. 2025-07-28 10:01:27 +02:00
Christoph Giesche
25328029f9 "Blind" fix for possible duplicate domain prefixes in entity-ids. 2025-07-28 09:03:43 +02:00
Timothy Lusk
35c314e362 Fix the use of custom display configuration files
Axios when running within Node.js doesn't support the file:// protocol.
This changes it so that it explicitly uses Node.js's `fs` package to
load local files if `file://` is detected in the URI.

This also fixes the fact that the custom display configuration was not
being loaded on save, only on startup of the plugin.

It also fixes it so that if you remove a custom display configuration it
will fall back to the default configuration without needing to restart
the plugin.

This fixes #342
2025-03-13 20:20:20 -04:00
Timothy Lusk
e7675fe024 Fix an issue with states not updating after resuming from sleep
I just started seeing some issues where the Home Assistant connection
dies and doesn't reconnect automatically when resuming from sleep until
you do anything to cause the connection to attempt to communicate. At
that point, it will discover that the connection is dead and automatically
restart it.

I think this issue might have started for me with the Windows 24H2
upgrade, as I did that a few days ago. With that said, this commit
implements a couple of fixes for the issue.

First, we implement the "onSystemDidWakeUp" callback to reconnect the
Home Assistant connection when the system wakes up. This is the
officially recommended way to handle this according to the SDK
documentation. Unfortunately, from my testing, this callback doesn't
actually seem to be called when my PC wakes up from sleep, so it didn't
fix the issue. Maybe it's a bug in the SDK that will be fixed, so I'm
going to leave the callback in there for the time being.

The second fix in this commit is to add a heartbeat to the Home
Assistant server, which calls the ping/pong websocket command. This will
ping the server every 5 seconds after the last event was received. In
the event that the connection drops, this should be enough to cause the
internal reconnect logic to realize the connection is down and recreate
it.
2025-02-23 15:04:29 -05:00
Timothy Lusk
83e7a154f2 Introduce vitest unit tests into the project 2025-02-22 02:30:18 -05:00