Automation based on part of MQTT payload

Hi,

I have a Sonoff RF Bridge and a couple of simple RF devices. Could somebody help a beginner with creating automations based on the “Data:xxx” part of the payload? Preferably in the visual editor.

I created the automation for the topic, I’m just failing to figure out how to filter based on the different payloads.

Many thanks

Post the automation you created (in YAML format).

If your automation is using an MQTT Trigger, then in all likelihood, you will need to use a template like this:

{{ trigger.payload_json.RfReceived.Data }}

Hi Taras,

I don’t really have an automation yet. I have a simple sonoff RF door sensor, it sends the following when opened:

MQT: tele/tasmota_01E1D2/RESULT = {“Time”:“2023-03-13T12:18:02”,“RfReceived”:{“Sync”:8000,“Low”:200,“High”:710,“Data”:“EAC701”,“RfKey”:“None”}}

I would like to use this as trigger for automations. “IF message containing “EAC701” received, THEN do x”

I hoped that it would be possible to use wildcards in the payload field like EAC701 but that doesn’t seem to work.

Many thanks

  trigger:
    - platform: mqtt
      topic: "tele/tasmota_01E1D2/RESULT"
      payload: "EAC701"
      value_template: "{{ value_json.RfReceived.Data }}"

Reference: MQTT Trigger

1 Like

Thanks it’s working!

It’s a pity that it can’t be done in the visual editor.

1 Like