Automation: Sending Helper value through Call Service > mqtt

Hi, I have a value stored in a Helper name victron_acpowersetpoint that I edit through the front-end, and when it changes, the value need to be sent through MQTT. I tried the following, which is not working:

alias: Set AcPowerSetpoint
description: ''
  - platform: state
    entity_id: input_select.victron_acpowersetpoint
condition: []
  - service: mqtt.publish
      topic: input_select.victron_acpowersetpoint
      qos: '1'
      payload_template: '{{trigger.payload}},{{ input_select.victron_acpowersetpoint }}'
mode: single

Any advise?

I believe this is what you want:

      payload_template: '{{trigger.to_state.state}}'

It will publish the current state value of input_select.victron_acpowersetpoint.


This is not a particularly nice MQTT topic:


I suggest something in a more traditional MQTT topic format like this:


For more information, see: MQTT Topics Best Practices

Regarding MQTT topics, I typed it wrong, (also in my automation with trying different things) sorry for pointing out, the topic is actually:


And yes, this works!

payload_template: '{{trigger.to_state.state}}'

Thank you.