Skip to content

BindThings/bindthings-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BindThings Node.js

Official Node.js client for the BindThings IoT Platform.

Installation

npm install bindthings-sdk

Quick Start

const { BindThings } = require('bindthings');

const bt = new BindThings('YOUR_DEVICE_TOKEN');

async function main() {
  await bt.connect();
  await bt.send({ temperature: 25.5, humidity: 60 });
}

main();

API Reference

Constructor

const bt = new BindThings(token, options);

Connect

await bt.connect(); // Returns Promise

Send Telemetry

await bt.send({ temperature: 25.5 });
await bt.send({ temperature: 25.5, humidity: 60, pressure: 1013 });

Send Attributes

await bt.sendAttributes({ firmware: '1.0.0', model: 'ESP32' });

Receive Commands

bt.onCommand((payload) => {
  const data = JSON.parse(payload);
  console.log(data);
});

Status

bt.isConnected(); // Check connection
bt.disconnect();  // Graceful disconnect

Examples

Example Description
basic.js Send temperature and humidity every 15 seconds
sensor.js Multi-sensor with attributes

Connection Details

Parameter Value
Broker mqtts://mqtt.bindthings.io:8883
Username Your Device Token
Password Your Device Token

License

MIT License — © 2025 BindThings

About

Official Node.js client for BindThings IoT Platform — npm install bindthings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors