Skip to content

Instantly share code, notes, and snippets.

@FauxFaux
Created October 6, 2022 09:09
Show Gist options
  • Save FauxFaux/6425b155f483fa36853ab69310549084 to your computer and use it in GitHub Desktop.
Save FauxFaux/6425b155f483fa36853ab69310549084 to your computer and use it in GitHub Desktop.
Digoo temperature network

What's going on?

Some sensors collect data, transmit it to a radio, which is picked up by a reciever machine, which writes it into some storage for display.

Sensors

The sensors are called "Digoo DG-R8H R8H 433MHz Wireless Digital Hygrometer Thermometer Weather Station Outdoor Sensor for TH11300 TH8380 TH1981".

For these, I paid $3.82/item delivered in 2019. The price appears to have doubled in 2022.

They take 2xAAA batteries, and transmit a rtl_433 compatible signal. It identifies them as Nexus-TH. Each devicce has a one-byte(?) device ID, and a 3-way "channel" switch. All of my eight devices have different device ids, which is reasonably likely for <<20 devices, so I can ignore the channels.

Radio

Radio reception is with a rtl-sdr (RTL2832U), I use a NooElec NESDR SMArt to allow me to play with antenna, but it is completly unnecessary for this application.

These cost around $48 (2022) with an antenna. You may also want a good-quality (grounded) USB extension cable if you want to locate the radio slightly away from the recieving device.

Reciever

rtl_433 is run on an Ubuntu "nl40" microserver which runs 24/7.

It is configured to write mqtt to a local mosquitto server:

/usr/local/bin/rtl_433 -F mqtt:,devices,retain=1

See the systemd unit below for the full config.

Remainder of the stack

This mqtt can then be consumed by home-assistant, to drive automation and alerting, or can be fed into telegraf/influx/grafana for a nicer storage and graphing experience, like in the neohub-mqtt docs.

See below for an example telegraf config.

# /etc/systemd/system/rtl-433.service
[Unit]
Description=rtl-433
[Install]
WantedBy=multi-user.target
[Service]
DynamicUser=yes
Group=plugdev
ExecStart=/usr/local/bin/rtl_433 -F mqtt:,devices,retain=1
Restart=on-failure
RestartSec=10s
#[Hardening]
ProtectSystem=strict
ProtectHome=yes
ProtectKernelTunables=true
ProtectControlGroups=true
ProtectKernelModules=true
#PrivateDevices=true
NoNewPrivileges=true
CapabilityBoundingSet=
[[inputs.mqtt_consumer]]
servers = ["tcp://127.0.0.1:1883"]
topics = ["rtl_433/urika/devices/Nexus-TH/+/+/battery_ok","rtl_433/urika/devices/Nexus-TH/+/+/temperature_C","rtl_433/urika/devices/Nexus-TH/+/+/humidity"]
name_override = "nexus"
topic_tag = ""
data_format = "value"
data_type = "float"
[[inputs.mqtt_consumer.topic_parsing]]
topic = "rtl_433/urika/devices/Nexus-TH/+/+/+"
tags = "_/antenna/_/_/channel/device_id/kind"
[[processors.pivot]]
tag_key = "kind"
value_key = "value"
[[processors.enum]]
[[processors.enum.mapping]]
tag = "device_id"
dest = "room"
[processors.enum.mapping.value_mappings]
69 = "kitchen"
13 = "lounge"
37 = "bedroom"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment