Bump versions of multiple production and development dependencies, including Vue, Vite plugin for Vue, eslint-plugin-vue, and more for compatibility and improvements.
Ensure `serverUrl` and `accessToken` are present before attempting to connect to Home Assistant. Updated `GlobalSettings` model to make these properties optional and added logging for missing configuration.
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
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.
This uses a filter argument to the websocket subscription function to
only subscribe to entities that are currently being displayed on the
device screen.
The Home Assistant API for this is not currently implemented in the
client library so we needed to patch the library slightly.
For more details about this API see:
https://github.com/home-assistant/home-assistant-js-websocket/issues/511
It looks like the files in this project haven't consistantly been run
through prettier. This gets them back in sync with the prettier
configuration.
We should setup a pre-commit hook that runs prettier so they don't get
out of sync again.