krocat / ToonHA

Home-Assistant component for Toon by Eneco

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup failed for toon: Component failed to initialize.

PostSven opened this issue · comments

using the new files.

b'{"fault":{"faultstring":"Invalid Authorization Code","detail":{"errorcode":"keymanagement.service.invalid_request-authorization_code_invalid"}}}'
NoneType: None

configuration.yaml entries:
toon:
username: 'username'
password: 'password'
consumer_key: consumerkey
consumer_secret: consumersecret

Could this be related to toonapilib? @costas

Setup failed for toon: Component failed to initialize.
‎14‎:‎26 setup.py (ERROR)

b'{"fault":{"faultstring":"Invalid Authorization Code","detail":{"errorcode":"keymanagement.service.invalid_request-authorization_code_invalid"}}}'
‎14‎:‎26 /config/deps/lib/python3.6/site-packages/toonapilib/toonapilib.py (ERROR)

Does the library work by itself for you @PostSven ? Although the message is pretty self explanatory. Could you post the whole stack trace here please?

The old component worked fine for me.

What do you need me to do, I am kind of new to all of this :) sorry

This is my full error log now:
8-01-13 14:53:23 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2018-01-13 14:53:25 WARNING (MainThread) [homeassistant.setup] Setup of media_player is taking over 10 seconds.
2018-01-13 14:53:27 ERROR (SyncWorker_12) [toonapilib.Toon] b'{"fault":{"faultstring":"Invalid Authorization Code","detail":{"errorcode":"keymanagement.service.invalid_request-authorization_code_invalid"}}}'
NoneType: None
2018-01-13 14:53:27 ERROR (MainThread) [homeassistant.setup] Setup failed for toon: Component failed to initialize.
2018-01-13 14:53:49 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

I am getting the same too...

2018-01-13 15:55:17 ERROR (Thread-2) [toonapilib.Toon] b'{"fault":{"faultstring":"Invalid Authorization Code","detail":{"errorcode":"keymanagement.service.invalid_request-authorization_code_invalid"}}}'
NoneType: None
2018-01-13 15:55:17 ERROR (MainThread) [homeassistant.setup] Setup failed for toon: Component failed to initialize.

configuration.yaml

### Toon custom component
toon:
    username: !secret toon_username
    password: !secret toon_password
    consumer_key: !secret toon_consumer_key
    consumer_secret: !secret toon_consumer_secret

getting one step further.... @PostSven you might need to change username and password from Toon to the new ToonAPI username and password. i don't get that error anymore but..... i now get:

2018-01-13 16:15:38 ERROR (MainThread) [homeassistant.setup] Setup failed for toon: Component failed to initialize.

Right, the username and password are not the eneco ones but the api ones. Please make sure that your app in the new api is enabled. If that is the case try out the library outside of the component to help troubleshoot. In a pc with python install http://toonapilib.readthedocs.io/en/latest/installation.html and then try to authenticate and use it http://toonapilib.readthedocs.io/en/latest/usage.html

Traceback (most recent call last):
File "C:\Users\User\Desktop\Test.py", line 8, in
toon=Toon(eneco_username, eneco_password, consumer_key, consumer_secret)
File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\toonapilib\toonapilib.py", line 96, in init
self._authenticate()
File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\toonapilib\toonapilib.py", line 120, in _authenticate
code = self._get_challenge_code()
File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\toonapilib\toonapilib.py", line 115, in _get_challenge_code
raise InvalidCredentials(response.text)
toonapilib.toonapilibexceptions.InvalidCredentials

Credentials are correct, so are the api keys and the application is approved.

I'm getting the same error on an installation that worked just fine 3 days ago, i have no clue what has changed but i'm looking into it.

@costastf i'm getting a thrown toonapilib.toonapilibexceptions.InvalidCredentials error when i enter my Toon developer account credentials, but when i use my Toonopafstand details i get:

{
	'fault': {
		'faultstring': 'Invalid Authorization Code',
		'detail': {
			'errorcode': 'keymanagement.service.invalid_request-authorization_code_invalid'
		}
	}
}

and a toonapilib.toonapilibexceptions.InvalidConsumerSecret gets thrown while i'm 100% sure it's correct.

It seems like something is specifically going wrong with the customer secret, the customer key is accepted just fine. As I'm quite sure now that it's a problem in the underlying library I'll leave this one to you, unless you're too busy @costastf

I am getting the same error and as this is not an error coming from the library but from the underlying service as it is plain to see, I would guess that there is something wrong with the toonapi service. Right now the only thing I can suggest is to give it some time in case it is an intermittent authorization service issue. If this keeps up, the next step is to communicate with the service.

The credentials I have been using and it has been working, just to clarify are the eneco credentials, the ones one would use to connect to the eneco site as username and password and not the ones created for the api.

So, looking into their documentation, it seems that they have changed the authentication process. So much for "official, stable api". Anyway,I will have a look tomorrow morning and try to figure out the changes and implement them. Until then, have a wonderful evening everyone.

Same to you @costastf

Nice one, and great timing with this merge Eneco. If i can do anything to help just @ me.

toonapilib v1.0.1 fixes the authentication issue. Lets see ...

Bumped version of toonapilib in ToonHA. Please provide feedback here.

That fixed it, it's working as expected for me.

Same for me, running fine now!

Thanks for the hard work everyone

Just came back from a walk and noticed this... tested right away aaaand works!

Thanks a lot you guys!