Fix smappee component - "Error on device update" (#14883)

This commit is contained in:
Aaron Bach 2018-06-14 19:35:53 -06:00 committed by GitHub
commit d6d685a483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,8 +189,10 @@ class SmappeeSensor(Entity):
data = self._smappee.sensor_consumption[self._location_id]\ data = self._smappee.sensor_consumption[self._location_id]\
.get(int(sensor_id)) .get(int(sensor_id))
if data: if data:
consumption = data.get('records')[-1] tempdata = data.get('records')
_LOGGER.debug("%s (%s) %s", if tempdata:
sensor_name, sensor_id, consumption) consumption = tempdata[-1]
value = consumption.get(self._smappe_name) _LOGGER.debug("%s (%s) %s",
self._state = value sensor_name, sensor_id, consumption)
value = consumption.get(self._smappe_name)
self._state = value