From fb8fb09c73c96c05bc68955d84dd03d5cb2606b2 Mon Sep 17 00:00:00 2001 From: c727 Date: Wed, 28 Mar 2018 08:57:01 +0200 Subject: [PATCH] Change attribute checks to handle if value == 0 (#1037) if (0) is false --- src/components/ha-climate-state.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/ha-climate-state.html b/src/components/ha-climate-state.html index 4f40313576..a1c2b38663 100644 --- a/src/components/ha-climate-state.html +++ b/src/components/ha-climate-state.html @@ -41,9 +41,9 @@ class HaClimateState extends Polymer.Element { } computeCurrentStatus(stateObj) { - if (stateObj.attributes.current_temperature) { + if ('current_temperature' in stateObj.attributes) { return `${stateObj.attributes.current_temperature} ${stateObj.attributes.unit_of_measurement}`; - } else if (stateObj.attributes.current_humidity) { + } else if ('current_humidity' in stateObj.attributes) { return `${stateObj.attributes.current_humidity} ${stateObj.attributes.unit_of_measurement}`; } @@ -51,15 +51,15 @@ class HaClimateState extends Polymer.Element { } computeTarget(stateObj) { - if (stateObj.attributes.target_temp_low && - stateObj.attributes.target_temp_high) { + if ('target_temp_low' in stateObj.attributes && + 'target_temp_high' in stateObj.attributes) { return `${stateObj.attributes.target_temp_low} - ${stateObj.attributes.target_temp_high} ${stateObj.attributes.unit_of_measurement}`; - } else if (stateObj.attributes.temperature) { + } else if ('temperature' in stateObj.attributes) { return `${stateObj.attributes.temperature} ${stateObj.attributes.unit_of_measurement}`; - } else if (stateObj.attributes.target_humidity_low && - stateObj.attributes.target_humidity_high) { + } else if ('target_humidity_low' in stateObj.attributes && + 'target_humidity_high' in stateObj.attributes) { return `${stateObj.attributes.target_humidity_low} - ${stateObj.attributes.target_humidity_high} ${stateObj.attributes.unit_of_measurement}`; - } else if (stateObj.attributes.humidity) { + } else if ('humidity' in stateObj.attributes) { return `${stateObj.attributes.humidity} ${stateObj.attributes.unit_of_measurement}`; }