Automation Editor - MQTT publish

Hi,

I’m trying to create an automation which performs an MQTT publish of a sensor value.

I can’t figure out the formating for the Service data field in the Automation Editor.

I’ve tried:
topic: Outside/Temperature
payload_template: {{ states(‘sensor.outside_0’) }}

The editor replaces this with:
payload_template:
‘[object Object]’: null

Can anyone help?

Put your template with quotes. Just try a mqtt.publish myself.

image

Generates :

  - data:
      payload_template: '{{ states(''switch.waterkraan'') }}'
      topic: sensor/waterkraan

Works great!
Thanks.