Single MQTT topic + Demuxing
In my first iteration of this, I had streamed all rtl_433 data to a single topic and used an automation to demultiplex them (aka: split them into their own MQTT topics) before realizing rtl_433 can do this natively. I’ve edited the post, but in case that’s useful for something, here’s how to accomplish the demux step:
With rtl_433 publishing to a single topic: mqtt://your_mqtt_server,retain=0,events=rtl_433/_raw
Create an automation:
- alias: RTL433 MQTT Demuxer
description: Split rtl_433/_raw signals into individual topics
trigger:
- platform: mqtt
topic: rtl_433/_raw
action:
- service: mqtt.publish
data:
payload: '{{trigger.payload}}'
topic: rtl_433/{{trigger.payload_json.model or "UnknownModel"}}/{{trigger.payload_json.id
or "UnknownId"}}{%- if trigger.payload_json.message_type -%}/msg{{trigger.payload_json.message_type}}{%-
endif -%}
mode: single
This takes any published mqtt message and re-publishes it at rtl_433/Model-Name/1234
(where 1234 is its id) – or if it contains message_type
, then rtl_433/Model-Name/1234/msg56
.
(this idea is based on Multi sensor using same MQTT topic - #3 by 123 but generic)
rtl_433 built-in demuxing
For reference, rtl_433 has placeholders when publishing, so it supports doing: mqtt://your_mqtt_server,retain=0,events=rtl_433[/model][/id]
(see more info here).