mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Merge pull request #3949 from iantrich/fix-glance-state_image
picture-glance: check for entity state change
This commit is contained in:
commit
0d77bdaf32
@ -27,6 +27,7 @@ import { longPress } from "../common/directives/long-press-directive";
|
|||||||
import { processConfigEntities } from "../common/process-config-entities";
|
import { processConfigEntities } from "../common/process-config-entities";
|
||||||
import { handleClick } from "../common/handle-click";
|
import { handleClick } from "../common/handle-click";
|
||||||
import { PictureGlanceCardConfig, ConfigEntity } from "./types";
|
import { PictureGlanceCardConfig, ConfigEntity } from "./types";
|
||||||
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
|
|
||||||
const STATES_OFF = new Set(["closed", "locked", "not_home", "off"]);
|
const STATES_OFF = new Set(["closed", "locked", "not_home", "off"]);
|
||||||
|
|
||||||
@ -86,19 +87,16 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
protected shouldUpdate(changedProps: PropertyValues): boolean {
|
||||||
if (changedProps.has("_config")) {
|
if (hasConfigOrEntityChanged(this, changedProps)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||||
if (!oldHass) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._entitiesDialog) {
|
if (this._entitiesDialog) {
|
||||||
for (const entity of this._entitiesDialog) {
|
for (const entity of this._entitiesDialog) {
|
||||||
if (
|
if (
|
||||||
oldHass.states[entity.entity] !== this.hass!.states[entity.entity]
|
oldHass!.states[entity.entity] !== this.hass!.states[entity.entity]
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -108,7 +106,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
|
|||||||
if (this._entitiesToggle) {
|
if (this._entitiesToggle) {
|
||||||
for (const entity of this._entitiesToggle) {
|
for (const entity of this._entitiesToggle) {
|
||||||
if (
|
if (
|
||||||
oldHass.states[entity.entity] !== this.hass!.states[entity.entity]
|
oldHass!.states[entity.entity] !== this.hass!.states[entity.entity]
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user