Fix issue #14426: [homeassistant.components.sensor] smappee: Error on device update!
https://github.com/home-assistant/home-assistant/issues/14426
This commit is contained in:
parent
2da6d3c223
commit
61a41bb8fc
1 changed files with 7 additions and 5 deletions
|
@ -189,8 +189,10 @@ class SmappeeSensor(Entity):
|
|||
data = self._smappee.sensor_consumption[self._location_id]\
|
||||
.get(int(sensor_id))
|
||||
if data:
|
||||
consumption = data.get('records')[-1]
|
||||
_LOGGER.debug("%s (%s) %s",
|
||||
sensor_name, sensor_id, consumption)
|
||||
value = consumption.get(self._smappe_name)
|
||||
self._state = value
|
||||
tempdata = data.get('records');
|
||||
if tempdata:
|
||||
consumption = tempdata[-1]
|
||||
_LOGGER.debug("%s (%s) %s",
|
||||
sensor_name, sensor_id, consumption)
|
||||
value = consumption.get(self._smappe_name)
|
||||
self._state = value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue