RFSniffer, 433MHz receiver RPI and MQTT

So i don’t know your setting and rule but ussually the item receiving the command do not change mutliple times. Use a rule which reacts on changed this wil prevent the rule to trigger multiple times.

So when you have a item which collects teh RF data use a rule that distributes the recieved commands to different sensor items your problem should not occur.

String MQTT_data "MQTT stest says: [%s]" {mqtt="<[mymosquitto:433MHz:state:default]"}
Group RfSensors
String MQTT_sensor_1 (RfSensors)
String MQTT_sensor_2 (RfSensors)
String MQTT_sensor_3 (RfSensors)
rule "433MHz rx"
  when
    Item MQTT_data changed
 then
    switch MQTT_data.state {
      case "1328465": MQTT_sensor_1.postUpdate(ON)
      case "1328468": MQTT_sensor_2.postUpdate(ON)
      case "1328491": MQTT_sensor_3.postUpdate(ON)
    }
    // This makes the item MQTT_data change again when the same command is recieved.
    if(MQTT_data.state.toString !="") MQTT_data.postUpdate("")
end
rule "Email Notification"
  when
    Member of RfSensors changed
    // This rule trigger works only since openhab 2.3.0 Build #1212.
    // But you can use multiple trigger for know untill you update
    // Item MQTT_sensor_1 changed or 
    // Item MQTT_sensor_2 changed or
    // Item MQTT_sensor_3 changed
 then
   // Trigger your email
    logInfo("RuleExamples", "The item " + triggeringItem.name +  " changed state from " 
                            + previousState +  " to " + triggeringItem.state)
end

If you only have one sensor and receive the data to one item in this case MQTT_data then there should be no multiple changes on your item.

But you could also post different Topics from the c code dependend from the received code.

1 Like