- platform: mqtt
name: "test"
state_topic: "home/OpenMQTTGateway/433toMQTT"
value_template: >-
{% if value_json.value == '7821834' %}
{{'ON'}}
{% elif value_json.value == '7821838' %}
{{'OFF'}}
{% else %}
{{states('binary_sensor.test') | upper}}
{% endif %}
qos: 0
device_class: opening
See the following post for more information. It discusses two strategies for receiving data from a Sonoff RF Bridge but it is applicable to any RF receiver that uses just one MQTT topic to publish data received from multiple devices.