Toon (eneco) integration with Home Assistant

Ok what I now did is replace all the toon.py files in the custom_components folder(s).
Also replaced toonlib.py.
And after restarting Hass I get this:

17-04-26 17:47:37 ERROR (MainThread) [homeassistant.loader] Unable to find component sensor.toon
17-04-26 17:47:37 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.toon: Platform not found.
17-04-26 17:47:37 ERROR (MainThread) [homeassistant.loader] Unable to find component climate.toon
17-04-26 17:47:37 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.toon: Platform not found.

Did I do it the right way? Or should I update toonlib in a different way?

Please see @opdoffer 's post above. Basically you need to place the files from @krocat ToonHA github inside the appropriate structure of your custom_components. toonlib should have nothing to do with it, it is handled transparently from HA as a dependency. So clone ToonHA and move the toon.py files to the appropriate location.

@krocat wouldnā€™t it be easier for people to deploy and try out the component if you renamed the directories to lower case and then people could just git clone the whole project in the custom_component directory?

Yes, that is a bit silly isnā€™t it. Not sure if I can work on it tonight, so feel freeto change it if you have time. Iā€™ve created a new branch for the smoke detector code btw

:slight_smile: nah I think I have done enough for today. My long weekend has started already. Letā€™s tackle things on Monday. Have a wonderful kings day everyone!

haha. with your latest reply I thought of renaming to lowercase.
yesterday the uppercase seemed to work (at least, until the point of the error I provided earlier).

changed to lowercase andā€¦tada itā€™s working! :slight_smile:
what would be nice (but maybe I can find a way myself) if if I can have buttons for each preset like Comfort, Home etc.

But thanks a lot guys! Great work!

Let me know what testing I can do. At least Iā€™ll keep it running and report any issues.

@PuckStar I use scenes to do that. Use this (You will get buttons under de section scenes and you can use it in automations):

- name: Toon Comfort
  entities:
    climate.toon_van_eneco:
        operation_mode: Comfort

- name: Toon Slapen
  entities:
    climate.toon_van_eneco:
        operation_mode: Sleep

- name: Toon Thuis
  entities:
    climate.toon_van_eneco:
        operation_mode: Home

- name: Toon Weg
  entities:
    climate.toon_van_eneco:
        operation_mode: Away

Happy kings day :wink:

1 Like

Iā€™ve been following your work with great interest and despite my little rant a couple of weeks ago, I havenā€™t yet traded my Toon for another thermostat. Since this is working quite well now, Iā€™ve decided to implement the programming into HA instead of the Toon itself. One advantage is that Iā€™m able to link the Toon setting to my ā€œVacation Switchā€, that triggers a whole set of away settings. I thought it might be interesting to share :slight_smile:

Toon Scenes:

  ###############################################
  ## Toon Programma Standaard
  ###############################################

- name: Toon Programma Standaard
  entities:
    automation.toon_einde_avond_programma_slapen:
      state: on
    automation.toon_ochtend_programma_thuis:
      state: on

  ###############################################
  ## Toon Programma Werkdag
  ###############################################

- name: Toon Programma Werkdag
  entities:
    automation.toon_thuisdag_ochtend_programma_comfort:
      state: off
    automation.toon_werkdag_programma_away:
      state: on
    automation.toon_werkdag_programma_thuis:
      state: on
    automation.toon_werkdag_avond_programma_comfort:
      state: on

  ###############################################
  ## Toon Programma Thuisdag
  ###############################################

- name: Toon Programma Thuisdag
  entities:
    automation.toon_thuisdag_ochtend_programma_comfort:
      state: on
    automation.toon_werkdag_programma_away:
      state: off
    automation.toon_werkdag_programma_thuis:
      state: off
    automation.toon_werkdag_avond_programma_comfort:
      state: off

  ###############################################
  ## Toon Programma Vakantie / Afwezig
  ###############################################

