Toon (eneco) integration with Home Assistant

Hi All,

I like to share with you a python3 module of Eneco Toon (mostly forthe dutch users among us). This module let you read the thermostat for temperature, powerusage and gasusage. You are also able to set program to sleep,away,home,holiday.

Let me know your thoughts and results when implementing this.

Files and instructions can be found here on github: https://github.com/opdoffer/toon-homeassistant

grtz
Opdoffer

4 Likes

Top gozer.

1 Like

That’s a nice looking thermostat! Nice of you to contribute!

1 Like

Very nice! I’m starting with HA soon and be sure to try this!
Can I also change the current temp with this? Or only set it to the different programs?

Yes, you’re also be able to set the temp.

So i’m having a bit of trouble.
I have HASS running on a pi jessie in a virtual environment.
I copied the 2 py files in /home/hass/deps/ and ran the python command.
Then I copied the text to my yaml file (and changed the to match mine.
After restarting HASS, HASS doesn’t start at all. It doesn’t even update the HASS log file.

Any idea what I’m doing wrong?

You can also catch me on TG @puckstar35 or email/pm via here.

I think there is something wrong with the yaml text in the config. I’ll check that tomorrow. Yaml looks very closely to tabs and space. And i might some onconsitency in there.

Hi @PuckStar PuckStar. I found the problems in de config example. I corrected the tabs, spaces and the capitals. The config should now be working. I tested the config on my HA and it started. I’m running version 0.21.0.

Thnx for trying and testing.

In case you’re still having problems try raising your logging level and check the logfiles. It should point you in the right direction.

The updated version of the config example file is now on github.

1 Like

It’s working now! Great work!
However I do have a lot of the following notes in my HASS log:

16-06-12 11:52:15 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 11:52:15 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 11:55:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 11:55:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 11:58:08 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 11:58:08 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:01:10 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:01:11 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:04:13 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:04:13 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:07:14 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:07:14 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:10:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:10:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:13:08 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:13:08 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:16:10 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:16:10 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:19:12 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:19:12 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:22:14 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U
16-06-12 12:22:14 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:25:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -p -U
16-06-12 12:25:16 homeassistant.components.sensor.command_line: Command failed: python /home/hass/deps/toonclient.py -t -U

I stripped my login and password so of course that’s also in every record.
I know it’s probably because Toon doesn’t want you to connect so often, but is this something to worry about? Or can I just leave it as it is.
Also you can I could set the temperature manually as well. How would I include that functionality?

Not that it’s really needed now in the summer :), but at least we’re then prepared for winter :).

Thanks again for your great script!

Good that it is working.

I have the same errors in my log. But Toon is actually working. The reason for the errors is that the eneco webserivce is only accepting 1 or 2 clientrequest per 2 or 3 minutes. And Home assistant default scan_interval can be setup max to 60 sec.

See the feature request i made: Scan_interval > 60sec for sensors

For now you can raise the scan_interval and ignore the errors. It is not harming anything, but would be nice and cleaner if we can fix this later. But really relying on the feautre request is implemented.

Another psosible solution would be create one sensor with multiple values. But did not figure that out yet.

I just updated the github config example and added the scan_interval option.

Hope this helps/explains it.

I will work on the explanation of the set temp feature. Need some testing. For now I just work with the Toon Programma’s" as scens in HA.

The discription says; Install in Docker Container homeassistant/home-assistant.
What does that mean? I am sorry, i don’t know that.
I have installated home assistant from this discripton: https://home-assistant.io/getting-started/installation-virtualenv/
Can you tell me how can i take this step? : Import toon.py module with the following command:

Only follow the docker installation steps in case you use home assistant in docker. If that doesn’t say anything to you, you are probably not using docker ;). So please use the general installation steps. I will make the read.md more clear.

You probably just need to pick up from:… And run the following command:

python toon.py install

Does this make things more clear?

Thx @opdoffer! I have do what your say, as the discriptyion. But still this error:
Any idea what is wrong?

16-07-13 09:11:29 homeassistant.components.switch: Error while setting up platform command_line
Traceback (most recent call last):
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 98, in _setup_platform
    discovery_info)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/switch/command_line.py", line 23, in setup_platform
    for dev_name, properties in switches.items():
AttributeError: 'NoneType' object has no attribute 'items'
16-07-13 09:11:29 homeassistant.components.switch: Error while setting up platform command_line
Traceback (most recent call last):
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 98, in _setup_platform
    discovery_info)
  File "/srv/hass/lib/python3.4/site-packages/homeassistant/components/switch/command_line.py", line 23, in setup_platform
    for dev_name, properties in switches.items():
AttributeError: 'NoneType' object has no attribute 'items'
16-07-13 09:11:32 homeassistant.components.sensor.command_line: Command failed: python /config/scripts/toonclient.py -t -U ***** -P *****

Please check if the following file does exists:
/config/scripts/toonclient.py

@opdoffer, thanks, it is working now! Nice part of home assistant.
Sorry for my questions, python and home assistant is new for me, Every day i learn a lot of it :slight_smile:
Have a nice weekend!

For the dutch people that use the Eneco Toon:
Here the sensor for Gas Usage:

sensor.yaml:

- platform: command_line
  name: Toon_GasUsage
  command: "python /config/scripts/toonclient.py -g -U Username -P Password"
  unit_of_measurement: "M3" 

Groups.yaml:

Eneco Toon:
    - sensor.toon_temp
    - sensor.toon_PowerUsage
    - sensor.toon_GasUsage
    - sensor.toon_Program_State
    - scene.toon_comfort
    - scene.toon_slapen
    - scene.toon_weg
    - scene.toon_thuis

Customize.yaml:

sensor.toon_temp: 
 friendly_name: Temperatuur
 icon: mdi:temperature-celsius
sensor.toon_PowerUsage:
 friendly_name: Watt
 icon: mdi:power
sensor.toon_GasUsage:
 friendly_name: Gasverbruik
 icon: mdi:altimeter
sensor.toon_Program_State:
 friendly_name: Actieve Programma
 icon: mdi:arrow-expand-all 
scene.toon_comfort: 
 friendly_name: Programma Comfort
 icon: mdi:numeric-1-box-outline
scene.toon_slapen: 
 friendly_name: Programma Slapen
 icon: mdi:numeric-2-box-outline
scene.toon_weg: 
 friendly_name: Programma Weg
 icon: mdi:numeric-3-box-outline 
scene.toon_thuis: 
 friendly_name: Programma Thuis
 icon: mdi:numeric-4-box-outline

Than, this is your Eneco Toon front. I know of the wrong value’s of electic and gas. I must sync my eneco adapter again when i am home :slight_smile:

1 Like

Glad that its working :wink:

Many thnx for this. I did not figure this out yet. I will use this and update git. Cheers!

Since the eneco webservice is not accepting more requests than 1 per 3 minutes and hass can only be configured to an update frequency 60 sec max, I use an external script to get updates from eneco toon every 10 minutes and read the output of a file as a sensor. Example can be found here Sensor data from file

This prevents your log from displaying anoying toon sensor errors.