I have several 433Mhz remotes that I want to use with HA. So far I got rtl_433 together with mqtt working, when a remote-button is pressed, I got a message in mqtt, but I couldn’t make it working with HA. The mqtt “message” looks like this:
rtl_433/myserver/events = {"time":"2022-12-19 22:29:01","model":"Nexa-Security","id":24451072,"channel":3,"state":"OFF","unit":1,"group":0}
Depending on the remote and the button on the remote, the id, the unit and the state change.
I tried the following in configuration.yaml, it sets the state of the sensor correct but also deletes/clears the state of the other sensor.
sensor:
- state_topic: rtl_433/prox-debian/events
value_template: "{{ value_json.state if ((value_json.unit == 2) and (value_json.id == 24451072)) }}"
name: "Test-left"
- state_topic: rtl_433/prox-debian/events
value_template: "{{ value_json.state if ((value_json.unit == 1) and (value_json.id == 24451072)) }}"
name: "Test-right"
Probably an easy solution, but I couldn’t find it.