krocat / ToonHA

Home-Assistant component for Toon by Eneco

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sensor 'error':'no data' after latest update

Housebeer opened this issue · comments

Behavior:
After the latest update my meter_readings sensors are not responding. Smartplugs are working, current consumption is also working so it seems like there is an issue between the library and the custom component. I'm reading through the code of both but haven't found the issue.

Image of HA frontend with problem:
image

Possible related errors in Home Assistant log:

KeyError: 'powerUsage'
2018-04-03 04:33:15 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.gas_today fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/toon.py", line 129, in update
    self.thermos.update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/toon.py", line 123, in update
    self.data['power_current'] = self.toon.power.value
  File "/srv/homeassistant/lib/python3.5/site-packages/toonapilib/toonapilib.py", line 322, in power
    power = self.status['powerUsage']

System:
Rpi with Hassbian Image
Home assistant version: 66.1 (latest)

Possible Solution:
?

Looks like there's no powerUsage key returned from the API? @costastf your the expert on that part, what do you think?

I saw the error in my original post is related to the Gas_today sensor, funny enough the gas_today sensor does report the correct value. Meter_reading sensors do not report correctly, so here is an error related to a failing sensor:

2018-04-03 04:35:17 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.gas_meter_reading fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/sensor/toon.py", line 129, in update
    self.thermos.update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/toon.py", line 123, in update
    self.data['power_current'] = self.toon.power.value
  File "/srv/homeassistant/lib/python3.5/site-packages/toonapilib/toonapilib.py", line 322, in power
    power = self.status['powerUsage']

#33
i don't know what happened but compared with a previous code and just saw the entities were gone.

Yeah, we removed them thinking that they are not used on the last commit. Thanks!

Fixed in the last #33 merge! Thanks a lot. Issue can be closed if it was up to me.

@costastf I think it is a fun statistic since the daily electricity sensor doesn't tell you if you used it in "dal tarief". With this sensors you could reveal this.