Toon van Eneco custom component


#121

Great work @boltgolt! The only comment I have is that it would probably be better to remove the Fibaro part from the SmartPlug and Smokedetector sensor since many different devices work with it. Of course that is just semantics, amazing job getting this through, a big round of applause! And to @krocat of course for starting this and making all that initial effort! Everyone that has contributed with bugs and feedback, give yourselves a round of applause too! @boltgolt I would appreciate an MR on toonlib with your details for attribution. You could do that on AUTHORS.rst.


#122

Somehow it broke during the night with the following (there are more errors, but they all state the same):

2017-10-20 09:54:46 WARNING (Thread-8) [toonlib.Toon] Detected a timeout. Re-authenticating and retrying request.
2017-10-20 09:54:47 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.gas_current is taking over 10 seconds
2017-10-20 09:54:50 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.gas_current fails
Traceback (most recent call last):
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 215, in async_update_ha_state
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 103, in update
self.thermos.update()
File “/home/homeassistant/.homeassistant/custom_components/toon.py”, line 89, in update
self.data[‘power_current’] = self.toon.power.value
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/toonlib/toonlib.py”, line 293, in power
power = self._state[‘powerUsage’]
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/cachetools/init.py”, line 48, in wrapper
cache[k] = v
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/cachetools/ttl.py”, line 91, in setitem
self.expire(time)
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/cachetools/ttl.py”, line 171, in expire
cache_delitem(self, curr.key)
File “/home/homeassistant/homeassistant/lib/python3.5/site-packages/cachetools/cache.py”, line 64, in delitem
del self.__data[key]
KeyError: (<toonlib.toonlib.Toon object at 0x6c3d4510>,)


#123

Restarting HASS made it work again. I didn’t find the reason in the log why it broke suddenly. Although it appears that there were many timeouts before it started logging the above messages.


#124

This looks like a race condition to me. It seems that the api got stuck, the library tried to reauthenticate and redo the request which of course takes some time and if the api timed out in the first place the subsequent request might have taken quite some time too, where in between the task of HA requiring the value requested it but there was nothing due to caching invalidation and boom. Or something to that effect. I don’t expect these to be frequent, but I do expect them to happen once every blue moon.


#125

I think i should lower the timeout. Of course that means that we might have more false positive timeouts. Sadly there is no right answer here, it just needs tweaking and monitoring until we have enough data to make a good educated guess. I would start by lowering the timeout to something like 6 seconds. If anyone wants to try locally and report back it would be great. If enough people want to try then we could come up with a system where everyone tries a different timeout value lets say from 4 to 8 and see who has the most stable result.


#126

I’ll adjust my timeout to “6” as you proposed :slight_smile:


#127

Hi there… I updated the toon.py files from git but now Toon wont work anymore

File “/home/homeassistant/.homeassistant/custom_components/toon.py”, line 7

^
SyntaxError: invalid syntax

I am in a virtualenv

Everything was working ok before update.
HA version 0.55.1


#128

I can’t reproduce this locally, could you share the first 10 lines of toon.py (head /home/homeassistant/.homeassistant/custom_components/toon.py)?


#129

never mind :slight_smile: its working again. Removed all files and directory’s from custom_comp and downloaded again.
Everything is back as usual

thnx


#130

after some inspection:

Power and gas usage is working but cant activate the scenes :

2017-10-20 19:05:26 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py”, line 1025, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/init.py”, line 382, in async_operation_set_service
yield from climate.async_set_operation_mode(operation_mode)
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/climate/toon.py”, line 91, in set_operation_mode
self.thermos.set_state(toonlib_values[operation_mode])
KeyError: ‘Comfort’


#132

Can’t reproduce that either, and the key “Comfort” should never even come near there, are you sure you’re not mixing versions of ToonHA?


#133

I removed everything from the custom_components dir and downloaded https://github.com/krocat/ToonHA.git
So I don’t know how to see if i mixed multiple versions


#134

What values do you see in the “Operation” dropdown on the climate device?


#135

ehm… sorry…
what do you mean ? In developer tools / services?


#136

Sorry, that wasn’t a very helpful way of describing it, i meant this dropdown:

What 4 things do you see when you click on it?


#137

:smile:

The list says :


#138

Sorry, i forgot to reply to to you. I can’t pin down what’s going wrong here and i don’t have any other feedback from other people with the same issue. It might be worth reinstalling home assistant and double checking your config.yaml?


#139

Hass version 0.56 was released today and includes toon by default :tada:. The original docs written by @krocat are now also live on the home assistant components page. However, every component (climate, switch and sensor) also has a separate docs entry and they all show up the same, so that need some work.

In unrelated news: I still had my script running and collecting data with a 120 second cache and the results are surprising. It has ran for quite a lot longer than the 30 second script but only encountered 4 relogs. This could mean the API just had a bad day when i tested the 30 second cache or it could mean the shorter cache time contributes to the relogs, we don’t know yet. The full sheet is available here.


#140

I’ve made a few changes to the docs here, comments would be appreciated.


#141

I would probably guess that it is due to the api. Sometimes things go on for days without needing restart and sometimes they require a few times a day. I do not think that the granularity of the request makes any difference. At least there is no evidence to support it. Again, great job with everything!