a81d72375d58ebd5dc60499f168fd8f9562bb24f
This PR fixes an issue where, after running the card for a few hours, new events (such as thumbnails and triggers) would stop showing up. This bug was caused by the Home Assistant connection dropping and reconnecting in the background. Event subscriptions (such as Frigate WebSocket events established via `hass.connection.subscribeMessage`) are bound to the connection they were created on. When the connection drops, those subscriptions are lost, and until now, they were not being automatically recreated when the connection was restored. This PR ensures that when a restored connection is detected, the card properly re-initializes the camera and view components to re-establish these background subscriptions. 1. HA Connection Reconnect Handling (`HASSManager`) - Added logic to detect when the Home Assistant connection transitions from disconnected back to connected. - When restored, the card uninitializes the `CAMERAS`, `VIEW`, and `INITIAL_TRIGGER` initialization aspects. - This forces the system to recreate the camera managers and re-subscribe to the relevant WebSocket event feeds in the next render cycle, fixing the broken thumbnail/trigger feeds. 2. Centralized Camera Teardown (`InitializationManager`) - Improved the teardown logic by moving the `this._api.getCameraManager().destroy()` call directly into `InitializationManager.uninitialize` when the `CAMERAS` aspect is targeted. - Removed duplicate `destroy()` calls scattered across `ConfigManager` and `CardElementManager`. - This ensures that whenever cameras are forced to re-initialize (such as during a reconnection event), the old manager is safely destroyed in a centralized, predictable way without memory leaks. 3. Testing - Added tests in `hass-manager.test.ts` to verify the uninitialization logic fires during a reconnection event. - Updated `initialization-manager.test.ts` to verify that `CameraManager.destroy()` is automatically called when uninitializing cameras. --------- Co-authored-by: dermotduffy <dermot.duffy@gmail.com>
Advanced Camera Card
Formerly known as: Frigate Card
A comprehensive camera card for Home Assistant.
- Live viewing of multiple cameras.
- Clips, snapshot and review browsing via mini-gallery.
- Automatic updating to continually show latest clip / snapshot.
- Support for filtering events by zone and label.
- Arbitrary entity access via menu (e.g. motion sensor access).
- Fullscreen mode.
- Grid or carousel/swipeable media, thumbnails and cameras.
- Direct media downloads.
- Lovelace visual editing.
- Full Picture Elements support.
- Theme friendly.
See full documentation.
Languages
TypeScript
97.1%
SCSS
2.2%
JavaScript
0.6%