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: ''
trigger:
  - platform: state
    entity_id: input_select.victron_acpowersetpoint
condition: []
action:
  - service: mqtt.publish
    data:
      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.


NOTE

This is not a particularly nice MQTT topic:

input_select.victron_acpowersetpoint

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

input_select/victron_acpowersetpoint

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:

iotp/Victron_Solar2629/AcPowerSetpoint/set

And yes, this works!

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

Thank you.