-
Notifications
You must be signed in to change notification settings - Fork 0
RTL433
Install rtl_433
sudo su -
cd /usr/local/src
git clone https://github.com/merbanan/rtl_433
cd rtl_433/build
cmake ..
make
make install
Making rtl_433 autorun and output to mqtt.
create /usr/local/bin/rtl433-to-mqtt.sh hint: sudo nano
#!/bin/bash
rtl_433 -C si -F "mqtt://localhost:1883,events=rtl_433[/model][/id] -M newmodel"
make it executable
sudo chmod +x /usr/local/bin/rtl433.sh
Install supervisor to autolaunch and relaunch.
sudo apt install supervisor
sudo nano /etc/supervisor/supervisord.conf
Append the following at the end:
[program:rtl_433]
command=/usr/local/bin/rtl433-to-mqtt.sh
autostart=true
autorestart=true
stderr_logfile=/var/log/long.err.log
stdout_logfile=/var/log/long.out.log
Restart supervisor and check to see if rtl_433 is running:
sudo systemctl restart supervisor
ps -Aef | grep rtl
If it is not running check the syslog for any error messages: tail -n 100 /var/log/syslog.
If you have a username/password you need to specify for mqtt the syntax looks like this for the rtl433-to-mqtt.sh file:
rtl_433 -q -F 'mqtt://BROKER_IP_ADDRESS:1883,user=USERNAME,pass=PASSWORD,retain=1,events=HomeAssistant/rtlsdr/event[/id],states=HomeAssistant/rtlsdr/state[/id]' -M newmodel
Note: This style of publishing to mqtt using rtl_433's internal mqtt publish method vs. a pipe to mosqitto_pub has a known delay.
Check out robertmarkoski home assistant post.