From 481004237306f9d83a014e453164af47962309a1 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 3 Nov 2018 21:51:55 +0100 Subject: [PATCH] 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 --- src/components/ha-climate-state.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/ha-climate-state.js b/src/components/ha-climate-state.js index 8cdc2e37d9..4453f03b5a 100644 --- a/src/components/ha-climate-state.js +++ b/src/components/ha-climate-state.js @@ -32,9 +32,11 @@ class HaClimateState extends LocalizeMixin(PolymerElement) {
- - [[_localizeState(stateObj.state)]] - + [[computeTarget(hass, stateObj)]]
@@ -101,6 +103,10 @@ class HaClimateState extends LocalizeMixin(PolymerElement) { return ""; } + _hasKnownState(state) { + return state !== "unknown"; + } + _localizeState(state) { return this.localize(`state.climate.${state}`) || state; }