Toon van Eneco custom component

[email protected]

i believe that putting your email and pwd in ‘ ‘ should do the trick

Since configuration files are yaml quoting should not be necessary, but white space is. I am guessing that he did not leave a space between the key and value confusing the parser.

Here is what I have added in the configuration.yaml:

Eneco Toon

toon:
username: [USER]\@[SOMEDOMAIN]
password: *********
consumer_key: ******
consumer_secret: ******

But the error says there is an error on line 7 in the toon.py and that is weird as that line begins with the doctype html statement

Why are there first 6 empty lines in the toon.py ?

EDIT: I just removed the backslash before the @ and placed double qoutes in front and at the end of the username, which is an e-mail address. But that didn’t help still error on line 7 in toon.py message. Also single quotes gives me the same.
I tried to change the username for de Toon app, but it doesn’t allow me to change it to a normal name it needs an email address as username, that is stupid :frowning:

I think I might have found the issue and I’m a bit embarrassed. The toon.py is not a phyton script it’s an html file, so I downloaded it the wrong way. I right clicked the toon.py from github and selected save link as. I tought it would download and save the file but it just saves the contents if the github page (duh…)
Sorry guys, I’ll download it the right way and have it another try. Will let you know :smile:

EDIT: YES !!! It’s working now. The check config is succesfull and after the restart I’ll get the gauges in my dashboard !

Hi @boltgolt! I have been extremely busy with work the last couple of months and have not looked into much other than that. How are we doing with the new component getting into HA? Would you need any help with anything getting it done?

I was waiting with the pull request in the main hass repo because of the current open PR in ToonHA. I’ll update the documentation and start the process after that.

Anyone experiencing issues today? My component is not working anymore after a reboot. (I already rebooted Toon, and the app is working)

Error during setup of component toon
Traceback (most recent call last):
File “/usr/src/app/homeassistant/setup.py”, line 145, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/toon.py”, line 70, in setup
config[‘toon’][CONF_NAME])
File “/config/custom_components/toon.py”, line 116, in init
self.update()
File “/usr/src/app/homeassistant/util/init.py”, line 319, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/toon.py”, line 123, in update
self.data[‘power_current’] = self.toon.power.value
File “/config/deps/lib/python3.6/site-packages/toonapilib/toonapilib.py”, line 322, in power
power = self.status[‘powerUsage’]
KeyError: ‘powerUsage’

Same here !
The dashboard says “Invalid Config”
I thought it had to do with the new version 0.67 which I installed yesterday so I downgraded back to 0.65.5 but still invalid config.
Also I restored my backupped configs but that didn’t work.
So it has luckily nothing to do with the version I was running or changes to my config, although I only had changed something in my automation and not the main config.
So I can upgrade to 0.67 again :slight_smile:
And hopefully someone knows the answer and has a solution to get this working again.

Glad to hear its not just me :wink:

1 Like

I’ve the same problem and only receive data on the agreements nothing else.

Ok, so I’m wondering are we the only two who have this issue coming out of the blue ?

I’ve mailed the devsupport from the toon api to see if they’ve changed something, will report back when I get a response.

1 Like

It’s hot outside maybe less people using it :wink:

Dutch summer will be over before we know it :wink:

Hi everyone. Sorry for taking this long to deal with this but I have been pretty swamped. v3.0.1 should fix this issue so please update your dependency on the component and let me know. The issue was that upon accessing the status the api now initially responds with a 202 (accepted request) and on the second attempt send the actual data. The library is treating some values as required so it was by design that it broke on the accessing of the key. Now that we actually reached a point that we had issues with those keys, I have made a custom exception if those keys are not present and dump the contents of the status which will help troubleshoot things in the future. Thanks for everyone’s patience!

2 Likes

Thank you very much @costas it works!

Thank you costas for the update. It is working again

The update isn’t working for me, it was working flawless for the last period untill the Toon updated it’s firmware. Updated Home Assistant to 0.67.1 and toonapilib to 3.0.1.

I get the following log when starting:

