mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add template support to mqtt.publish service payload.
This commit is contained in:
parent
2ba237eac8
commit
4cf85294db
@ -131,7 +131,7 @@ def setup(hass, config):
|
|||||||
def publish_service(call):
|
def publish_service(call):
|
||||||
"""Handle MQTT publish service calls."""
|
"""Handle MQTT publish service calls."""
|
||||||
msg_topic = call.data.get(ATTR_TOPIC)
|
msg_topic = call.data.get(ATTR_TOPIC)
|
||||||
payload = call.data.get(ATTR_PAYLOAD)
|
payload = util.template.render(hass, call.data.get(ATTR_PAYLOAD))
|
||||||
qos = call.data.get(ATTR_QOS, DEFAULT_QOS)
|
qos = call.data.get(ATTR_QOS, DEFAULT_QOS)
|
||||||
retain = call.data.get(ATTR_RETAIN, DEFAULT_RETAIN)
|
retain = call.data.get(ATTR_RETAIN, DEFAULT_RETAIN)
|
||||||
if msg_topic is None or payload is None:
|
if msg_topic is None or payload is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user