home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.4k stars 30.65k forks source link

Toon not working. #32475

Closed toudewolbers closed 4 years ago

toudewolbers commented 4 years ago

Home Assistant release with the issue: 0.106

Operating environment (HassOS/Generic): Hass.io

Description of problem: When people try to login it doesnt work. It seems like Toonalib (do i say that right) have to be changed because toon developers build in a new second login. Integration: https://www.home-assistant.io/integrations/toon/ https://github.com/home-assistant/home-assistant.io/blob/current/source/_integrations/toon.markdown

I'm not the only one with this problem. People who are logged in already seems to have data but new users / users who needed to login again got a error: Login is invalid.

Pls fix. ps, i hope i'm on the right place for this issue? newbie so sorry if the place is wrong.

This is the only reason i'm not yet been Nabu Casa-account member. I would like to pay 5 dollars a month if Toon is working.

regards, Tim.

dshokouhi commented 4 years ago

can you please post the error you received?

probot-home-assistant[bot] commented 4 years ago

Hey there @frenck, mind taking a look at this issue as its been labeled with a integration (toon) you are listed as a codeowner for? Thanks!

toudewolbers commented 4 years ago

can you please post the error you received?

When i try to login: i got this error: De opgegeven inloggegevens zijn ongeldig. What means: The specified login details are invalid. Or do you mean in the logs? I dont have any error in the logs. But i found some user that got some digging and it seems that Toon (Eneco) changed the login setup. What means that the toonapilib have to be changed to that standards... But i'm a newbie so dont shoot me for the wrong details :)

itguy013 commented 4 years ago

Any update? Same problem here, can’t logon. If i login on eneco it works.

frenck commented 4 years ago

I'm currently trying to spend a time block on it each day, to figure out a fitting solution.

itguy013 commented 4 years ago

Maybe Quby can help you. They give me a hint about using a long live token. Maybe that's possible? https://developer.toon.eu/authentication

frenck commented 4 years ago

@itguy013 I have contacts with Quby. It is not blocking from their end, it also isn't a research/unknown problem. Just takes a bit of time to implement. So please bear with me.

tomverboon commented 4 years ago

@frenck Any progress on your side in the last couple of weeks? I am really missing the Toon integration into my Home Assistant.

frenck commented 4 years ago

Still working on it, the Toon integration is quite big and making progress every day.

tomverboon commented 4 years ago

Great effort @frenck ! Please keep us posted.

costastf commented 4 years ago

Hi all, hope everybody is healthy and doing good. @frenck is there anything I can do to help? Should I refactor the authentication to some specification?

tomverboon commented 4 years ago

Still working on it, the Toon integration is quite big and making progress every day.

How are you doing @frenck ? Hope you are in good health.

What is your current status regarding the Toon update? Asking you out of curiosity.

itguy013 commented 4 years ago

So, any update someone? It been a while now..

junrt commented 4 years ago

It will be much appreciated ;-)

basvankuijck commented 4 years ago

I'm experiencing the same thing (hassio, ha v0.111.3) All of a sudden my integration stopped working (since 06:00) looking into my logs I saw the following:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/toonapilib/toonapilib.py", line 149, in _get_challenge_code
    code = location.split('code=')[1].split('&scope')[0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup
    hass, self
  File "/usr/src/homeassistant/homeassistant/components/toon/__init__.py", line 82, in async_setup_entry
    display_common_name=entry.data[CONF_DISPLAY],
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/toonapilib/toonapilib.py", line 113, in __init__
    self._authenticate()
  File "/usr/local/lib/python3.7/site-packages/toonapilib/toonapilib.py", line 157, in _authenticate
    code = self._get_challenge_code()
  File "/usr/local/lib/python3.7/site-packages/toonapilib/toonapilib.py", line 152, in _get_challenge_code
    raise InvalidCredentials(response.text)
toonapilib.toonapilibexceptions.InvalidCredentials

I removed the integration and re-added the Toon integration, but after the username / password entry it returns the same thing as mentioned above. Although the credentials are correct (-> I'm able to login to eneco.nl)

frenck commented 4 years ago

Their authentication method used by the current integration is now completely dead, not only for new users, but now also affect new users.

I've been slowly continuing building and I'm more than halfway there. I'm currently working on the configuration / UI flow to support OAuth2 authentication.

I'm trying to get something workable asap.

junrt commented 4 years ago

Thanks @frenck ;-)

Daan1203 commented 4 years ago

Thanks @frenck. Can't wait!

frenck commented 4 years ago

Current state:

image

So most is up and running. This includes new authentication for Toon (Eneco), Boxx (Eltrabel) & Viesgo user.

Preparations for live (push) updates are in as well. My current aim is to get it out as a polling integration (as it always has been) to get everything up and running again.

NielsEij commented 4 years ago

Thanks Frenck fore your hard and amazing work!! I can't wait to ad te integration!

Daan1203 commented 4 years ago

Current state:

image

So most is up and running. This includes new authentication for Toon (Eneco), Boxx (Eltrabel) & Viesgo user.

Preparations for live (push) updates are in as well. My current aim is to get it out as a polling integration (as it always has been) to get everything up and running again.

Is the current Home Assistant Toon integration also your work? When you finished the problem, that integration will be working again or is this an other one?

frenck commented 4 years ago

@Daan1203 This is the toon integration from Home Assistant itself, which is partly my work. I'm working on updating the built-in integration.

frenck commented 4 years ago

Ok, so some new sensor data, verified all of them work now and are correctly updated. Changed the integration to be fully async now 🚀

The thermostat is now fully implemented

image

Furthermore, the implementation of making Toon a push-based integration instead of polling was easier than expected.

So the next version of the integration will have live updates.

rvdm commented 4 years ago

This is very much worth waiting for. Happy to help test when needed. Thank you (from a long-ago toon reverse-engineer)!

rkluijt2 commented 4 years ago

THanks sounds and look great. Keep up the good work. When you need a teste please feel free.

Daan1203 commented 4 years ago

@Daan1203 This is the toon integration from Home Assistant itself, which is partly my work. I'm working on updating the built-in integration.

Great! I am new in the Home Assistant world. Is the update you made, already working for everyone?

frenck commented 4 years ago

@Daan1203 This is an integration provided by Home Assistant Core (built-in). It is bound to a Home Assistant release, which happens every 3 weeks. The next one is planned for 1 July.

That said, I'm still developing, so it is not ready for inclusion yet. While I do hope to get it ready in time for the beta cut-off (upcoming Wednesday), it needs to be reviewed as well. So this is going to be tight.

Either it will be part of Home Assistant 0.112 or 0.113.

frenck commented 4 years ago

Ok, final screenshot:

image

Pull request is open to add this to the codebase in #36952