node-iotsensortag
v1.0.0
Published
Read data from IoTSensor using BLE Advertising
Readme
node-iotsensortag
Node.js module for reading data from a Ruuvitag and IoTSensor .
Tested on Raspberry Pi 3. Depends on noble. See instructions on how to enable BLE on RasPi and how to run without root.
Installation
npm install node-iotsensortagUsage example
const iotsensor = require('node-iotsensortag');
iotsensor.on('found', iotsensortag => {
console.log('Found IoTSenorTag, id: ' + iotsensortag.id);
iotsensortag.on('updated', data => {
console.log('Got data from IoTSenorTag ' + iotsensortag.id + ':\n' +
JSON.stringify(data, null, '\t'));
});
});
Events
Module iotsensor emits a found event, when a new iotsensortag
is discovered. Event's payload is a iotsensortag object (see below)
API
iotsensor.findTags()
Finds available iotsensortag. Returns a promise which is resolved with an
array of iotsensortag objects or rejected with an error if no tags were
found.
If you call findTags multiple times, it always returns all
found RuuviTags this far.
iotsensortag object
Is an eventEmitter .
Properties:
id: id of beaconaddress: address of beaconaddressType: addressType of addressconnectable: flag if beacon is connectable
Events:
updated: emitted when weather station data is received.
Object data has
following properties (depending on data format):
url-- original broadcasted url if anytemperaturepressurehumidityeddystoneId-- in data format 4rssibattery(battery voltage)accelerationXaccelerationYaccelerationZtxPower-- in data format 5movementCounter-- in data format 5measurementSequenceNumber-- in data format 5sequence-- in data format 2HRate-- in data format 2SpO2-- in data format 2
See data formats for info about iotsensortag sensor values.