- name: Toon Programma Vakantie
  entities:
    automation.toon_thuisdag_ochtend_programma_comfort:
      state: off
    automation.toon_werkdag_programma_away:
      state: off
    automation.toon_werkdag_programma_thuis:
      state: off
    automation.toon_werkdag_avond_programma_comfort:
      state: off
    automation.toon_einde_avond_programma_slapen:
      state: off
    automation.toon_ochtend_programma_thuis:
      state: off

Toon Automations:

  #############################################
  ## Trigger programma werkdag
  #############################################
  
- alias: 'Toon werkdag inschakelen'
  
  trigger:
- platform: time
  after: "00:01:00"

  condition:
condition: time
weekday:
  - mon
  - tue

  action:
- service: scene.turn_on
  entity_id: scene.toon_programma_werkdag

  #############################################
  ## Trigger programma thuisdag
  #############################################

- alias: 'Toon thuisdag inschakelen'
  
  trigger:
- platform: time
  after: "00:01:00"

  condition:
condition: time
weekday:
  - wed
  - thu
  - fri
  - sat
  - sun

  action:
- service: scene.turn_on
  entity_id: scene.toon_programma_thuisdag

  #############################################
  ## Standaard Ochtend, Programma Thuis
  #############################################

- alias: 'Toon Ochtend Programma Thuis'
  
  trigger:
- platform: time
  after: "06:00:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Home

  #############################################
  ## Standaard Einde avond, Programma Slapen
  #############################################

- alias: 'Toon Einde Avond Programma Slapen'
  
  trigger:
- platform: time
  after: "23:00:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Sleep

  #############################################
  ## Werkdag Programma Away
  #############################################

- alias: 'Toon Werkdag Programma Away'
  
  trigger:
- platform: time
  after: "08:00:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Away

  #############################################
  ## Werkdag Thuiskomen Programma Thuis
  #############################################

- alias: 'Toon Werkdag Programma Thuis'
  
  trigger:
- platform: time
  after: "17:00:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Home

  #############################################
  ## Werkdag Avond Programma Comfort
  #############################################

- alias: 'Toon Werkdag Avond Programma Comfort'
  
  trigger:
- platform: time
  after: "18:30:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Comfort

  #############################################
  ## Thuisdag Ochtend Programma Comfort
  #############################################

- alias: 'Toon Thuisdag Ochtend Programma Comfort'
  
  trigger:
- platform: time
  after: "10:00:00"

  action:
- service: climate.set_operation_mode
  data:
    entity_id: climate.toon_van_eneco
    operation_mode: Comfort

Vacation setting (based on input_boolean called ā€œvakantie_automation_inschakelenā€):

  #############################################
  ## Toon Vakantie / Afwezig inschakelen
  #############################################

- alias: 'Toon Vakantieprogramma Inschakelen'
  
  trigger:
    - platform: state
      entity_id: input_boolean.vakantie_automation_inschakelen
      from: 'off'
      to: 'on'

  action:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.toon_van_eneco
        operation_mode: Away
    - service: scene.turn_on
      entity_id: scene.toon_programma_vakantie

  #############################################
  ## Toon Vakantie / Afwezig uitschakelen
  #############################################

- alias: 'Toon Vakantieprogramma Uitschakelen'
  
  trigger:
    - platform: state
      entity_id: input_boolean.vakantie_automation_inschakelen
      from: 'on'
      to: 'off'

  action:
    - service: scene.turn_on
      entity_id: scene.toon_programma_thuisdag
    - service: scene.turn_on
      entity_id: scene.toon_programma_standaard

Hi all and I hope everyone had a great time. Due to a probably faulty powerplug I use to connect my server to the internet I cannot get to the point where I am disconnected from eneco with a deauthentication so I can fix it. My powerline keeps disconnecting my server for a few seconds every day so I get a resolving exception and a crash. Anyone using the latest ToonHA that depends on toonlib 0.5.0 care to post the exception upon deauthentication so I can fix that and be done with it so we can try to push this to HA mainline? Thanks in advance to anyone willing to help.

@krocat i have pushed some changes to the smokedetector branch that fixes some things. I donā€™t thing that stuff worked before. Whenever you can give it a spin to try it out and if everything works for you merge on master. And have a great day!

