@CFenner normally I would say: Yes, absolutely! But… I’m not a javascript-developer and know very little about it and node.js.
This is the first time I dipped my toe in this world (I’ve been working for 30 years as a C++ developer :grinning_face_with_sweat: ) so I just tried things until I got it working. I have probably done something non-idiomatic or worse, so I think it is better that someone more knowledgable do a proper fix. But I’m happy to answer questions if more info than I already provided is needed.
Btw, a big thank you for your great Netatmo-module @CFenner! :folded_hands:
Read the statement by Michael Teeuw here.
Posts made by tommys
-
RE: MMM-Netatmo does not load
-
RE: MMM-Netatmo does not load
@tommys
Replying to myself since I finally have solved the problem! Netatmo is now loading fine on the latest versions of MM and MMM-Netatmo.
The problem was actually caused by two independent problems: the module reordering algorithm and the sync-fetch library.
The workaround I did to solve the first problem was simply to not set the moduleOrder config property, easy as that.
The second workaround was a bit more involved, I completely removed the usage of the sync-fetch library in netatmo.js in favor of the default async version . That is, simply remove the line: const fetch = require(‘sync-fetch’), make the authenticate, loadData and socketNotificationReceived functions async, handle the promise object returned by fetch appropriately as well as the call to json(). -
MMM-Netatmo does not load
I’m running nodejs v20.8.1 on Ubuntu 22.04 and most MagicMirror modules run fine, except for MMM-Netatmo. It seems to get stuck when fetch-ing the oauth2/token-request, though it receives a response with status 200, but then nothing seems to happen!?
When I manually post the same request using curl from the command line, it works great and I get my access token, which I successfully can use using curl to get my api/getstationdata.
The last thing I’m able to debug into is in the node-fetch’s worker.js file:process.stdin.on('end', function () { const input = JSON.parse(chunks.join('')) const request = shared.deserializeRequest(fetch, ...input) fetch(request) .then(response => response.buffer() .then(buffer => respond([ buffer.toString('base64'), shared.serializeResponse(response) ]))
I can see that shared is updated with at response-header, however, I cannot see the response-body data that is supposed to contain the access-token among other things. And, for me, not being a nodejs/javascript programmer, the app seems to hang with the only thing being shown in the MMM-Netatmo widget is “Loading” forever.
What could be causing my problems?
Of course, I have triple checked that my config settings are correct:
{ module: 'netatmo', position: 'top_center', header: 'Netatmo', config: { clientId: 'xxx', clientSecret: 'yyy', refresh_token: 'zzz', moduleOrder: ["Inomhus","Utomhus"] } }
Regards,
/Tommy