MMM-Netatmo icon indicating copy to clipboard operation
MMM-Netatmo copied to clipboard

Module stopped working

Open ihadx opened this issue 2 years ago • 65 comments

I'm pretty sure that Netatmo has finally depricated "Client credentials grant type" in favour of "Authorization code grant type". Go to https://dev.netatmo.com/apidocumentation/oauth and look for 'Client credentials grant type'

Is someone in the community skilled enough to upgrade the existing code?

ihadx avatar May 23 '23 09:05 ihadx

I join the request! ((( I also stopped working the module, after about June 29.... (((

Laz2516 avatar Jul 17 '23 08:07 Laz2516

Will try to setup MM again to fix this. Any more hints for me? Are you willing to test the changes?

CFenner avatar Jul 26 '23 09:07 CFenner

Will try to setup MM again to fix this. Any more hints for me? Are you willing to test the changes?

I'll be glad to test the changes as well. I believe the oauth2 auth code changes are described here: https://dev.netatmo.com/apidocumentation/oauth#authorization-code. I'd suspecting the changes will need to be in "node_helper.js". Standing by.

skyhawk180 avatar Jul 26 '23 13:07 skyhawk180

I am also ready to help if I understand how to get a new authorization (token probably).

Laz2516 avatar Jul 26 '23 15:07 Laz2516

Maybe this will help the developer fix the authorization?.....

https://forum.netatmo.com/viewtopic.php?t=21383

Laz2516 avatar Jul 29 '23 06:07 Laz2516

https://forum.magicmirror.builders/topic/12315/mmm-netatmo-updated/42?page=5

Could help the developer.... How you can get tokens. The module from RaymondMolenaar works after retrieving the authorization data again on the Netatmo website.

Laz2516 avatar Aug 08 '23 09:08 Laz2516

Authorization also stopped working in the RainMachine application. This solution appeared on the user forum. Perhaps this will help a respected developer. I cite links....

"Change: https://github.com/zagy/rainmachine-developer-resources/commit/df1d75b84cf9fb12b3334029c48e5cbf6b8625d0

File: https://raw.githubusercontent.com/zagy/rainmachine-developer-resources/df1d75b84cf9fb12b3334029c48e5cbf6b8625d0/sdk-parsers/RMParserFramework/parsers/personalnetatmo-parser.py (can be uploaded via the rainmachine UI)

It's not very tested, but seems to work for now. "

Laz2516 avatar Aug 09 '23 09:08 Laz2516

Many examples are available on how to implement OAuth2.0 auth code / access token flows. Hopefully someone can implement it here: https://developer.goto.com/guides/Authentication/04_HOW_accessTokenNodeJS/

skyhawk180 avatar Aug 11 '23 14:08 skyhawk180

The token can be obtained from the Netatmo app. Where are the keys. image

Laz2516 avatar Aug 11 '23 14:08 Laz2516

@Laz2516 @skyhawk180 @ihadx Can you check if this works for you?

https://github.com/CFenner/MMM-Netatmo/pull/182

CFenner avatar Aug 14 '23 11:08 CFenner

Of course. I will check now.))

Laz2516 avatar Aug 14 '23 12:08 Laz2516

Unfortunately, it doesn't work. Module icons do not appear on the screen. The inscription "Loading..." is shown. I deleted only my login and password. He left the keys. And added a refresh token. Right? Raspberry overloaded.
Perhaps in the Personal Account-Settings-Partner Applications you need to remove the permission for the old MagicMirror?

" { module: 'netatmo', position: 'top_left', // the location where the module should be displayed header: 'ДОМАШНЯЯ МЕТЕОСТАНЦИЯ', // a header if you like one config: { clientId: '63319aa6d7d9ebХХХХХХХХХ', // your app id clientSecret: 'ХХХХХBeNDqyerfjkZaХХХХХХХХХХХ', // your app secret refresh_token: 'ХХХХХХХХ75368c04c4188c8b52cf|0e864b8ХХХХХХХХХХХХХХ', // username: 'ХХХХХХХХ', // your netatmo username // password: 'ХХХХХХХХХ', // your netatmo password // moduleOrder: ["NAMain", "NAModule4", "NAModule1", "NAModule3", "NAModule2" ], } },

image

Laz2516 avatar Aug 14 '23 12:08 Laz2516

Maybe the syntax of the name refresh token is not correct? Could you add another access token? Do you want to change only the lines in the configuration? Do you need any changes in the module itself?

https://forum.magicmirror.builders/topic/12315/mmm-netatmo-updated/42?page=5

Laz2516 avatar Aug 14 '23 12:08 Laz2516

refresh_token: 'ХХХХХХХХХХХХХХХХХХХХ88c8b52cf|0e864b8f9ХХХХХХХХХХХХХХ', access_token: 'ХХХХХХХХХХХХХХХХХХХХХХcf|d8d36de50b9c7ХХХХХХХХХХХХХХ',

Alas, adding an access token to the configuration did not help. The weather station does not show the data....

Laz2516 avatar Aug 14 '23 12:08 Laz2516

I deleted only my login and password. He left the keys. And added a refresh token. Right?

Did you update the module code from the auth branch?

CFenner avatar Aug 14 '23 13:08 CFenner

No.... (( Can I completely download the module again in the zip file and expand the archive on top of the old module?)

Or tell me how to update your module from SSH?

Laz2516 avatar Aug 14 '23 13:08 Laz2516

I downloaded the archive, uploaded it to raspberries. And replaced all the files that were fresh. But there are no files in the archive helper.js helper.test.js module.js

Laz2516 avatar Aug 14 '23 13:08 Laz2516

Please use this archive https://github.com/CFenner/MMM-Netatmo/archive/refs/heads/auth.zip

CFenner avatar Aug 14 '23 13:08 CFenner

Downloaded your archive from the link. Replaced only new files. After rebooting the raspberry, the MM program itself does not start. I see only a raspberry desktop. Then I wrote completely all the files from your archive on top of the installed module. The same thing, I see only the desktop, MM does not start....

Laz2516 avatar Aug 14 '23 14:08 Laz2516

Returned the old module completely from the copy, MM starts.

Laz2516 avatar Aug 14 '23 14:08 Laz2516

Ok, then I'm need to run the module myself. Sorry for the inconvenience.

CFenner avatar Aug 14 '23 15:08 CFenner

Good. Then I am waiting for your decision. A separate archive with only modified files would be good. To avoid spoiling module settings.

And I would very much like, since you have taken up the module, to be able to display the pressure value in mm Hg.

Laz2516 avatar Aug 14 '23 15:08 Laz2516

I would very much like, since you have taken up the module, to be able to display the pressure value in mm Hg.

Let's fix this first and then I will have a look.

It actually works for me, I just missed to run npm clean-install --production --ignore-scripts as stated in the instructions.

CFenner avatar Aug 14 '23 19:08 CFenner

Good. Then I am waiting for your decision. A separate archive with only modified files would be good. To avoid spoiling module settings.

And I would very much like, since you have taken up the module, to be able to display the pressure value in mm Hg.

As a temporary fix for Pressure in 'in Hg', you can update netatmo.js follows. For mmHg, look for the formula and replace the numbers:

case this.measurement.PRESSURE: return (value.toFixed(0)*0.02953).toFixed(2)// pressure conv to inHg.

skyhawk180 avatar Aug 14 '23 21:08 skyhawk180

-I have tried to merge both my original code and 'auth' branch and while the error goes away, nothing gets loaded on the screen. -I have tried to only copy node helper files to my original main code, and it fails with dependency errors.

  • I tried to overwrite auth.zip on top of my netatmo original code, same issue as above. -I did a clean install of MM and only installed netatmo from latest main branch and its same error as above.

Not sure the code is correctly loaded/committed into git. I see differences in netatmo files between branches and also helper files. I am sure I'm missing something that you have a local copy of. Can you just zip your working copy of netatmo folder (under MM/modules) and provide me and I can see if that runs. If so, we can compare code base with git. I have the latest MM 2.4 and node/npm and all other modules are working if I remove this folder.

skyhawk180 avatar Aug 14 '23 21:08 skyhawk180

So changes are merged to main branch. You need to

  • load the latest code via file (https://github.com/CFenner/MMM-Netatmo/archive/refs/heads/main.zip) or git clone
  • run npm ci --production --ignore-scripts inside the module folder
  • remove username/password and add refresh_token to config

CFenner avatar Aug 14 '23 22:08 CFenner

Good afternoon! Performed your actions. Deleted the module, wrote the contents of the archive to the module folder. Executed a command inside the module folder. MM starts (I have a previous version, not 2.4), but only the clock is loaded from the modules. All other modules in the "Download" state

Laz2516 avatar Aug 15 '23 05:08 Laz2516

Which version could that be?

CFenner avatar Aug 15 '23 05:08 CFenner

Last before 2.4 If you tell me how to find out the version number, I will look more accurately. Unfortunately, I am not a strong specialist in raspberries. I can only repeat according to the written... ((

Laz2516 avatar Aug 15 '23 06:08 Laz2516

If I temporarily rename the netatmo folder, for example, to netatmo1 and restart the raspberry, then MM starts and all modules start.

Laz2516 avatar Aug 15 '23 06:08 Laz2516