mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Hide state if its unknown e.g. the climate entity does not have one (#1977)
* Hide state if its unknown e.g. the climate entity does not have one * state can not be null * better comparsion * use double quotes
This commit is contained in:
parent
f489d88be4
commit
4810042373
@ -32,9 +32,11 @@ class HaClimateState extends LocalizeMixin(PolymerElement) {
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="target">
|
<div class="target">
|
||||||
<span class="state-label">
|
<template is="dom-if" if="[[_hasKnownState(stateObj.state)]]">
|
||||||
[[_localizeState(stateObj.state)]]
|
<span class="state-label">
|
||||||
</span>
|
[[_localizeState(stateObj.state)]]
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
[[computeTarget(hass, stateObj)]]
|
[[computeTarget(hass, stateObj)]]
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -101,6 +103,10 @@ class HaClimateState extends LocalizeMixin(PolymerElement) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_hasKnownState(state) {
|
||||||
|
return state !== "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
_localizeState(state) {
|
_localizeState(state) {
|
||||||
return this.localize(`state.climate.${state}`) || state;
|
return this.localize(`state.climate.${state}`) || state;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user