Skip to content

MQTT Payload Template Not Rendering in Button Call-Service #907

@mbonaccors

Description

@mbonaccors

After the deprecation of payload_data for MQTT, we were instructed to use payload exclusively for static and template-based payloads. While testing MQTT messages with template data in Developer Tools, everything works correctly. However, when using a Lovelace button (via a tap_action calling mqtt.publish) that includes a template variable in the payload, the variable is not rendered and the literal template string is passed through instead. For example:

tap_action:
action: call-service
service: mqtt.publish
service_data:
payload: {{ states("input_boolean.studio_mode_chill") }}
topic: eventghost

will just render as:

{{ states("input_boolean.studio_mode_chill") }}

Is there a way to move the jinja2 rendering over to the payload key now that everything has been switched over?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FRFeature Request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions