Now that we’ve defeated QNAP’s slightly broken udev, we can run a Docker container with rtl_433 in it to wire up our Vevor 7in1 weather station to Home Assistant via MQTT. First off, we need a Docker container running rtl_433, which assumes you’ve already setup the udev rule mentioned in the previous post, even if you’re not using a QNAP!
I like to write little shell scripts to run Docker containers. In this case this one:
#!/bin/bash
docker rm -f vevor_weather || true
device=$(readlink -f /dev/rtl433)
docker run --restart always -d \
--name vevor_weather \
--device ${device} \
hertzg/rtl433:master-debian -f 868M -Y classic -R 263 \
-F json -Fmqtt://mqttserver,retain=0,events=rtl_433[/model][/id]
What this script does is remove any previous version of the container that might be running. It then uses our reliable symlink from the previous post to lookup the real device file. That real device file is then passed through to the Docker container. I am not entirely sure of the subtleties here, but rtl_433 refused to use the device if I passed it through as the symlink, and Docker doesn’t appear to be able to remap device files like it does for ports or mounts. Regardless, this worked at least.
The finally, we have the correct command line for rtl_433 for this weather station. Note that “mqttserver” is probably not the name of your MQTT server. This command line names the MQTT topic for the model and ID of the weather station, so if you had more than one of these you’d get separate topics for them. My weather station appears at “rtl_433/Vevor-7in1/48399” for example.
In terms of completeness, the logs from rtl_433 look like this (reformatted to not be ugly, its all a single line in the actual user interface):
{
"time": "2024-12-25 05:03:16",
"model": "Vevor-7in1",
"id": 48399,
"channel": 0,
"battery_ok": 1,
"temperature_C": 34.4,
"humidity": 24,
"wind_avg_km_h": 4.5,
"wind_max_km_h": 9.333,
"wind_dir_deg": 9,
"rain_mm": 7.689,
"uv": 6,
"light_lux": 91780,
"mic": "CHECKSUM"
}
And the MQTT writes match this format as well.
Finally, we just need to write it up to Home Assistant. I am going to assume you already have MQTT configured, and wont talk about that bit. However, I have these in my configuration.yaml file:
mqtt:
- sensor: !include mqtt/sensors.yaml
- binary_sensor: !include mqtt/binary_sensors.yaml
Which is including mqtt/sensors.yaml:
- name: "Weather station temperature"
force_update: true
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.temperature_C }}"
unit_of_measurement: "°C"
- name: "Weather station humidity"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.humidity }}"
unit_of_measurement: "%"
- name: "Weather station wind average"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.wind_avg_km_h }}"
unit_of_measurement: "km/h"
- name: "Weather station wind maximum"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.wind_max_km_h }}"
unit_of_measurement: "km/h"
- name: "Weather station wind direction"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.wind_dir_deg }}"
unit_of_measurement: "degrees"
- name: "Weather station rain"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.rain_mm }}"
unit_of_measurement: "mm"
- name: "Weather station UV"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.uv }}"
- name: "Weather station light"
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.light_lux }}"
unit_of_measurement: "lux"
And mqtt/binary_sensors.yaml:
- name: "Weather station battery ok"
force_update: true
payload_on: 1
payload_off: 0
state_topic: "rtl_433/Vevor-7in1/48399"
value_template: "{{ value_json.battery_ok }}"
I hope this saves someone, possibly future me, so time setting this up. It took me a few hours to get this all working today.