Fix overrides bug caused by incorrect initial state.

This commit is contained in:
Dermot Duffy
2023-05-20 13:27:29 -07:00
parent bf895fc3ea
commit 2d3b01583a
2 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "frigate-hass-card",
"version": "5.1.0",
"version": "5.1.1",
"description": "Frigate Lovelace Card for Home Assistant",
"keywords": [
"frigate",
+14 -8
View File
@@ -896,10 +896,6 @@ class FrigateCard extends LitElement {
this._message = null;
this._setupConditionController();
this._conditionController?.setState({
view: undefined,
camera: undefined,
});
this._automationsController = new AutomationsController(this._config.automations);
this._setLightOrDarkMode();
@@ -915,6 +911,18 @@ class FrigateCard extends LitElement {
this._requestUpdateForComponentsThatUseConditions.bind(this),
);
this._conditionController.addStateListener(this._executeAutomations.bind(this));
this._conditionController.setState({
view: undefined,
fullscreen: this._isInFullscreen(),
expand: this._expand,
camera: undefined,
...(this._hass &&
this._conditionController?.hasHAStateConditions && {
state: this._hass.states,
}),
media_loaded: !!this._currentMediaLoadedInfo,
});
}
protected _executeAutomations(): void {
@@ -2117,14 +2125,12 @@ class FrigateCard extends LitElement {
}
protected _fullscreenHandler(): void {
const inFullscreen = screenfull.isEnabled && screenfull.isFullscreen;
if (inFullscreen) {
if (this._isInFullscreen()) {
this._expand = false;
}
this._conditionController?.setState({
fullscreen: inFullscreen,
fullscreen: this._isInFullscreen(),
expand: this._expand,
});