Automation trigger via mqtt

Tags: #<Tag:0x00007f77f9467a80>

Hello guys, need a help to create some automation with a mqtt trigger…
Have this zigbee remote control https://www.zigbee2mqtt.io/devices/MLI-404011.html integrated correctly via zigbee2mqtt, when i press a button, in the log have many values like this:

MQTT publish: topic 'zigbee2mqtt/0x00158d00038eccbc', payload '{"linkquality":65,"action":"color_temp","action_color_temperature":370,"transition_time":10}'

Now, this is the automation example https://www.zigbee2mqtt.io/integration/home_assistant.html#via-mqtt in the zigbee2mqtt docks:

automation:
  - alias: Respond to button clicks
    trigger:
      platform: mqtt
      topic: 'zigbee2mqtt/<FRIENDLY_NAME'
    condition:
      condition: template
      value_template: '{{ "single" == trigger.payload_json.click }}'
    action:
      entity_id: light.bedroom
      service: light.toggle

And this is my automation:

- alias: 'Prova'
  trigger:
  - platform: mqtt
    topic: "zigbee2mqtt/0x00158d00038eccbc"
  condition:
  - condition: template
    value_template: '{{ "370" == trigger.payload_json.action_color_temperature }}'
  action:
  - service: light.turn_on
    entity_id: light.led_tv

but dont work, someone can help me? thanks

Try

value_template: '{{ trigger.payload_json.action_color_temperature | int == 370 }}'
1 Like

Big LIKE. Now is OK :wink:

1 Like