Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
netatmo-nodejs-api
Advanced tools
Weekly downloads
Readme
Node.js API wrapper for Netatmo API.
npm install netatmo-nodejs-api
const { NetatmoClient, SCOPE_BASIC_CAMERA } = require('netatmo-nodejs-api')
// you need to set your own information
const clientId = '60...'
const clientSecret = 'abc...'
const username = 'user@domain'
const password = 'pass'
let refreshToken = ''
let accessToken = ''
let expiresInTimestamp = 0
try {
// create client
const client = new NetatmoClient(clientId, clientSecret, SCOPE_BASIC_CAMERA, { timeout: 1000 })
// authenticate
if (!client.checkAndSetAccesToken(accessToken, expiresInTimestamp)) {
if (refreshToken) {
// use previous refresh token
({ accessToken, refreshToken, expiresInTimestamp } = await client.authenticateByRefreshToken(refreshToken))
} else {
// use user credentials
({ accessToken, refreshToken, expiresInTimestamp } = await client.authenticateByClientCredentials(username, password))
}
// you should store accessToken, refreshToken, expiresInTimestamp for further request
}
// get data
const homes = await client.getHomes()
} catch (error) {
console.log(error)
}
You can use the authenticate
method which wrap 3 authentication methods.
const { NetatmoClient, SCOPE_BASIC_CAMERA } = require('netatmo-nodejs-api')
// you need to set your own information
const clientId = '60...'
const clientSecret = 'abc...'
const username = 'user@domain'
const password = 'pass'
let refreshToken = ''
let accessToken = ''
let expiresInTimestamp = 0
try {
// create client
const client = new NetatmoClient(clientId, clientSecret, SCOPE_BASIC_CAMERA, { timeout: 1000 })
// authenticate
({ accessToken, refreshToken, expiresInTimestamp } = await client.authenticate(accessToken, refreshToken, expiresInTimestamp, username, password))
// you should store accessToken, refreshToken, expiresInTimestamp for further request
// get data
const homes = await client.getHomes()
} catch (error) {
console.log(error)
}
netatmo-nodejs-api is maintained under the semantic versioning guidelines.
See the releases on this repository for changelog.
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details
FAQs
Node.js API wrapper for Netatmo API.
The npm package netatmo-nodejs-api receives a total of 5 weekly downloads. As such, netatmo-nodejs-api popularity was classified as not popular.
We found that netatmo-nodejs-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.