I gathered some errors I saw in my log file last days. Is the error you are looking for in there?

17-04-26 20:53:58 ERROR (Thread-3) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: 85e6acbc-36e8-486f-b449-aef69f22131a", "errorCode": "500" }
17-04-26 20:53:58 ERROR (Thread-3) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable


17-04-27 14:57:25 ERROR (Thread-5) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: 2c6d7cd5-2e78-4137-b397-7584a26ad2ad", "errorCode": "500" }
17-04-27 14:57:25 ERROR (Thread-5) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable

17-04-27 22:08:58 ERROR (Thread-9) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: fd6be95f-72e9-47e4-a2ad-ad2c927714f8", "errorCode": "500" }
17-04-27 22:08:58 ERROR (Thread-9) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable

17-04-29 23:11:24 ERROR (Thread-11) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: 385b4bc1-e9d7-46a4-888a-c78435921f6a", "errorCode": "500" }
17-04-29 23:11:24 ERROR (Thread-11) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable

17-04-30 00:02:24 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.toon_van_eneco is taking over 10 seconds.

17-04-30 00:28:33 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.gas_current is taking over 10 seconds.

17-05-01 03:18:22 ERROR (Thread-8) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: f0ab7411-5f59-44d2-99f2-a7841a3e2419", "errorCode": "500" }
17-05-01 03:18:22 ERROR (Thread-8) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable
17-05-01 05:31:06 ERROR (Thread-5) [toonlib.Toon] 
	Status Code :404
	Text :<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

17-05-01 05:31:06 ERROR (Thread-5) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable
17-05-01 07:03:13 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.toon_van_eneco is taking over 10 seconds.
17-05-01 08:05:04 ERROR (Thread-4) [toonlib.Toon] 
	Status Code :500
	Text :{ "success": false, "reason": "Cannot retrieve common name for client: f0ab7411-5f59-44d2-99f2-a7841a3e2419", "errorCode": "500" }
17-05-01 08:05:04 ERROR (Thread-4) [toonlib.Toon] Could not get answer from service.
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/toonlib/toonlib.py", line 167, in _state
    state.update(self._get_data('/client/auth/retrieveToonState'))
TypeError: 'NoneType' object is not iterable

Hi @costas, I was fixing the same thing :slight_smile: I guess I have a merge conflict to sort out :wink:

oops, sorry :slight_smile:

@PuckStar, yeap, that is it. Although I was hoping for something more explicit on their side that the session is closed or something. This is quite genericā€¦ Anyway, I will see what I can do with itā€¦ Hold on people this is going to be a busy week for me so not sure how much time I can put into this. I can definitely say that this is going to be fixed by the end of next week though. Till then just restart your instances. :slight_smile: @PuckStar thanks a lot for your help! :slight_smile:

Youā€™re welcome. Itā€™s nice to see people picked up this Toon component again. I was afraid it would still take a long time before having Toon in HASS. So Iā€™m happy to see itā€™s going faster :slight_smile:

Can I change any log level to generate more detailed logs?

This is how I currently have it:

logger:
  default: info
  logs:
    homeassistant.components.automation: info
    homeassistant.components.scripts: info
    homeassistant.components.device_tracker: error
    homeassistant.components.http: error
    homeassistant.core: error

@costas, it is good to see you back. I was under the weather for a couple of days, so you didnā€™t miss much. I think I resolved the conflict and created a Pull request to merge everything back into master. Can you review the PR? Once we merge we should have full smoke detector support, although we are still waiting for @PuckStar to wave a burning paper under his detectors to see what happens in the api when an alarm is triggered :smiley:

@PuckStar no, this is enough thanks! I will tackle it and soon enough we are going to have full toon support :slight_smile:

@krocat, nice to be back :). I reviewed the PR and made some comments. Care to take a look? hope you fell better :slight_smile:

Hi @costas, nothing what some asperine canā€™t solve :wink: I donā€™t see your comments, do you need to sync still?

Stupid thing does not work if you donā€™t submit :slight_smile: They are in now :slight_smile: sorryā€¦