Hi, I’m trying to send a payload value over MQTT to control a device. This works absolutely fine if I simply specify an integer for the payload (e.g. payload: 8), but if I try and supply that integer via json so I can take the value from a sensor and manipulate it, it does not work.
Working code extract:
automation:
- alias: Some name
id: some_id
initial_state: false
trigger:
platform: state
entity_id: input_boolean.some_switch
to: 'on'
action:
- service: mqtt.publish
data:
topic: 'openevse/rapi/in/$FS'
retain: false
payload: 8
What I want to do which does not work:
automation:
- alias: Some name
id: some_id
initial_state: false
trigger:
platform: state
entity_id: input_boolean.some_switch
to: 'on'
action:
- service: mqtt.publish
data:
topic: 'openevse/rapi/in/$FS'
retain: false
payload: >-
{{((states('sensor.some_sensor') | float) / ('0.25' | float)) | int}}
Any advice?!
Thanks,
Paul