MQTT Automation not being triggered

I have an MQTT automation defined as below.

alias: test sensor triggering
description: ''
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    payload: 0A720A
  - platform: mqtt
    topic: tele/rf-bridge/RESULT
    payload: 0A720E
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.study_speaker_3
    data:
      media_content_type: audio/mp3
      media_content_id: http://www.mydomain.com/sound1.mp3
mode: single

…but it is not being triggered when the MQTT messages arrive. Here’s an example of an MQTT message which I can see when I monitor the tele/rf-bridge/RESULT topic on the HA developer console:

Message 7 received on tele/rf-bridge/RESULT at 16:38:
{
    "Time": "2021-10-16T16:38:21",
    "RfReceived": {
        "Sync": 14090,
        "Low": 490,
        "High": 1380,
        "Data": "0A720E",
        "RfKey": "None"
    }
}

Any idea why the automation isn’t getting triggered?

Edit: I’ve checked that the automation is turned on, and have tried reloading automations and also restarting the HA server (v 2021.10.3)

Here you define the payload as 0A720A

And then you show the payload actually is :

These 2 don’t match.

You need a value_template to extract the payload the trigger will be matched against.

automation:
  trigger:
    - platform: mqtt
      topic: "tele/rf-bridge/RESULT"
      payload: "0A720A"
      value_template: "{{ value_json.RfReceived.Data}}"
1 Like

Ah…that’s it - Many thanks!