def publish_template(hass, topic, payload_template, qos=None, retain=None):
 data = _build_publish_data(topic, qos, retain)
 data[ATTR_PAYLOAD_TEMPLATE] = payload_template
 hass.services.call(DOMAIN, SERVICE_PUBLISH, data)

def publish_template ( hass , topic , payload_template , qos = None , retain = None ) : data = _build_publish_data ( topic , qos , retain ) data [ ATTR_PAYLOAD_TEMPLATE ] = payload_template hass . services . call ( DOMAIN , SERVICE_PUBLISH , data )
publish message to an mqtt topic using a template payload .