Open keanuplayz opened 4 years ago
Are you using that exactly as displayed? If so then the region is invalid, which is I guess why its throwing that exception. Change region to 'eu', 'us' or 'cn' and it should stop throwing that error.
Just ran it with exactly the same configuration:
And the output was:
Should I use single quotes, perhaps?
Are you using that exactly as displayed? If so then the region is invalid, which is I guess why its throwing that exception. Change region to 'eu', 'us' or 'cn' and it should stop throwing that error.
I tried with my account and it said: "found new region: >>> as <<< (you should change api_region option to this value in configuration.yaml)". Upon changing region to 'as', it's also throwing that exception.
Any chance you'll add support for 'as' region? Or would you point me in the right direction and I'll modify the library myself? thanks!!
I have the same issue. Was this ever fixed?
I have the same issue. Was this ever fixed?
I believe I got it working for a period of time, but unfortunately I can no longer remember what I did back then.
I ended up flashing Tasmota on all my Sonoff devices and never looked back 👍🏻
Thanks for the speedy response @leejunweisg. I was hoping not to flash anything if I can avoid it. If anyone has some advice it would be highly appreciated.
When I look at resp
after
r = requests.post('https://{}-api.coolkit.cc:8080/api/user/login'.format(self._api_region),
headers=self._headers, json=app_details)
resp = r.json()
I have {'error': 403, 'msg': 'Sign:oauthClient enable invalid'}.
I just logged in to ewelink using the exact same credentials and had no issue, yet this doesn't work:
s = sonoff.Sonoff("XXXX@XXX.com","XXXXX",'as')
Thoughts?
I have some issue !
Was anybody able to find a solution for this?
Just to save your time guys - error occurs due to usage of obsolete API. You can check how new one is used here https://github.com/AlexxIT/SonoffLAN/blob/master/custom_components/sonoff/core/ewelink/cloud.py
> Just to save your time guys - error occurs due to usage of obsolete API. You can check how new one is used here https://github.com/AlexxIT/SonoffLAN/blob/master/custom_components/sonoff/core/ewelink/cloud.py
thanks! that means that this sonoff-python is not working with the new API?
i'm getting the same
` self._bearer_token = resp['at']
KeyError: 'at'
`
Yep,
You still can fix it. xD
I did it 6 months ago, but that was very hardcoded solution and cost me definitely to much time so I would suggest to go and find something what works on that moment. If you want to go with fixing - as far as I remember I had to find new api endpoints and adjust response fields. Those should be in a code I sent in previous comment
thanks for the fast answer! yeah i'm just looking for the new api endopints.... but first, as you said, i should look for something that actually works
First off, let's start off with displaying my code:
This code was copied straight from the example, and modified to drop
config
, since it was making trouble on my end.After running this, I get quite the abnormal error from the code.
After delving into the source of this library, I found the exact line from where the exception originates. Line 123:
self._bearer_token = resp['at']
I have absolutely no idea how to fix this, as I am not willing to make modifications to a library I don't understand, unless guided by someone who does.
If anyone can lend a hand with this, you'd have my sincere gratitude.