mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +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>
|
||||
|
||||
<div class="target">
|
||||
<span class="state-label">
|
||||
[[_localizeState(stateObj.state)]]
|
||||
</span>
|
||||
<template is="dom-if" if="[[_hasKnownState(stateObj.state)]]">
|
||||
<span class="state-label">
|
||||
[[_localizeState(stateObj.state)]]
|
||||
</span>
|
||||
</template>
|
||||
[[computeTarget(hass, stateObj)]]
|
||||
</div>
|
||||
|
||||
@ -101,6 +103,10 @@ class HaClimateState extends LocalizeMixin(PolymerElement) {
|
||||
return "";
|
||||
}
|
||||
|
||||
_hasKnownState(state) {
|
||||
return state !== "unknown";
|
||||
}
|
||||
|
||||
_localizeState(state) {
|
||||
return this.localize(`state.climate.${state}`) || state;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user