Toon (eneco) integration with Home Assistant

They seem to have released an api now.

https://www.toonapi.com/

2 Likes

oh wow that’s great!

can anyone write something so it can be included in HASS?

1 Like

This Python module is using that api

I Think its not, its based on rvdm’s version which uses the toonopafstand webpage.

The api is released only a few days back.

Aha, than that is really good news! Sorry for the misunderstanding.

1 Like

Will you do an attempt in creating a component for Toon using the api?
Would be great! :slight_smile:
BTW Dutch forum and topic about HASS here: https://gathering.tweakers.net/forum/list_messages/1652294

1 Like

Actually i was already reading the docs about how to make a component. But i’m not a programmer so it might take some Time. But i think i’ll give it a try.

Thnx for the Tweakers link

1 Like

@opdoffer Are you still working on this? I’ve integrated this in my HASS configuration but my gass usage is always “Unknown” and for some strange reason my temperature is not accurate anymore… Do you encounter the same? does this has something to do with the API?

I was checking iT yesterday. I was noticing some problems as well. IT looks like they change some urls. Will work on it, later this week

1 Like

I corrected the gasusage option. IT was a typo in toonclient.py. New version is on github: https://github.com/opdoffer/toon-homeassistant

1 Like

Thnx for all the work you put in this! I really appreciate it…

1 Like

Thx, It is working again!(Y)

Hi all,

Made some optimalizations. I created one sensor and extract the values with a value_template and split it. So you don’t need mupltiple sensors and this prevent to much errors in your log of timeing out to the eneco webserver (since it doesn’t allow to may requests)

See example below (also updated on github).

sensor:

  • platform: command_line
    name: toon
    command: “python /home/pi/.homeassistant/scripts/toonclient.py -t -p -g -c -U -P ”
  • platform: template
    sensors:
    toontemp:
    value_template: ‘{{ states.sensor.toon.state.split(“\n”)[0] }}’
    toonpowerusage:
    value_template: ‘{{ states.sensor.toon.state.split(“\n”)[1] }}’
    toongasusage:
    value_template: ‘{{ states.sensor.toon.state.split(“\n”)[2] }}’
    toonprogramm:
    value_template: ‘{{% if states.sensor.toon.state.split(“\n”)[3] == “0” %}Comfort{% elif states.sensor.toon.state.split(“\n”)[3] == “1” %}Home{% elif states.sensor.toon.state.split(“\n”)[3] == “2” %}Sleep{% elif states.sensor.toon.state.split(“\n”)[3] == “3” %}Away{% endif %} }’
2 Likes

@opdoffer thnx for the update!

@opdoffer
The Android and iOS are able to login to the Eneco Service again. But it is possible like they may have made some changes since the script now fails.

16-10-14 12:38:30 homeassistant.components.sensor.command_line: Command failed: python /home/homeassistant/.homeassistant/includes/scripts/toon/toonclient.py -t -p -g -c -U <USERNAME> -P <PASSWORD>

When I try to login via Opera desktop browser I can get in. And see my user data.
https://toonopafstand.eneco.nl/toonMobileBackendWeb/client/login?username=USERNAME&password=PASSWORD

Update: Eneco might be blocking some user-agents to alleviate traffic. https://forum.eneco.nl/storingen-problemen-112/domoticz-werkend-na-de-recente-storing-12123

It still does work in my situation and didn’t have to change anything. Please note that the sensor might fail once in a while because eneco doesn’t allow to many requests within a certain time. And home assistant doesn’t allow an update interval higher than 60 sec.

You should notice that the toon sensor is updated in hass, but just shows some failure updates once in a while in the logs. This doesn’t harm anything.

Hope this explanation helps?

try adding to your config of the toon sensor. This might reduce the failures in the log.

scan_interval: 60

I’ll try that. Also toonclient was just able to receive data again.

fyi oncmd needs to be chaned to command_on and offcmd to command_off.

Also where exactly do I need to put that scan_interval: 60?
I tried here: but that doesn’t work:

- platform: template
  sensors:
    scan_interval: 60
    toontemp:
      value_template: '{{ states.sensor.toon.state.split("\n")[0] }}'
    toonpowerusage:
      value_template: '{{ states.sensor.toon.state.split("\n")[1] }}'
    toongasusage:
      value_template: '{{ states.sensor.toon.state.split("\n")[2] }}'
    toonprogramm:
      value_template: '{% if states.sensor.toon.state.split("\n")[3] == "0" %}Comfort{% elif states.sensor.toon.state.split("\n")[3] == "1" %}Home{% elif states.sensor.toon.state.split("\n")[3] == "2" %}Sleep{% elif states.sensor.toon.state.split("\n")[3] == "3" %}Away{% endif %}'

Thnx. I updated git. Please also check git for an example how I use scan_interval. Please put this option under the sensor component not the template.

Please note that the errors wil still occur, only less frequent.

More info in scan_interval

1 Like