New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netatmo OAUTH2 change to auth_code grant (from password) #5815
Conversation
Thank you! |
Ready for me ! |
@jcbraem , just double check, ready=working? |
I've added the scope for the co2 detector and i could successfully added the hardware. |
Which scope is that? Currently the Netatmo module uses a fixed lists of scopes (see above). Maybe we need to add an additional scope? And not sure if the module contains the logic to handle the smokedetector/co2 module (yet). |
Scope: read_carbonmonoxidedetector |
I wanted to let you know, that everything works like it did before. |
Which scope is that? Currently the Netatmo module uses a fixed lists of scopes (see above). Maybe we need to add an additional scope? And not sure if the module contains the logic to handle the smokedetector/co2 module (yet).
hmm... according to the docs that scope does not exist. Any clue if/where to find better documentation? Maybe about the API calls for the co2 sensor? |
Hello, |
No idea how long the token is valid (could be an hour or less which is not uncommon) but the refresh token is usually valid for a few hours or day(s). What do you have in your log? How long was the internet connection down? Did the module retry several times? Option 2 is not planned as it is not possible to implement that in the current setups. |
maybe we need to discus this on a different thread but it seems that Netatmo.h only uses NETYPE_WEATHER_STATION = 0, NETYPE_HOMECOACH, NETYPE_ENERGY So I aspect the Homecoach and the thermostat valves will work, but this is not. @Fill1234 |
Sorry I have don't check the log and no idea of downtime. |
My internet was down for a couple of hours, and now even when regenerating the code it returns authentication errors. I'll try it again tomorrow, but has anyone seen this also? Not sure what solved it, but I did a couple of deactivate/activate, generating some codes. it started to work again. |
@kiddigital |
@Phil353556 , thx. And that mechanism is used by domoticz. Each time the access token expires (after 3 hours), it will use the refreshtoken to request new tokens and receive a new access token AND new refreshtoken. The refreshtoken is valid for a longer time, but will expire as well after some time. |
Hello all, Sorry but I am a bit lost. As Fill1234 previously stated when you enter a redirect URI I get a warning and cannot generate a Token. It would be verry helpful is one of you can help me a step in the right direction. |
Hi, |
@Phil353556 , you saved my day. |
You're welcome 👍 |
My Netatmo devices are not battery operated so I have no experience and my two Sonoff battery powerd devices are just 2 weeks old and do give 100% battery level. |
ok |
New breaking change from Netatmo ! 04/12/2023 |
@JurgenLB , we are already using the refresh token, do you experience an issue? |
I have just updated to the new Netatmo login procedure after my setup finally had trouble logging in after many years without issues. All working again thanks to this work, thank you. The only issue I've spotted is that if I reboot Domoticz or restart the Netatmo worker, the access "code" will be out of date so I need to rerun the URL to generate a fresh one and update it in Domoticz. I assume that if I experience an internet issue, the same access code issue will also occur. At least for now I know how to get things working again. |
Am I alone with this behavior? |
currently rebuilding my system. But will look in to it. |
Hi, I am testing the last version of netatmo plugin with domoticz beta [2023.2 (build 15667)] |
what do you mean with "percentage level' what device type is this? What is the default label? |
I'm running build 2023.2 '15727' So no smoke sensors, no thermostat Valves and no Homecoach or door-sensors / camera's. The Homecoach can not work together with a Weatherstation in Domoticz because of the IFNOT-statement in I believe the battery is only running on startup and is not called again. |
Okey, but do you see a battery level for each normal device? Because the battery level is taken from the API result |
If it is possible to have the battery level not only at startup but one per day, it would be useful. |
What I was asking, the battery level reported in the devices tab should be the lastest battery level being reported from the API The percentage sensor is only being updated in the function ParseHomeStatus, the function ParseStationData is only taking the battery level, using it downstream, but is not creating a percentage sensor Edit: https://www.domoticz.com/wiki/Battery_level_check So, does the battery level in the devices tab reflect the correct state? |
I have checked the battery levels; When I run lNetatmo.py the percentages are different ; There can be a few minutes between the two but the difference is to large. so the battery level has not the correct state. |
Small PR addressing issue #5766
Not the most user friendly (option 1 as discussed in the issue) but not to difficult to set up. Should be done only once as long as domoticz is able to keep refreshing the tokens.
step 1:
Setup an App under MyApps in the Netatmo developers portal
http://localhost/netatmo
Once configured correctly, the Client_ID and Client_Secret will be generated and shown.
step 2:
In the domoticz hardware setup:
<client_id>:<client_secret>
<code>
To retrieve the code (a.k.a. authorisation_code), use the browser and type the following URL. Make sure to fill in the CLIENTID with your clientid!
This URL brings you to the My Netatmo page where you have to identify yourself and are asked for permission to grant access to certain devices and types (based on the scope provided).
After confirmation, your browser will try to redirect you to a page it cannot find so you will get an error. But the URL of that page is visible in the browser and looks like
http://localhost/netatmo?state=teststate&code=<SOMECODE>
.You need to pass this SOMECODE as the password in the domoticz hardware screen.
NOTE:
read_station read_thermostat write_thermostat read_homecoach read_smokedetector read_presence read_camera