MQTT Rules newbie problem

I am just trying to get started with MQTT using an an RFBridge and followed this video “Sonoff RF Bridge Easy Setup with Tasmota Rules and the trigBoard”.
I set up the water sensor (single trigger) without a problem.
But the open/closed sensor does not work despite the fact the Tasmota console appears to give me back the correct results as below:

00:15:43 MQT: RFBridge/sensor1 = closed (retained)
00:15:50 MQT: tele/RFBridge/RESULT = {“Time”:“1970-01-01T00:15:50”,“RfReceived”:{“Sync”:13900,“Low”:460,“High”:1350,“Data”:“30190A”,“RfKey”:“None”}}
00:15:50 RUL: RFRECEIVED#DATA=30190A performs “publish2 RFBridge/Sensor1 Open”
00:15:50 MQT: RFBridge/Sensor1 = Open (retained)

I input the following into the console to create this:

rule1 on rfreceived#Data=30190A do publish2 RFBridge/Sensor1 Open endon on rfreceived#Data=30190E do publish2 RFBridge/sensor1 closed endon

My YAML entry is this:

- platform: mqtt

  • name: “Freezer Door”*
  • state_topic: “RFBridge/sensor1”*
  • availability_topic: “RFBridge/tele/LWT”*
  • qos: 1*
  • payload_on: “Open”*
  • payload_off: “Closed”*
  • payload_available: “Online”*
  • payload_not_available: “Offline”*
  • device_class: door*

The entity only shows a state of Closed.

Any advice appreciated

Please format your code so that others can examine it for possible syntax errors. Given the way you have posted it (no formatting), it’s difficult to determine if it is structured correctly.

Dont think its a formatting problem, as the other sensor works fine. - but here it is:

  - platform: mqtt
    name: "Freezer Door"
    state_topic: "RFBridge/sensor1"
    availability_topic: "RFBridge/tele/LWT"
    qos: 1
    payload_on: "Open"
    payload_off: "Closed"
    payload_available: "Online"
    payload_not_available: "Offline"
    device_class: door

Please read this topic :

Thanks for response this is appreciated but doesn’t really answer MY question, as I see it, it offers two alternative options. I wanted to avoid the Json based configuration. This is obviously very useful to others though and a route I will certainly try at a later point.

You’re probably right but no one else could be as certain of it because all we had to work with was the unformatted code you had shared.


MQTT topics are case-sensitive. From the log you posted, the topic’s spelling is not identical. In addition, the payload is reported in both lowercase and propercase:

00:15:43 MQT: RFBridge/sensor1 = closed (retained)*

00:15:50 MQT: RFBridge/Sensor1 = Open (retained)*

Your sensor is configured to subscribe to the topic containing a lowercase (sensor1) and the propercase version of the payload:

    state_topic: "RFBridge/sensor1"
    payload_on: "Open"
    payload_off: "Closed"

You’ll need to sort that out.

You are a SUPERSTAR!!! Thanks so much - cant believe I made such a silly mistake i’ve been trying everything for hours.
Much appreciated.

1 Like