-
Notifications
You must be signed in to change notification settings - Fork 4
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
"message": "Invalid access token", #4
Comments
Same here, I am using this script for a long time without any problems. But since yesterday (09.05.2022) afternoon I'm getting "Invalid access token". |
I think it is a Netatmo side change in the auth process (I have the same issue since two days), but I don't know what to change in the code to make it work again... |
I use a Mac menu bar app that also logged me out suddenly so I'm guessing Netatmo changed something that broke other tools. |
Not sure if this helps.. I'm using Hoobs with this plugin: https://plugins.hoobs.org/plugin/homebridge-eveatmo |
Same problem here. |
I think I've got a fix for this. For me it is working, but I've changed your script to my needs. Regards, # ------------------------------------------------------
# Now let's fetch the data
# ------------------------------------------------------
# get token from hidden <input> field
# TOKEN="$(curl --silent -c $SESSION_COOKIE $URL_LOGIN | sed -n '/token/s/.*name="_token"\s\+value="\([^"]\+\).*/\1/p')"
# and now we can login using cookie, id, user and password
# curl --silent -d "_token=$TOKEN&email=$USER&password=$PASS" -b $SESSION_COOKIE -c $SESSION_COOKIE $URL_POSTLOGIN > /dev/null
# next we extract the access_token from the session cookie
ACCESS_TOKEN=`curl --silent --location --request POST "https://api.netatmo.com/oauth2/token" \
--form "grant_type=password" \
--form "client_id=YOUR_CLIENT_ID" \
--form "client_secret=YOUR_CLIENT_SECRET" \
--form "username=YOUR_USERNAME" \
--form "password=YOUR_PASSWORD" | jq -r '."access_token"'`
# build the POST data
PARAM="access_token=$ACCESS_TOKEN"
# now download json data
curl -d $PARAM $API_GETMEASURECSV
# clean up
# rm $SESSION_COOKIE |
I only had to change the json parser parameter and then section works fine
|
Thank you for your change proposals. Unfortunately it does not work for me. Do you have any idea what to do without using jq command? What does "YOUR_CLIENT_SECRET" mean? |
"I think I've got a fix for this. p.s. -- |
Yes, I understand. So the old access method used by netatmo.sh is disabled since 9th of May 2022. The new access method described in https://dev.netatmo.com/ is more complex. You first have to create your own "Netatmo-App" and then you got the client id and the client secret. So perhaps we have more security but also a lot of work. |
Does anyone have a solution or idea ? I filled out the form from above from Dani1802 with my credentials missing like secret and id but no effect. Also changed the line from jawilczek without the " {"error":{"code":10,"message":"'device_id' is mandatory"}} is now the error if I go with the codes above Damn Netatmo every year the same shit with the changed authentication |
which procedure did you edit ? |
"my" version below based on @Dani1802 fix. (.csv is no longer supported - only .json) |
@jawilczek Thank you for your new version. It works for me partly. min_file_size has to be adjusted, because the json files are obviously smaller than the csv files, e.g. I had to set min_file_size=6000 for the -y option to get results. |
@debianatoe p.s. |
Jawilczek where can I find the information that csv export is no longer available ? I export all data via csv and import that in my own database to make comparisons between weather data since years now. Hopefully not true |
@Gerudom https://dev.netatmo.com/apidocumentation/weather#getmeasure -- |
This is a horrible. Feels like the end of everything I collect data since year 2016 Unfortunately the export files you export are named like 7617KG I found out which one represents which module. So far so good. Where is the code line for that names ? But in that export which value is what ? This is my outdoor module e.g export JSON from your file beg_time | step_time | value/0/0 | value/0/1 | value/1/0 | value/1/1 | value/2/0 | value/2/1 Value 1/1 could be Temperature but the rest ? Isn't it possible to name the export values like the values it represents like "module_name": "Außen", Thanks |
I use -D option & jq json parser eg. netatmo.sh -D | jq ".body.modules[1].dashboard_data.WindStrength" netatmo.sh -D | jq ".body.modules[3].dashboard_data.CO2" of course you can get all the data into a file and offline it is parsed with jq -- |
I don't get that to work like that and how I need it. |
@Gerudom why converting from JSON to CSV and then import? If you or anyone else is interested in that, I've published it here: https://github.com/Dani1802/netatmo_to_influx |
@Dani1802 why converting from JSON to CSV and then import? -> Until now it was CSV Exports since 2016. I have a MySQL DB. Need to look how this is possible. There is a lot of data already stored in that Database since that years... I put everything in and I get data out of your example. Now I just need to import that data into my MYSQL Database anyhow... curl is a HTTP client. MySQL doesn't use the HTTP protocol. |
@Gerudom maybe you can use something like: mysql --user=$DB_USER --password=$DB_PASSWD $DB_NAME << EOF To insert the data to the database within the bash script |
Ok got it thanks @Dani1802. I once got a field exported called dt_readings if I do so manually from Netatmo Page it's called "timezone" in which a readable date was in beside the ms unix timestamp. Do you know if this datafield is still exportable ? |
There are some JSON to CSV converters:
I don't know which one is really suitable. |
Can anyone help me interpret the JSON data? With the CSV data, we had a header line and then a single line for each measurement time, e.g.
In JSON format it looks like this for me:
beg_time is timestamp. But what does step_time mean? And why do I have 3 (different) values? |
@debianatoe Yes, you are right with different databases, but I think every DB should have a CLI to write data. So for me, the main difficulty was to get the data from Netatmo and to parse them for the information I need. In my JSON a indoor module for example looks like this:
and the rain module looks like this:
|
It seems easier to me to get data from a financial institution than from Netatmo. Since all my pre-checks are based on csv, I decided to convert JSON to CSV. |
Hi guys, is possible to download thermostat data? |
How long a range does it take for you? I tried the command: and unfortunately it takes a maximum of 3 days to download. |
Was there a change again ? At https://dev.netatmo.com/apps I reset my client ID and client secret and fill the new data in the script, but the same message. I see also the fields "Token generator: Choose scopes =>" and than => "Read station", have I to use this also (now) ? |
@topsurfer : #5 |
Hi two days ago, netatmo will turn off the old authorization method - which it warned about. **"BREAKING CHANGE: Netatmo seems no longer (july 2023) to allow grant_type "password", even for an app credentials that belong to the same account than the home. They have added the capability of creating access_token/refresh_token couple from the dev page (the location where app are created). As a consequence, the username/password credentials can no longer be used and you must replace them with a new parameter REFRESH_TOKEN that you will get from the web interface. "**__ Below is the concept - not the complete code ------------------------------------------------------Parsing Arguments------------------------------------------------------ID=$1 device list requestedif [ "${list_devices}" == "1" ] ; then |
@jawilczek would it be possible for you to fork the whole project and make changes there? |
Working code is attached of course you have to fill in your configuration data and get the refreshcode from the netamto website -- |
Script works, but there is problem with downloading. For example command: This command will download only from 2.jan to 5.jan and not to 1.feb. Could you please check it yourself? |
I personally only use the -D option, but I checked with your parameters, the result is the same as yours. From what I've read, it's a netatmo API limitation. Plese read https://dev.netatmo.com/apidocumentation/weather#getmeasure parameter limit Maximum number of measurements (default and max are 1024) -- |
Uff, need all last and actuall year :D :D |
you can download day by day in some loop :) -- |
So need script for this :D It would be a pain to do it manually. |
@Dani1802 He Dani 1 year later Netatmo did it again :( @Gerudom why converting from JSON to CSV and then import? If you or anyone else is interested in that, I've published it here: https://github.com/Dani1802/netatmo_to_influx can you get that running again ? My whole solution was build from that again. I'm back at the point May 2022 1 year later...Damn Netatmo |
You need to switch from Username/Password Authentication to Token Authentication and set the scope at http://dev.netatmo.com/ Afterwards this should work:
|
@Dani1802 Hello unfortunately not :( Module=Hauptmodul From where comes the refresh token ? the netatmo file where the login data is stored ? |
You need to generate the refresh token at http://dev.netatmo.com/. |
@Dani1802 I did but unfortunately didn't work
|
can you please try to execute (with you ID / Secret / Token)
Output should be some sting like
|
@Gerudom
I think there's something wrong with your refresh token or token scope |
@Dani1802 |
@Dani1802 ich könnte kotzen mit der Firma Netatmo... Code ist immer noch derselbe bei mir was stimmt nicht oder was fehlt. Bzw. ist es mittlerweile so, dass jeder Export tatsächlich einen neuen Token braucht ? Den generiere ich manuell gerade via diesem dev.netatmo button... das kann ein Script ja nicht wirklich Kannst du mir hier evlt. nochmal helfen ? Danke Meine Funktion aktuell
Auch der Fehler ist ein Altbekannter
|
@Gerudom ponieważ ty nie piszesz po angielsku to ja też pozwolę sobie odpisać w moim natywnym języku. @ALL -- |
Since few days for me the script give "Invalid access token" back, before it works for 11 month (plus/minus) fine. Has Netatmo changed something again or is the token (simply) expired? Or should I create a new complete new "setting" with client-secret and refresh -token? Thx! |
Looks like there is a new OATH method required after May 2024 API update as stated in the recommended project here: https://github.com/NicNull/netatmo-bash |
Danke für den Hinweis! Beim eingeben der erzeugten URL und der darauffolgenden Fehlermeldung/Timeout muss man beachten, das der benötigte Code zur Eingabe in der Shell in der dann angezeigten URL im Browser steht. Der Innensensor wird nun korrekt ausgelesen, Wo kann hier der Fehler liegen? So schaut es bei mir aus: `./netatmo-bash.sh [Mhome] [2024-06-23 13:15:43] Die erzeugte csv-Datei sieht so aus: cat Mhome.csvDate,Indoor Temp,Indoor Humidity,Indoor CO2, Outdoor Temp,Outdoor Humidity, Pressure |
Use the -j filename switch e.g: ./netatmo-bash.sh -q -j data.json -- |
Hi
i got error message "message": "Invalid access token" from 9 May 16:00 CET
before, the script worked without any problems, the user and password were checked via "https://my.netatmo.com/app/station" I can log in without any problems.
I have not made any changes to the system, do you have similar problems?
--
Jacek
The text was updated successfully, but these errors were encountered: