mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 00:36:34 +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() {
|
_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 width = this.$.input_number_card.offsetWidth;
|
||||||
const stateEl = this.shadowRoot.querySelector('.state');
|
const stateEl = this.shadowRoot.querySelector('.state');
|
||||||
if (!stateEl) return;
|
if (!stateEl) return;
|
||||||
@ -133,6 +133,8 @@ class HuiInputNumberEntityRow extends mixinBehaviors([IronResizableBehavior], Po
|
|||||||
}
|
}
|
||||||
|
|
||||||
_stateObjChanged(stateObj, oldStateObj) {
|
_stateObjChanged(stateObj, oldStateObj) {
|
||||||
|
if (!stateObj) return;
|
||||||
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
_min: Number(stateObj.attributes.min),
|
_min: Number(stateObj.attributes.min),
|
||||||
_max: Number(stateObj.attributes.max),
|
_max: Number(stateObj.attributes.max),
|
||||||
|
@ -57,7 +57,7 @@ class HuiInputTextEntityRow extends PolymerElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_stateObjChanged(stateObj) {
|
_stateObjChanged(stateObj) {
|
||||||
this._value = stateObj.state;
|
this._value = stateObj && stateObj.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
_selectedValueChanged() {
|
_selectedValueChanged() {
|
||||||
|
@ -89,6 +89,8 @@ class HuiMediaPlayerEntityRow extends LocalizeMixin(PolymerElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_computeControlIcon(stateObj) {
|
_computeControlIcon(stateObj) {
|
||||||
|
if (!stateObj) return null;
|
||||||
|
|
||||||
if (stateObj.state !== 'playing') {
|
if (stateObj.state !== 'playing') {
|
||||||
return stateObj.attributes.supported_features & SUPPORTS_PLAY ? 'hass:play' : '';
|
return stateObj.attributes.supported_features & SUPPORTS_PLAY ? 'hass:play' : '';
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class HuiTextEntityRow extends LocalizeMixin(PolymerElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_computeState(stateObj) {
|
_computeState(stateObj) {
|
||||||
return computeStateDisplay(this.localize, stateObj);
|
return stateObj && computeStateDisplay(this.localize, stateObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.define('hui-text-entity-row', HuiTextEntityRow);
|
customElements.define('hui-text-entity-row', HuiTextEntityRow);
|
||||||
|
@ -73,6 +73,8 @@ class HuiTimerEntityRow extends PolymerElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_computeDisplay(stateObj, time) {
|
_computeDisplay(stateObj, time) {
|
||||||
|
if (!stateObj) return null;
|
||||||
|
|
||||||
if (stateObj.state === 'idle' || time === 0) return stateObj.state;
|
if (stateObj.state === 'idle' || time === 0) return stateObj.state;
|
||||||
|
|
||||||
let display = secondsToDuration(time);
|
let display = secondsToDuration(time);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user