mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Fix console errors in LL when entities are unavailable. (#1734)
This commit is contained in:
parent
0243632357
commit
a76386b53b
@ -125,7 +125,7 @@ class HuiInputNumberEntityRow extends mixinBehaviors([IronResizableBehavior], Po
|
||||
}
|
||||
|
||||
_hiddenState() {
|
||||
if (!this.$ || this._stateObj.attributes.mode !== 'slider') return;
|
||||
if (!this.$ || !this._stateObj || this._stateObj.attributes.mode !== 'slider') return;
|
||||
const width = this.$.input_number_card.offsetWidth;
|
||||
const stateEl = this.shadowRoot.querySelector('.state');
|
||||
if (!stateEl) return;
|
||||
@ -133,6 +133,8 @@ class HuiInputNumberEntityRow extends mixinBehaviors([IronResizableBehavior], Po
|
||||
}
|
||||
|
||||
_stateObjChanged(stateObj, oldStateObj) {
|
||||
if (!stateObj) return;
|
||||
|
||||
this.setProperties({
|
||||
_min: Number(stateObj.attributes.min),
|
||||
_max: Number(stateObj.attributes.max),
|
||||
|
@ -57,7 +57,7 @@ class HuiInputTextEntityRow extends PolymerElement {
|
||||
}
|
||||
|
||||
_stateObjChanged(stateObj) {
|
||||
this._value = stateObj.state;
|
||||
this._value = stateObj && stateObj.state;
|
||||
}
|
||||
|
||||
_selectedValueChanged() {
|
||||
|
@ -89,6 +89,8 @@ class HuiMediaPlayerEntityRow extends LocalizeMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
_computeControlIcon(stateObj) {
|
||||
if (!stateObj) return null;
|
||||
|
||||
if (stateObj.state !== 'playing') {
|
||||
return stateObj.attributes.supported_features & SUPPORTS_PLAY ? 'hass:play' : '';
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class HuiTextEntityRow extends LocalizeMixin(PolymerElement) {
|
||||
}
|
||||
|
||||
_computeState(stateObj) {
|
||||
return computeStateDisplay(this.localize, stateObj);
|
||||
return stateObj && computeStateDisplay(this.localize, stateObj);
|
||||
}
|
||||
}
|
||||
customElements.define('hui-text-entity-row', HuiTextEntityRow);
|
||||
|
@ -73,6 +73,8 @@ class HuiTimerEntityRow extends PolymerElement {
|
||||
}
|
||||
|
||||
_computeDisplay(stateObj, time) {
|
||||
if (!stateObj) return null;
|
||||
|
||||
if (stateObj.state === 'idle' || time === 0) return stateObj.state;
|
||||
|
||||
let display = secondsToDuration(time);
|
||||
|
Loading…
x
Reference in New Issue
Block a user