JavaScript SDK and command-line tool for Bair1 air quality sensor data.
npm install @heysalad/bair1For global CLI use:
npm install -g @heysalad/bair1import { Bair1Client } from "@heysalad/bair1";
const bair1 = new Bair1Client({
apiKey: process.env.BAIR1_API_KEY,
});
const latest = await bair1.latest();
console.log(latest.pm25, latest.aqi);
const devices = await bair1.devices();
console.log(devices);bair1 config set-key "$BAIR1_API_KEY"
bair1 status
bair1 latest
bair1 devices
bair1 export --device YOUR_DEVICE_ID --format csvUse this package when an agent runtime needs direct TypeScript access to Bair1.
Use @heysalad/bair1-mcp when the agent supports MCP and should call tools
instead of importing code.