Zigbee2mqtt: set payload with helper input_number

To set the current setpoint of a thermostatic radiator valve, mqtt “set” is used with the target setpoint as payload.

Currently a fixed temperature is set, but question is how to set a dynamic value being a helper “input_number”?

Currently the action is:

  • MQTT Publish
  • Topic: zigbee2mqtt/<IEEE address of the device>/set
  • Payload: {"current_heating_setpoint": "20.5"}

As said, this works fine. But how to set something like
{{ input_number.my_temp_setpoint }}

When this is used in the “Payload Template”, the result is an error “value should be string”.
Also this fails:
{"current_heating_setpoint": {{ input_number.my_temp_setpoint | string }} }

Any hints pls?

Don’t know if you’ve already figured this one out, but this is how my YAML for setting dim level on my bathroom lights when a motion is triggered

service: mqtt.publish
data:
  qos: 0
  retain: false
  topic: zigbee2mqtt/bathroom_lights/set
  payload: "{\"brightness\":{{ states('input_number.dim_bathroom') | int }}}"

Hope it helps! :slight_smile:

I didn’t have a solution yet, but this works great. Thank you!

1 Like