From 1aa1ac709d583bf3aa417a9def35e4d95529553b Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 18 Dec 2017 08:38:58 +0200 Subject: [PATCH] Fix climate chart with unavailable states (#737) --- src/components/state-history-chart-line.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/state-history-chart-line.html b/src/components/state-history-chart-line.html index e74914e3f9..74d3d20e95 100644 --- a/src/components/state-history-chart-line.html +++ b/src/components/state-history-chart-line.html @@ -172,9 +172,8 @@ if (domain === 'thermostat' || domain === 'climate') { // We differentiate between thermostats that have a target temperature // range versus ones that have just a target temperature - hasTargetRange = states.states.reduce(function (cum, cur) { - return cum || cur.attributes.target_temp_high !== cur.attributes.target_temp_low; - }, false); + hasTargetRange = states.states.some(state => state.attributes && + state.attributes.target_temp_high !== state.attributes.target_temp_low); dataTable.addColumn('number', name + ' current temperature'); dataTable.addColumn('number', name + ' heating'); @@ -195,6 +194,7 @@ } processState = function (state) { + if (!state.attributes) return; var curTemp = saveParseFloat(state.attributes.current_temperature); // Drawing the 'heating' area up to the current temp should keep it from // overlapping but avoid any weird gaps or range mismatches