Fix trend binary sensor and tests (#22686)

This commit is contained in:
Jason Hu authored and Paulus Schoutsen committed 2019-04-03 09:04:30 -07:00
1 parent 048b100eea
commit b4fc1d77ea
2 files changed
+26 -11

No files matched your search

@@ -141,7 +141,7 @@ class SensorTrend(BinarySensorDevice):
else:
state = new_state.state
if state not in (STATE_UNKNOWN, STATE_UNAVAILABLE):
sample = (utcnow().timestamp(), float(state))
sample = (new_state.last_updated.timestamp(), float(state))
self.samples.append(sample)
self.async_schedule_update_ha_state(True)
except (ValueError, TypeError) as ex: