Instantly share code, notes, and snippets.

Embed
What would you like to do?
netatmo dashboard
// requirements for netatmo
const express = require('express');
const netatmo = require('netatmo');
const port = 3000;
app.get('/netatmo-data', (req, res) => {
var auth = {
"client_id": "insert-id-here",
"client_secret": "insert-client-secret-here",
"username": "insert-username-email-here",
"password": "insert-password-here",
};
var api = new netatmo(auth);
api.on("error", (error) => {
// When the "error" event is emitted, this is called
console.error(`Netatmo threw an error: ${error}`);
});
api.on("warning", (error) => {
// When the "warning" event is emitted, this is called
console.log(`Netatmo threw a warning: ${error}`);
});
// Get Stations Data
// See docs: https://dev.netatmo.com/dev/resources/technical/reference/weatherstation/getstationsdata
api.getStationsData((err, devices) => {
res.status(200);
res.type('application/json');
res.send(devices);
});
});
// port
app.listen(port, () => {
console.log(`server is up on port ${port}`);
});
@jlwin

This comment has been minimized.

Owner

jlwin commented Jan 23, 2018

Deploy the Node.JS Code to a Digital Ocean Droplet, install "express" and "netatmo" using npm:

npm install express, netatmo

run the script and access your Droplets IP adress in your browser followed by the port (in this case 3000):
http://your.ip.address:3000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment