Automation mqtt.publish action not working

When I trigger the following via Developer Tools, Services MQTT.Publish

topic: 'zigbee2mqtt/AlarmKeypad/set'
payload: "{\"arm_mode\":{\"transaction\":99,\"mode\":\"arm_night_zones\"}}"  
qos: 2
retain: true

Then this works just fine

However, I struggle to get this working in an automation

- alias: "Alarm keypad in arm NightMode"
  trigger:
    - platform: state
      entity: alarm_control_panel.huisalarm
      to: "armed_night"
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: 'zigbee2mqtt/AlarmKeypad/set'
      payload: '{\"arm_mode\":{\"transaction\":99,\"mode\":\"arm_night_zones\"}}'
      qos: 2
      retain: true

Configuration check tells me everything is fine, but the log throws this

Logger: homeassistant.config
Source: config.py:416
First occurred: 4:55:29 PM (4 occurrences)
Last logged: 5:06:06 PM
Invalid config for [automation]: [entity] is an invalid option for [automation]. Check: automation-entity. (See ?, line ?).

What am I doing wrong?

entity_id: alarm....

entity: is only used in Lovelace.

1 Like

Ah shoot, I was focusing to much on the mqtt part assuming there was something wrong in there and completely overlooked the obvious.

Thx!

1 Like

Always read the error messages: