#MQTT publish payload_template no longer exists

15 messages · Page 1 of 1 (latest)

pale sage
#

Hello, I just noticed that in HA 2025.2 the payload_template attribute in the publish action for the MQTT integration as been removed. I didn't notice any backwards incompatible mention about this. What are we supposed to do if we need to publish a payload using a template now?

waxen reef
#

payload takes a template

pale sage
#

Ok, but was there a deprecation notice for this change?

waxen reef
#

Deprecation notices are generally 6 months ahead of the deprecation itself

pale sage
#

my bad then, thanks

#

However, it's not working. I have a template on the payload attribute and it doesn't evaluate it, it just publishes the template without procesing

waxen reef
#

Share what you've done

pale sage
#

tap_action:
action: perform-action
target: {}
perform_action: mqtt.publish
data:
payload: >
{% set segments = [ "16" if states('input_boolean.vacuum_bathroom')
== 'on' else -1, "17" if states('input_boolean.vacuum_hallway') ==
'on' else -1, "18" if states('input_boolean.vacuum_living_room') ==
'on' else -1, "19" if states('input_boolean.vacuum_kitchen') == 'on'
else -1, "20" if states('input_boolean.vacuum_office') == 'on' else
-1, "21" if states('input_boolean.vacuum_laundry') == 'on' else -1,
] | select("string") | list %} {% set iterations =
states('input_number.vacuum_passes') | int %} {{ {"segment_ids":
segments, "iterations": iterations} | to_json }}
topic: valetudo/jervas/MapSegmentationCapability/clean/set

ashen streamBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

pale sage
#

the only thing I changed was "payload_template" to "payload"

waxen reef
#

Not that the frontend doesn't support templates, that's your problem

#

Move the action to a script and it'll work

pale sage
#

alright, thank you