Radio weather station in Home Assistant
Context
I bought a weather station broadcasting in 868 MHz and connect it to Home Assistant. The purpose is to improve my crops watering. From the precipation, the vegetable kind and the location, the right amount for the best growth should be computable.
- Bresser ClimateScout weather station 7-in-1 (discontinued)
- RTL-SDR Blog V4 website
From radio to MQTT
After setting the weather station and connecting the RTL-SDR v4 radio receiver, a
specific version of rtl-sdr driver need to be install for v4
git. On ArchLinux, the
rtl-sdr-blog-git
and rtl_433-git
can be use
aur. rtl_433
command
use rtl-sdr driver and broadcast the sensor data on MQTT, it can be configure
with ~/.config/rtl_433/rtl_433.conf
file.
gain 0
frequency 868.30M
hop_interval 600
ppm_error 0
sample_rate 250k
protocol 173 # Bresser Weather Center 7-in-1
output mqtt=mqtt://ADDRESS:PORT,retain=1,devices=CHANNEL
Change ADDRESS
(localhost), PORT
(1883) and CHANNEL
(rtl_433/bresser71).
A user systemd service can be created in ~/.config/systemd/user/rtl_433.service
.
[Unit]
Description=rtl_433 for bresser 7 in 1
After=MQTT.service
[Service]
Type=simple
StandardOutput=journal
ExecStart=rtl_433
[Install]
WantedBy=default.target
Change MQTT
with the service name of the MQTT broker.
From MQTT to Home Assistant
In this case, Home Assistant MQTT client will not detect the output of
rtl_433
. Manual configuration is need and can be done in configuration.yaml
of Home Assistant. Creating new sensor
and binary_sensor
in mqtt
.
mqtt:
sensor:
- name: Bresser71 Temperature
state_topic: rtl_433/bresser71/temperature_C
unique_id: bresser71_temperature_C
value_template: "{{ value | float }}"
unit_of_measurement: "°C"
device_class: temperature
- name: Bresser71 Humidity
state_topic: rtl_433/bresser71/humidity
unique_id: bresser71_humidity
value_template: "{{ value | int }}"
unit_of_measurement: "%"
device_class: humidity
- name: Bresser71 Wind Gust
state_topic: rtl_433/bresser71/wind_max_m_s
unique_id: bresser71_wind_max_m_s
value_template: "{{ value | float }}"
unit_of_measurement: "m/s"
icon: mdi:weather-windy
- name: Bresser71 Wind Speed
state_topic: rtl_433/bresser71/wind_avg_m_s
unique_id: bresser71_wind_avg_m_s
value_template: "{{ value | float }}"
unit_of_measurement: "m/s"
icon: mdi:weather-windy
- name: Bresser71 Wind Direction Unadjusted
state_topic: rtl_433/bresser71/wind_dir_deg
unique_id: bresser71_wind_dir_deg_unadj
value_template: "{{ value | int }}"
unit_of_measurement: "°"
icon: mdi:compass-rose
- name: Bresser71 Rain
state_topic: rtl_433/bresser71/rain_mm
unique_id: bresser71_rain_mm
value_template: "{{ value | float }}"
unit_of_measurement: "mm"
icon: mdi:weather-rainy
- name: Bresser71 Time
state_topic: rtl_433/bresser71/time
unique_id: bresser71_time
icon: mdi:clock-outline
- name: Bresser71 UV
state_topic: rtl_433/bresser71/uv
unique_id: bresser71_uv
value_template: "{{ value | int }}"
icon: mdi:white-balance-sunny
- name: Bresser71 Light
state_topic: rtl_433/bresser71/light_lux
unique_id: bresser71_light_lux
value_template: "{{ value | int }}"
unit_of_measurement: "lux"
icon: mdi:lightbulb-outline
binary_sensor:
- name: Bresser71 Battery
state_topic: rtl_433/bresser71/battery_ok
unique_id: bresser71_battery_ok
payload_on: "0"
payload_off: "1"
device_class: battery