Fix light extra attributes start fix for history

This commit is contained in:
Zack Arnett 2020-09-07 20:49:53 -05:00
parent 0889f42a00
commit 7edc9064d9
2 changed files with 16 additions and 5 deletions

View File

@ -105,12 +105,12 @@ class MoreInfoLight extends LitElement {
? html` ? html`
<div class="segmentationContainer"> <div class="segmentationContainer">
<ha-color-picker <ha-color-picker
class="color"
@colorselected=${this._colorPicked}
.desiredHsColor=${this._colorPickerColor}
throttle="500" throttle="500"
class="color"
.desiredHsColor=${this._colorPickerColor}
.hueSegments=${this._hueSegments} .hueSegments=${this._hueSegments}
.saturationSegments=${this._saturationSegments} .saturationSegments=${this._saturationSegments}
@colorselected=${this._colorPicked}
> >
</ha-color-picker> </ha-color-picker>
<ha-icon-button <ha-icon-button
@ -147,7 +147,7 @@ class MoreInfoLight extends LitElement {
: ""} : ""}
<ha-attributes <ha-attributes
.stateObj=${this.stateObj} .stateObj=${this.stateObj}
extra-filters="brightness,color_temp,white_value,effect_list,effect,hs_color,rgb_color,xy_color,min_mireds,max_mireds,entity_id" .extraFilters=${"brightness,color_temp,white_value,effect_list,effect,hs_color,rgb_color,xy_color,min_mireds,max_mireds,entity_id"}
></ha-attributes> ></ha-attributes>
</div> </div>
`; `;

View File

@ -85,7 +85,18 @@ export class MoreInfoTabHistoryDialog extends LitElement {
clearInterval(this._historyRefreshInterval); clearInterval(this._historyRefreshInterval);
} }
if (changedProps.has("entityId")) { if (!this.hass) {
return;
}
const oldHass = changedProps.get("hass") as HomeAssistant;
const newStateObj = this.hass.states[this.entityId];
const oldStateObj = oldHass?.states[this.entityId];
if (
changedProps.has("entityId") ||
(oldHass && newStateObj !== oldStateObj)
) {
this._stateHistory = undefined; this._stateHistory = undefined;
this._entries = undefined; this._entries = undefined;