npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

netatmo-node

v1.0.0

Published

Read a Netatmo Weather Station (indoor CO₂, temperature, humidity, outdoor, rain, wind) through Netatmo's official cloud API — a small, modern, Promise-first TypeScript client with zero runtime dependencies and automatic OAuth2 refresh-token rotation.

Readme

netatmo-node

A small, modern, Promise-first TypeScript client for the Netatmo Weather Station — read indoor CO₂, temperature, humidity, pressure, noise, plus outdoor/rain/wind modules — through Netatmo's official cloud API. Zero runtime dependencies.

Netatmo has no local LAN protocol: the station uploads to Netatmo's cloud and you read it back over HTTPS with an OAuth2 bearer token. This library handles the token lifecycle for you, including the part everyone gets bitten by — Netatmo rotates the refresh token on every refresh, so the old one stops working. netatmo-node hands you the new token via onTokenRefresh; persist it and your auth never silently dies.

Install

npm install netatmo-node

Requires Node 18+ (uses the global fetch).

Getting credentials

  1. Create an app at dev.netatmo.com → note the client id and client secret.
  2. Generate a token with the read_station scope (the dev portal has a token generator), which gives you a refresh token.

Quick start

import { writeFileSync, readFileSync } from 'node:fs'
import { Netatmo, co2Level } from 'netatmo-node'

const n = new Netatmo({
  clientId: process.env.NETATMO_CLIENT_ID!,
  clientSecret: process.env.NETATMO_CLIENT_SECRET!,
  refreshToken: readFileSync('.token', 'utf8').trim(),
  // Persist the rotated refresh token or auth dies on the next boot.
  onTokenRefresh: (t) => writeFileSync('.token', t.refreshToken),
})

for (const m of await n.getCo2Readings())
  console.log(`${m.name}: ${m.co2} ppm (${co2Level(m.co2)})`)
// Office: 1483 ppm (bad)

API

new Netatmo(options)

| Option | Type | Notes | | --- | --- | --- | | clientId | string | from dev.netatmo.com | | clientSecret | string | from dev.netatmo.com | | refreshToken | string | long-lived, rotates on each refresh | | accessToken? | string | optional, skips one refresh on boot | | accessTokenExpiresAt? | number | unix ms; pair with accessToken | | onTokenRefresh? | (t) => void \| Promise | persist t.refreshToken | | timeoutMs? | number | default 15000 | | maxRetries? | number | default 3 (5xx / network / one re-auth) |

Methods

  • getStationsData(deviceId?)Station[] — every station, each with its base unit + modules normalized into ModuleReadings.
  • getCo2Readings()ModuleReading[] — every module that reports CO₂ (the indoor base + indoor add-ons). The one for "is the office stuffy?".
  • findModule(name)ModuleReading | undefined — fuzzy, case-insensitive lookup by module name (e.g. findModule('office')).
  • getMeasure({ deviceId, moduleId?, scale, type, dateBegin?, dateEnd?, limit? }) → time-series rows for graphs/trends.
  • currentRefreshToken — the latest (possibly rotated) refresh token.

co2Level(ppm) helper

| Band | ppm | Meaning | | --- | --- | --- | | good | < 800 | fresh air | | fair | 800–999 | fine | | poor | 1000–1399 | stuffy; ventilate soon | | bad | ≥ 1400 | headaches/drowsiness; open a window now |

CLI

A tiny CLI (scripts/netatmo.mjs) reads creds from .secrets/netatmo.env and persists the rotated refresh token back to that file after every run:

node scripts/netatmo.mjs co2                 # all CO₂ modules + comfort label
node scripts/netatmo.mjs module office       # one module's latest reading
node scripts/netatmo.mjs stations            # everything, JSON
node scripts/netatmo.mjs history office CO2 1hour

License

MIT © Noel Portugal