Skip to content

About

nodejs datalogger writing data to influx, capable of running on raspberry pi

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

RaspLogger

RaspLogger is a collection of datalogger modules that capture data and store them in an influxdb database

modules

  • destiny - clan details
  • fitbit - collect health data from fitbit api
  • lights - collect smart lighting info from philips hue
  • parking - collect parking data from amsterdam parking api
  • pv - collect solarpanel data from pvoutput.org
  • router - collect router data from fritzbox
  • temperature - collect outside temperature from a particle photon arduino sensor
  • thermostat - collect temperature data from tado smart thermostat

getting started

create an environment file and fill it with the required variables per module by copying the example file:

cp .env.dist .env

ensure an influxdb server is running

docker run -d -p 8086:8086 -v ~/influxdb/data:/var/lib/influxdb/data --restart always --name influxdb influxdb

run rasplogger through docker

docker run -it --rm --name rasplogger -v "$PWD":/usr/src/app -w /usr/src/app --restart always node:13-buster node rasplogger.js once destiny -u http://influxdb:8086/destiny

usage

Usage: rasplogger [options] [command]

Options:
  -V, --version              output the version number
  -u, --url <url>            influx database url
  -h, --help                 display help for command

Commands:
  once <module>              run rasplogger once for a specific module
  cron <module> <frequency>  run rasplogger using cron for a specific module with a specific cron frequency string
  all                        run all rasplogger modules concurrently with predefined cron values
  help [command]             display help for command

examples

log destiny data once

node rasplogger.js once parking -u http://localhost:8086/parking

log parking data every second

node rasplogger.js cron parking "* * * * * *" -u http://localhost:8086/parking

log pvdata every 5 minutes

node rasplogger.js cron pv "*/5 * * * *" -u http://localhost:8086/pv

log router data every 30 minutes

node rasplogger.js cron parking "*/30 * * * *" -u http://localhost:8086/parking

grafana dashboards

you can use the following grafana dashboard exports to visualise the data collected by rasplogger

pv dashboard PV Output dashboard json export for Grafana 6.7.3

releasing

pushing a version tag (e.g. 2.0.6, matching the version in package.json) triggers .github/workflows/release.yml, which builds a multi-arch (amd64 + arm64) image from Dockerfile-amd64 and pushes it as ghcr.io/peterpeerdeman/rasplogger:<tag> and peterpeerdeman/rasplogger:<tag> on Docker Hub (plus :latest on both). Requires the DOCKERHUB_USERNAME and DOCKERHUB_TOKEN repo secrets; GHCR uses the built-in GITHUB_TOKEN.

use npm version to bump package.json/package-lock.json, commit, and tag in one step (the repo's .npmrc drops the default v prefix so the tag matches the plain-number scheme above):

npm version patch   # or minor / major
git push origin master
git push origin <the new version, e.g. 2.0.7>

To build a cross-platform image locally instead:

docker buildx build -t peterpeerdeman/rasplogger:2.0.6 --platform linux/amd64,linux/arm64 --push -f Dockerfile-amd64 .

About

nodejs datalogger writing data to influx, capable of running on raspberry pi

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages