Toon (eneco) integration with Home Assistant

@PuckStar I’m not sure what channel I would choose. I sent them an email through a form on the Eneco webpage and they actually called me back. The guy on the phone however was fairly incompetent but his message was clear like I said in the other post. I didn’t feel like going into a discussion, maybe it would work with someone else? Maybe I’ll give it another try later this week :slight_smile:

@opdoffer I’m also wondering how the script is still working, but at least it’s working for you :slight_smile: And it’s good you’ll keep on trying, who knows what will come of it!

503, is more an error indicating to much requests. I changed the scan_interval to at least 5 minutes and that works for me. Should also work for you.

Please check https://github.com/opdoffer/toon-homeassistant for the latest config files and py module versions.

Hi all,
I have just uploaded a library I have written for the toon based on the web api.


Right now it is build for python2.7 since i only bumped on Home Assistant literally this week, so next week I will work on making it 3+ compatible, (although it should already be) and then make that a component for HA. Following the thread about the official api, sadly I think its a no go since any app created off that has to be vetted by the toon team.

The library implements internal caching on the accessing of the api for 5 minutes and exposes lots of information apart from being able to change temperature and thermostat state. For details visit the usage in the documentation.
http://toonlib.readthedocs.io/en/latest/usage.html
Feedback is always welcome!

The library is also uploaded to pypi. Cheers!

Library slightly modified to work with python 3.5 and tested to work correctly. New version uploaded to pypi. During the next two weeks I will look into making it a HA component. I first have to setup a HA :slight_smile:

@opdoffer any help on creating the configuration is greatly appreciated as you already have lots of experience in the matter.

I will look and test it today. Get back to you on this. Many thanx for your work and help so far. Anything special i need to test/config?

1 Like

Hi, I’ve created a custom component for Toon using a modified version of rvdm Toon API. Eventhough Eneco has shut down toonopafstand, for me the api still works. The custom component adds a Home Assistant Climate device and several sensors for the utilities stuff. Instructions and files are here:

It wouldn’t be to difficult to change the underlying api if something better comes along

@korcat I tested your custom component but it returns the error:

File “/config/custom_components/toon.py”, line 9, in import custom_components.toon as toon_main AttributeError: module ‘custom_components’ has no attribute ‘toon’

It looks like you have copied the file sensor/toon.py directly in your custom_components folder. It should be in a subfolder called sensor. There are three files that make up the component. toon.py (in the root of the github repo) this should be placed in the custom_components folder. Sensor/toon.py should go in custom_components/sensor and Climate/toon.py should go in custom_components/climate.

Let me know if that works

It’s working now. Sorry was my fault. I tried it on a freshly new installed haps in a docker container. Removed all other devs. And works great! Good job! Many thanks. Maybe you can extend it using the toonlib of @costas. That returns many more features like: caching, to prevent flooding the webservice. But also agreement information and Philips hue and historical values.

Again! many thanks for this!

Thanks @opdoffer , I will certainly do that. My component employs some caching as well. It only connects to Eneco every two minutes. I think Costas has a 5 minute caching, not sure what works best. Philips Hue is already natively supported by HA, but I think @costas supports smartplugs which would be a good addition. I have smoke detectors connected to Toon which I might want to add.

5 minutes is the safest. Another good feature would be the switch. I currently use a command line switch to zet the toon to “COMFORT” or “AWAY” based on triggers. See my example on GitHub.

I’m not a python guru, but I will like to try to create that as a custom component.

@costas can you add a release to your toonlib github repo. That way I can reference it like this: https://home-assistant.io/developers/code_review_component/

Perhaps you can also use the climate device that is create as part of the component in automation. I’m new to HA and still figuring stuff like that out

1 Like

Hi @krocat, the library has a pypi package so you can just use that. https://pypi.python.org/pypi/toonlib so i believe that you would need something like REQUIREMENTS = [‘toonlib==0.1.2’]. Does this work for you?

Hue is supported by HA that is why i have not added anything on the lights part. It is basically just read only and since I have the information I might as well do something with it right? At some point I will add a smoke detector too and I will extend the library to expose that too. Currently there is no caching on the historical data exposed. Once we get the library integrated with HA (thanks a lot for the help!) I could fine tune anything that does not seem right…

That works, thanks :wink:

Thank you, for helping with the integration! :slight_smile:

Yes the component also allows to change the programs away/comfort/hone etc. I can use that in automation. I can purge my old commandline switches :slight_smile:

@costas you don’t expose the current power reading? Something like toon.power.value?