Code Monkey home page Code Monkey logo

node-red-contrib-netatmo-dashboard's Introduction

Home of RedBot and LetsForm.

node-red-contrib-netatmo-dashboard's People

Contributors

cflurin avatar guidone avatar solick avatar tedhuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-red-contrib-netatmo-dashboard's Issues

Refreshing tokens, Access Token and Refresh Token

Starting from the 17/04/2023 Netatmo switched to refreshing tokens.
When refreshing tokens, Access Token and Refresh Token will be automatically renewed and former tokens invalidated.
I understand, that in particular the "refresh token", which is to be provided as input data in the netatmo-config-node is now dynamic and will be refreshed.
Hence, I can no longer retrieve any data in node red from my Netatmo devices.
Is there any possibility to adjust the app to these dynamic refresh tokens?

netatmo dashboard node -how to get refresh token

I am using netatmo dashboard node since a few years. Today I updated the node and now I am unable to connect due to a missing refresh token.
What do I have to do in order to get one?
I have a client id and a client secret.
What has to be put in App name?

Since 2023/12/04: Unable to refresh the access token

Since today I've alway get the following error:
[netatmo-dashboard:b9345e53.83ab5] Unable to refresh the access token

When I generate a new refresh token, enter it in node-red, one request works. From the second call, again the error above.
Something changed by netatmo?

API change - OAuth2 authorization from October possible?

Hello,

Happy user here of your excellent node.
Your re probably already aware of this, but we just got an email from Netamo that they
are changing the security of their API and it will no longer be possible to authenticate with
just username and password. This will happen in October. Quote from email below.
Would you be so kind as to comment on whether you will update your node to support
OAuth2 authorization instead?

Many thanks!

Netatmo API Security Update

Dear Netatmo developer,

To improve the security of our products, we inform you that the Client Credentials grant type method will be completely removed. It will no longer be possible to authenticate with the username and password of the user.

The effective date of this update is October 2022.

How can you authenticate with Netatmo API ?
From this date, the OAuth2 authorization code flow must be followed for authentication.

You can find details on this method on our website:

Netatmo Connect | Authentication
For tests, you can also get an Access Token from our developper portal.

Netatmo Developer Portal
Log in
Go on your account
Select the application for your test
Click on "Generate a Token"

netatmo.handleRequestError

Hi,

I've got this error:

20 Jan 17:12:04 - [red] Uncaught Exception:
20 Jan 17:12:04 - Error: Authenticate error: Status code502
at netatmo.handleRequestError (/home/pi/.node-red/node_modules/netatmo/netatmo.js:46:15)
at .<anonymous> (/home/pi/.node-red/node_modules/netatmo/netatmo.js:115:19)
at Request.self.callback (/home/pi/.node-red/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/home/pi/.node-red/node_modules/request/request.js:1081:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/home/pi/.node-red/node_modules/request/request.js:1001:12)
at IncomingMessage.g (events.js:286:16)
nodered.service: main process exited, code=exited, status=1/FAILURE
Unit nodered.service entered failed state.
nodered.service holdoff time over, scheduling restart.
Stopping Node-RED graphical event wiring tool....
Starting Node-RED graphical event wiring tool....
Started Node-RED graphical event wiring tool..
20 Jan 17:12:10 - [info]
Welcome to Node-RED
===================
20 Jan 17:12:10 - [info] Node-RED version: v0.16.1
20 Jan 17:12:10 - [info] Node.js  version: v6.3.1
20 Jan 17:12:10 - [info] Linux 4.4.13-v7+ arm LE

is there way to catch this exception (error)?

error when install the node

Node red shows an error if i try to install the node by "palette verwalten" or import. Any idea what could be a reason for that?

Error: "Unable to refresh the access token"

Hi,

today Netatmo disabled the old auth method.
Since this moment I am getting the following error: "Unable to refresh the access token":

image

If I manually generate a fresh token it is working only one time to connect.
Any ideas how to solve this?

Thanks!

Undefined values, pressure

Lately Pressure is not returned and I get:

pressure: undefined
pressureTrend: undefined

When I query the API directly everything seems to be OK.

Example flow please?

Trying to get going with this and our netatmo weather station.
Is there an example flow with how to use functions or nodes that can split out data for the node red ui dashboard?
Grateful for any hints. Many thanks

Camera gets "Error: Authenticate 'username' not set."

I have just replace my old node with this one because of the new Autth-Methode. The Node-Dashbord works relay great but the node-camera gets an error: "Error: Authenticate 'username' not set."
In the config there is no extra field for the username. I have grand read access to all modules in the netatmo app.
What is to do?
Thanks, Alex

Node Red crashes

Hi, i am a Basic user with not that much know how. Since the change to OAuth2 i have problems with node red, it crashes several times a day. After restart everything works Fine again until the next exit.

are there some tips and tricks to avoid that?

Would be great if someone can help me.

greets Jan

Here the log:

Feb 19 09:52:00 homematic-raspi daemon.err node-red: 19 Feb 09:52:00 - [red] Uncaught Exception:
Feb 19 09:52:00 homematic-raspi daemon.err node-red: 19 Feb 09:52:00 - ReferenceError: callback is not defined
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at ClientRequest. (/usr/local/addons/redmatic/var/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:46:9)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at ClientRequest.emit (events.js:315:20)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at TLSSocket.socketErrorListener (_http_client.js:469:9)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at TLSSocket.emit (events.js:315:20)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at emitErrorNT (internal/streams/destroy.js:106:8)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at emitErrorCloseNT (internal/streams/destroy.js:74:3)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: at processTicksAndRejections (internal/process/task_queues.js:80:21)
Feb 19 09:52:00 homematic-raspi daemon.err node-red: Node-RED exited with non-zero exit status 1

