draychev / phidgets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Measure Humidity and Temperature of your home with Phidgets and Prometheus

Here is how to build a Prometheus Dashboard showing the temperature and humidity in your home. This projcet leverages Phidgets (single-board computer + sensors) and another computer running Debian.

Hardware

  1. Phidgets Humidity/Temperature Sensor - the sensor that will measure temperature and humidity
  2. PhidgetSBC4 - an armhf Debian Bullseye running on a tiny Allwinner A20 Dual-Core ARM Cortex-A7

Python packages

  • flask
  • prometheus_client
  • Phidget22

Run

The prom.py file stitches the Promethous gauge and the Phidgets libraries. This exposes a /metrics endpoint from where a Prometheus server can scrape metrics.

Prometheus

Prometheus is a free software application used for event monitoring and alerting. Install it on a server (more powerful than the Phidgets SBC), which is on the same network (tailscale) as your Phidgets SBC. This machine will be performing periodic HTTP GET calls to the Phidgets SBC box.

  1. Install Prometheus
  2. Configure it:
$ cat /etc/prometheus/prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s
scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets:
        - 1.2.3.4:5000
  1. Connect to the Prometheus server: http://your-prometheus-server:9090/
  2. Query for Humidity and Temperature
  • Show a graph of humidity_gauge{location="SJC"} prom-humidity
  • Show a graph of temp_gauge{location="SJC"} prom-temperature

About


Languages

Language:Python 90.1%Language:Shell 8.6%Language:Makefile 1.3%