5.1.0 • Published 2 months ago

node-ruuvitag v5.1.0

Weekly downloads
74
License
BSD-3
Repository
github
Last release
2 months ago

node-ruuvitag

Node.js module for reading data from a Ruuvitag weather station.

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-ruuvitag

Usage example

const ruuvi = require('node-ruuvitag');

ruuvi.on('found', tag => {
  console.log('Found RuuviTag, id: ' + tag.id);
  tag.on('updated', data => {
    console.log('Got data from RuuviTag ' + tag.id + ':\n' +
      JSON.stringify(data, null, '\t'));
  });
});

ruuvi.on('warning', message => {
  console.error(new Error(message));
});

Events

found

Module ruuvi emits a found event, when a new RuuviTag is discovered. Event's payload is a ruuviTag object (see below)

warning

Module relays noble's warning events (see below)

API

ruuvi.findTags()

Finds available ruuvitags. Returns a promise which is resolved with an array of ruuviTag 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.

ruuviTag object

Is an eventEmitter .

Properties:

  • id: id of beacon
  • address: address of beacon
  • addressType: addressType of address
  • connectable: 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 any
  • temperature
  • pressure
  • humidity
  • eddystoneId -- in data format 4
  • rssi
  • battery (battery voltage)
  • accelerationX
  • accelerationY
  • accelerationZ
  • txPower -- in data format 5
  • movementCounter -- in data format 5
  • measurementSequenceNumber -- in data format 5
  • mac -- in data format 5

See data formats for info about RuuviTag sensor values.

5.1.0

2 months ago

5.0.0

10 months ago

4.7.0

2 years ago

4.6.1

4 years ago

4.6.0

4 years ago

4.5.1

4 years ago

4.5.0

4 years ago

4.4.1

4 years ago

4.4.0

4 years ago

4.3.0

4 years ago

4.2.2

4 years ago

4.2.1

5 years ago

4.2.0

5 years ago

4.1.0

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.2.0

7 years ago

3.0.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago