Create a means of re-rendering the card based on external state.

This commit is contained in:
Dermot Duffy
2022-02-17 19:34:12 -08:00
parent a90013d18a
commit 70ee05168f
5 changed files with 29 additions and 22 deletions
+4 -13
View File
@@ -136,27 +136,18 @@ class FrigateCardElementsCore extends LitElement {
*/
@customElement('frigate-card-elements')
export class FrigateCardElements extends LitElement {
@property({ attribute: false })
public hass?: HomeAssistant & ExtendedHomeAssistant;
@property({ attribute: false })
protected elements: PictureElements;
@property({ attribute: false })
protected conditionState?: ConditionState;
protected _hass?: HomeAssistant & ExtendedHomeAssistant;
@query('frigate-card-elements-core')
_core!: FrigateCardElementsCore;
/**
* Set the Home Assistant object.
*/
set hass(hass: HomeAssistant & ExtendedHomeAssistant) {
if (this._core) {
this._core.hass = hass;
}
this._hass = hass;
}
/**
* Handle a picture element to be removed from the menu.
* @param ev The event.
@@ -221,7 +212,7 @@ export class FrigateCardElements extends LitElement {
*/
protected render(): TemplateResult {
return html` <frigate-card-elements-core
.hass=${this._hass}
.hass=${this.hass}
.conditionState=${this.conditionState}
.elements=${this.elements}
>