[error] ReferenceError: callback is not defined | [red] Uncaught Exception every 24h

Every 24h node-red restarted because of the following error:

15 Dec 04:18:49 - [red] Uncaught Exception: 15 Dec 04:18:49 - [error] ReferenceError: callback is not defined at ClientRequest.<anonymous> (/data/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:46:9) at ClientRequest.emit (events.js:314:20) at TLSSocket.socketErrorListener (_http_client.js:427:9) at TLSSocket.emit (events.js:314:20) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start:node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /data/.npm/_logs/2023-12-15T03_18_49_565Z-debug.log
Starting dbus daemon
Starting Avahi daemon
Starting Node-Red
`
Is there a function missing in netatmo-dashboard.js ?

`const callRefreshToken = ({ clientId, clientSecret, refreshToken }) => {
return new Promise((resolve, reject) => {

const responseEncoding = 'utf8';
const httpOptions = {
  hostname: 'api.netatmo.com',
  port: '443',
  path: '/oauth2/token',
  method: 'POST',
  headers: { "Content-Type": "application/x-www-form-urlencoded" }
};
httpOptions.headers['User-Agent'] = 'node ' + process.version;

const request = httpTransport.request(httpOptions, (res) => {
  let responseBufs = [];
  let responseStr = '';

  res.on('data', (chunk) => {
    if (Buffer.isBuffer(chunk)) {
      responseBufs.push(chunk);
    }
    else {
      responseStr = responseStr + chunk;
    }
  }).on('end', () => {
    responseStr = responseBufs.length > 0 ? Buffer.concat(responseBufs).toString(responseEncoding) : responseStr;
    if (res.statusCode === 200) {
      let json;
      try {
        json = JSON.parse(responseStr);
        resolve(json.access_token);
      } catch (e) {
        reject(e);
      }
    } else {
      reject('Unable to refresh the access token');
    }
  });
})
  .setTimeout(0)
  .on('error', (error) => {
    callback(error);
  });
request.write(`grant_type=refresh_token&refresh_token=${encodeURI(refreshToken)}&client_id=${clientId}&client_secret=${clientSecret}`);
request.end();

});
};
`

High number of queries to api.netatmo.net

I use this node to query weather data once every 15 minutes in a single flow. However, when I look at IP traffic the are queries made to api.netatmo.net more than 6000 times a day. Is this normal?

"ReferenceError: callback is not defined" causes node-red service restart

Hello @guidone ,

since today there are obviously some issues with the connection to dev.netatmo.com and NetAtmo web services as well.

~ $ ping netatmo.com
PING netatmo.com (51.145.143.28) 56(84) bytes of data.
From 51.145.143.28 (51.145.143.28) icmp_seq=1 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=2 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=3 Destination Host Unreachable
From 51.145.143.28 (51.145.143.28) icmp_seq=4 Destination Host Unreachable
^C
--- netatmo.com ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 7ms

It seems any call to the NetAtmo API causes a crash of node-red

21 Jul 09:35:58 - [error] ReferenceError: callback is not defined
    at ClientRequest.<anonymous> (/home/pi/.node-red/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:46:9)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Service RestartSec=20s expired, scheduling restart.
nodered.service: Scheduled restart job, restart counter is at 4

I thought, open an issue ticket may be a good idea, at least for future reference.

Intuis connect with Netatmo

Hi,
I’ve seen somewhere that this node is compatible with Intuis connect with Netatmo. Can you confirm it ?

Anyway I try to configure it but I didn’t succeed.
I am not capable to get the token on the Netatmo website, the informations they ask are not the same as the notice.

Unable to refresh the access token

Hi,

after installing and configuring the plugin all works as expected.
After approx. 24 hrs no data is collected anymore and I am getting the following error: "Unable to refresh the access token".

How can I solve this?

Thanks!

TypeError: Cannot read property 'Temperature' of undefined

I'm getting this a lot at the moment, it brings down Node-Red, so I've had to uninstall the Netatmo modules as node-red controls my house. This is triggered on start-up of node-red.

21 Nov 15:26:22 - [red] Uncaught Exception:
21 Nov 15:26:22 - TypeError: Cannot read property 'Temperature' of undefined
    at /root/.node-red/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:43:82
    at Function._.each._.forEach (/root/.node-red/node_modules/underscore/underscore.js:153:9)
    at _.(anonymous function) [as each] (/root/.node-red/node_modules/underscore/underscore.js:1496:34)
    at /root/.node-red/node_modules/node-red-contrib-netatmo-dashboard/netatmo-dashboard.js:41:25
    at netatmo.<anonymous> (/root/.node-red/node_modules/netatmo/netatmo.js:227:14)
    at Request.self.callback (/root/.node-red/node_modules/request/request.js:186:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/root/.node-red/node_modules/request/request.js:1163:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/root/.node-red/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)

Weather not returned?

First, what's the input on the netatmo-dashboard control do?

Second, looking at the code, it looks like if there's no camera, nothing is ever returned. I don't have a camera, so I can only assume this is the case, as I'm not getting any errors, but neither am I getting any data from the weather station.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.