2018-04-23 22:48:17 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=551 from 2018-04-23 20:46:58.808148)
2018-04-23 22:48:18 INFO (MainThread) [homeassistant.components.camera] Setting up camera.generic
2018-04-23 22:48:18 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.denon
2018-04-23 22:48:21 INFO (MainThread) [homeassistant.components.camera] Setting up camera.uvc
2018-04-23 22:48:21 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.cast
2018-04-23 22:48:21 ERROR (MainThread) [homeassistant.setup] Error during setup of component toon
Traceback (most recent call last):
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\site-packages\homeassistant\setup.py", line 145, in _async_setup_component
    component.setup, hass, processed_config)
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\asyncio\futures.py", line 381, in __iter__
    yield self  # This tells Task to wait for completion.
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\asyncio\tasks.py", line 310, in _wakeup
    future.result()
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\asyncio\futures.py", line 294, in result
    raise self._exception
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\concurrent\futures\thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\NUC\AppData\Roaming\.homeassistant\custom_components\toon.py", line 60, in setup
    solar)
  File "C:\Users\NUC\AppData\Roaming\.homeassistant\custom_components\toon.py", line 97, in __init__
    self.update()
  File "c:\users\nuc\appdata\local\programs\python\python35-32\lib\site-packages\homeassistant\util\__init__.py", line 319, in wrapper
    result = method(*args, **kwargs)
  File "C:\Users\NUC\AppData\Roaming\.homeassistant\custom_components\toon.py", line 104, in update
    self.data['power_current'] = self.toon.power.value
  File "C:\Users\NUC\AppData\Roaming\.homeassistant\deps\Python35\site-packages\toonapilib\toonapilib.py", line 289, in power
    power = self.status['powerUsage']
KeyError: 'powerUsage'
2018-04-23 22:48:21 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.webostv
2018-04-23 22:48:22 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.spotify

You do not seem to be on the latest toonapilib version. Please make sure to update the version in the component as this seems to be the previous version of the library.

Any help on how to update the toonlib please ?
I tried using ‘sudo pip install toonlib’ but get the following message:

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting toonlib
  Downloading https://www.piwheels.org/simple/toonlib/toonlib-1.1.2-py2.py3-none-any.whl
Collecting requests==2.13.0 (from toonlib)
  Downloading https://files.pythonhosted.org/packages/7e/ac/a80ed043485a3764053f59ca92f809cc8a18344692817152b0e8bd3ca891/requests-2.13.0-py2.py3-none-any.whl (584kB)
    100% |████████████████████████████████| 593kB 2.0MB/s
Collecting cachetools==2.0.0 (from toonlib)
  Downloading https://files.pythonhosted.org/packages/78/2e/2a99728bab1a8a00e997efc9d5adbb1dc822c44fbde071ca7fc2d8758286/cachetools-2.0.0-py2.py3-none-any.whl
toonapilib 3.0.0 has requirement cachetools==2.0.1, but you'll have cachetools 2.0.0 which is incompatible.
toonapilib 3.0.0 has requirement requests==2.18.4, but you'll have requests 2.13.0 which is incompatible.
homeassistant 0.65.5 has requirement requests==2.18.4, but you'll have requests 2.13.0 which is incompatible.
Installing collected packages: requests, cachetools, toonlib
  Found existing installation: requests 2.18.4
    Uninstalling requests-2.18.4:
      Successfully uninstalled requests-2.18.4
  Found existing installation: cachetools 2.0.1
    Uninstalling cachetools-2.0.1:
      Successfully uninstalled cachetools-2.0.1
Successfully installed cachetools-2.0.0 requests-2.13.0 toonlib-1.1.2

Also tried to remove the toonapilib and install:

pi@hassbian:~ $ sudo pip install toonapilib
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting toonapilib
  Downloading https://www.piwheels.org/simple/toonapilib/toonapilib-3.0.1-py2.py3-none-any.whl
Requirement already satisfied: requests==2.18.4 in /usr/local/lib/python3.5/dist-packages (from toonapilib) (2.18.4)
Requirement already satisfied: cachetools==2.0.1 in /usr/local/lib/python3.5/dist-packages (from toonapilib) (2.0.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->toonapilib) (2018.1.18)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->toonapilib) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->toonapilib) (1.22)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests==2.18.4->toonapilib) (3.0.4)
toonlib 1.1.2 has requirement cachetools==2.0.0, but you'll have cachetools 2.0.1 which is incompatible.
toonlib 1.1.2 has requirement requests==2.13.0, but you'll have requests 2.18.4 which is incompatible.
Installing collected packages: toonapilib
Successfully installed toonapilib-3.0.1

But still no luck, I can’t get it to work.

Toon error in the Info:

Sat May 12 2018 15:46:09 GMT+0200 (W. Europe Daylight Time)

Error during setup of component toon
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    component.setup, hass, processed_config)
  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/toon.py", line 60, in setup
    solar)
  File "/home/homeassistant/.homeassistant/custom_components/toon.py", line 97, in __init__
    self.update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 319, in wrapper
    result = method(*args, **kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/toon.py", line 104, in update
    self.data['power_current'] = self.toon.power.value
  File "/srv/homeassistant/lib/python3.5/site-packages/toonapilib/toonapilib.py", line 289, in power
    power = self.status['powerUsage']
KeyError: 'powerUsage'