Giter Site home page Giter Site logo

ruuvidriver's Introduction

ruuvidriver


๐Ÿ‘‰ โš ๏ธ This project is no longer under active development as of December 2022.


Serves your Ruuvitag Weather Station data over HTTP.

Tested on Raspberry Pi 3 with Raspbian and Node 9 from Nodesource.

Usage

  • yarn
  • yarn start
  • Visit http://127.0.0.1:52020/tags. Any Ruuvitags in your device's vicinity should start showing up.

โ„น๏ธ You'll get higher resolution data if your Ruuvitag is in Raw mode. You can toggle this by pressing the B button on your tag. See the "RAW mode" section in the Ruuvitag Firmware docs.

Not seeing tags?

If you're running Ruuvidriver as a regular user on Linux, the Node.js binary needs a capability to be allowed to do BLE things.

An easy way to set the CAP_NET_RAW capability required is

sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)

but be certain you understand what this means for other programs using the same Node.js binary.

Endpoints

All tags (/tags)

All tags, as a mapping:

{
  "beefbeefbeef": {
    "dataFormat": 3,
    "rssi": -73,
    "humidity": 21,
    "temperature": 21.72,
    "pressure": 100664,
    "accelerationX": -64,
    "accelerationY": -44,
    "accelerationZ": 1020,
    "battery": 2935,
    "ts": 1521542394667
  }
}

Single tag (/tag/:id (i.e. /tag/beefbeefbeef))

As above, but the given tag's data only.

{
  "dataFormat": 3,
  "rssi": -73,
  "humidity": 21,
  "temperature": 21.72,
  "pressure": 100664,
  "accelerationX": -64,
  "accelerationY": -44,
  "accelerationZ": 1020,
  "battery": 2935,
  "ts": 1521542394667
}

Configuration

Configured via environment variables or a .env file via dotenv.

  • RUUVI_PORT: Port to serve on. Defaults to 52020.

Usage with Home-Assistant

Ruuvidriver is trivial to integrate with home-assistant.

A RESTful sensor configuration for humidity, pressure, temperature and Ruuvitag voltage looks like this.

(Replace beefbeefbeef with your tag's ID, and the IP address/port with something else if your home-assistant is not on the same device as Ruuvidriver, or if you configured the port above.)

- platform: rest
  resource: http://127.0.0.1:52020/tag/beefbeefbeef/
  name: Magic Mystery Room Temperature
  value_template: "{{ value_json.temperature }}"
  unit_of_measurement: "C"
  force_update: true
- platform: rest
  resource: http://127.0.0.1:52020/tag/beefbeefbeef/
  name: Magic Mystery Room Humidity
  value_template: "{{ value_json.humidity }}"
  unit_of_measurement: "%RH"
  force_update: true
- platform: rest
  resource: http://127.0.0.1:52020/tag/beefbeefbeef/
  name: Magic Mystery Room Ruuvi Voltage
  value_template: "{{ value_json.battery }}"
  unit_of_measurement: "mV"
  force_update: true
- platform: rest
  resource: http://127.0.0.1:52020/tag/beefbeefbeef/
  name: Magic Mystery Room Pressure
  value_template: "{{ value_json.pressure }}"
  unit_of_measurement: "kPa"
  force_update: true

ruuvidriver's People

Contributors

akx avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ruuvidriver's Issues

FIX: Issue on packages.json

There is an issue in packages.json file:

{
"name": "ruuvidriver",
"version": "0.1.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "node index.js",
},

Script should be without a following comma.

"start": "node index.js", -->     "start": "node index.js"

Incorrect readings with firmware 2.4.2lt Beta and RAWv2 format

RuuviTag firmware 2.4.2lt Beta and RAWv2 shows incorrect readings:

{
"beefbeefbeef": {
  "dataFormat": 3,
  "rssi": -81,
  "humidity": 5.5,
  "temperature": -122.83,
  "pressure": 78104,
  "accelerationX": -13056,
  "accelerationY": -22527,
  "accelerationZ": -29444,
  "battery": 25768,
  "ts": 1568485996177
},
"vegevegevege": {
  "dataFormat": 3,
  "rssi": -85,
  "humidity": 5.5,
  "temperature": 50.85,
  "pressure": 60441,
  "accelerationX": 7935,
  "accelerationY": -1024,
  "accelerationZ": 15363,
  "battery": 59409,
  "ts": 1568485988683
}
}

The beefbeefbeef humidity should be about 53%, temp 15 degrees and pressure 1014 hPa, and vegevegevege humidity 54%, temp 14 degrees and pressure 1014 hPa.

Docker Option

Since I do not use Hass.IO but I do run HA core in a docker, is it possible to dockerize RuuviDriver so I can continue to keep all my services in dockers? Keeps things isolated and easy to backup/migrate if something were to go wrong too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.