core: [Climate] Toon doesn't setup on version 0.87.1

Home Assistant release with the issue: 0.87.1

Last working Home Assistant release (if known): 0.87.0

Operating environment (Hass.io/Docker/Windows/etc.): Docker

Component/platform: https://www.home-assistant.io/components/climate.toon/

Description of problem: Component doesn’t work after update.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

toon:
  username: !secret toon_username
  password: !secret toon_password

Traceback (if applicable):

Error during setup of component toon
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 148, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/toon.py", line 52, in setup
    hass.data[TOON_HANDLE] = ToonDataStore(username, password, gas, solar)
  File "/usr/src/app/homeassistant/components/toon.py", line 70, in __init__
    toon = Toon(username, password)
  File "/usr/local/lib/python3.6/site-packages/toonlib/toonlib.py", line 66, in __init__
    self._login()
  File "/usr/local/lib/python3.6/site-packages/toonlib/toonlib.py", line 123, in _login
    self._authenticate()
  File "/usr/local/lib/python3.6/site-packages/toonlib/toonlib.py", line 81, in _authenticate
    data = response.json()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional information:

screen shot 2019-02-12 at 16 12 29

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 88 (43 by maintainers)

Most upvoted comments

Current state:

image

image

I’ve released the PR for re-review.

I’ve started working on a replacement implementation. Let’s see if I can manage to get something out.

@frenck There is already an updated version for this component at https://github.com/costastf/toonapilib It uses the new official API. Only one issue has to be resolved: krocat/ToonHA#40. After that it can be migrated directly.

Current state: 2019-02-16 18 49 47

Starting with sensors now.

@scheric I read your comment again and was incorrect in my response (or can be confusing). I’m using the toonapilib by costastf, but am not basing it off the krocat component version.

While I use the krocat version myself as well (at this moment), it is not up to par with the latest and greatest best practices of HA. Hence I’ve started on an implementation from scratch. Implementing, async, config entries, data entry flows (Integrations from UI), entity registry, device registry, supports areas, also added in support for multiple devices (in the same or different accounts).

Current state: Finished with basic component setup. Configuration from UI works (includes authentication from the UI), Toon display selections and the Toon devices get registered and are showing up nicely including firmware information and such.

Next steps would be setting up the specific platforms (climate, binary_sensors, sensors, switches, and lights).

@jpduhen it does not replace the toon module. You have to install it between your nefit and toon module. There is a manual available in the toon forum i believe. For install steps see this dutch forum: https://forum.eneco.nl/aan-de-slag-met-toon-160/hoe-sluit-ik-de-ketelmodule-aan-17355

@aalbul I don’t have access to that data from the current state of the library used. We could look into adding that in a future release. For now, my focus was on getting the component in a working and clean state.

@timon71 Thanks, but not needed. Got the data… Working on the representation. Burner status will be in there… but not sure if that would be a binary sensor or an attribute of the climate component.

In case of it being an attribute, you can always use a simple template to turn it into a binary sensor (no hacking needed).

@Knol010, @Johnyboy1960, @Onandon11

The power cost Will always be 0 in the weekends. This is the fault of the toon API. The toon servers only calculate the day cost from the tariff1 power usage.


I have already send them an email (1 or 2 weeks ago) but no reaction back. You could send them an email to. Maybe they are only solve problems if more people request a change.

@hmmbob Yes. You are right. The Krocat/ToonHA master works with the home Assistant. Look at Krocat/ToonHA#45 to see some more information on what is different.

The changes aren’t that ugly. There only needs to be an extra mode if the toon is in manual mode. See: https://github.com/krocat/ToonHA only STATE_OFF Is added. The states are already messed up so why not make it a tiny bit worse for extra compatibility with the google assistant.


There need to be more people who accept this change otherwise it will only be usable after the architecture fix is merged.

Great job all! Just a little bit more patience until it is working again. Love this community!

With 0.89, the next release. It’s scheduled for next Wednesday.

@NeuzNL It is not an add-on, but a component. And is unfortunately not testable as a custom component (I guess that was your question?) The component uses the config flow, which is not available for custom components.

Nevermind, just saw the PR. 😉

On Tue, Feb 19, 2019 at 8:48 AM Ron ron@cyberjunky.nl wrote:

It’s something I look into, but some info is not available on the rooted toon. Frenck, is your code available somewhere?

On Mon, Feb 18, 2019 at 10:35 PM Franck Nijhof notifications@github.com wrote:

@hmmbob https://github.com/hmmbob I don’t own a rooted Toon, therefore I’m not the right person to ask or write this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/21010#issuecomment-464888157, or mute the thread https://github.com/notifications/unsubscribe-auth/AFMd-fwZCC5TvD03w_sEv1jpDj6VtLO8ks5vOxyegaJpZM4a2oRb .

@hmmbob I don’t own a rooted Toon, therefore I’m not the right person to ask or write this.

@frenck looks great. I know what you’ve said before, but do you think this would be easy to port to a version that supports the rooted Toon?

I can imagine one doesn’t need the onboarding flow with Eneco as the API is local, but do you think other parts of your code are portable?

Ok, current state in that case:

image

image

Some sensor values still need some calculations/adjustments,

@hmmbob No that is not possible, that logic would differ completely and should really be implemented as a separate component.