Home Faerie is a set of lightweight utilities ([auto]magical faeries) for various home monitoring, data logging and automation tasks.
Because I wanted something simple and lightweight :)
It started with a set of Python scripts running on a Olimex Lime 2:
- zigbee2mqtt data logger to PostgreSQL
- simple utility script to for a zigbee button which then toggles multiple tasmota-controlled lights.
And now Rust - I can just drop a single binary to filesystem and restart the systemd service.
- Zigbee2MQTT sensor data logging to PostgreSQL database
Create database schema:
CREATE TABLE device_meters (
"timestamp" timestamp with time zone,
name text,
value double precision,
dimensions jsonb,
value_meta json
);
CREATE INDEX ON device_meters (name, timestamp);
CREATE INDEX ON device_meters USING GIN (dimensions);And run the application:
$ POSTGRESQL_URL=postgresql:/meters MQTT_URL=zigbee2mqtt-gateway.local MQTT_PORT=1883 cargo run
Panels in Grafana:
SELECT
timestamp as time,
dimensions->>'id' AS device,
value
FROM
device_meters
WHERE
$__timeFilter("timestamp")
AND name = 'temperature'
ORDER BY 1,2