Adjust mqtt integration

This commit is contained in:
Franck Nijhof
2020-10-26 17:23:29 +01:00
parent fe9470548c
commit e2ae98eec1
3 changed files with 8 additions and 4 deletions

View File

@@ -338,7 +338,7 @@ class MqttAlarm(
"""Publish via mqtt.""" """Publish via mqtt."""
command_template = self._config[CONF_COMMAND_TEMPLATE] command_template = self._config[CONF_COMMAND_TEMPLATE]
values = {"action": action, "code": code} values = {"action": action, "code": code}
payload = command_template.async_render(**values) payload = command_template.async_render(**values, parse_result=False)
mqtt.async_publish( mqtt.async_publish(
self.hass, self.hass,
self._config[CONF_COMMAND_TOPIC], self._config[CONF_COMMAND_TOPIC],

View File

@@ -557,7 +557,7 @@ class MqttCover(
position = kwargs[ATTR_POSITION] position = kwargs[ATTR_POSITION]
percentage_position = position percentage_position = position
if set_position_template is not None: if set_position_template is not None:
position = set_position_template.async_render(**kwargs) position = set_position_template.async_render(parse_result=False, **kwargs)
else: else:
position = self.find_in_range_from_percent(position, COVER_PAYLOAD) position = self.find_in_range_from_percent(position, COVER_PAYLOAD)

View File

@@ -441,7 +441,9 @@ class MqttLightTemplate(
mqtt.async_publish( mqtt.async_publish(
self.hass, self.hass,
self._topics[CONF_COMMAND_TOPIC], self._topics[CONF_COMMAND_TOPIC],
self._templates[CONF_COMMAND_ON_TEMPLATE].async_render(**values), self._templates[CONF_COMMAND_ON_TEMPLATE].async_render(
parse_result=False, **values
),
self._config[CONF_QOS], self._config[CONF_QOS],
self._config[CONF_RETAIN], self._config[CONF_RETAIN],
) )
@@ -464,7 +466,9 @@ class MqttLightTemplate(
mqtt.async_publish( mqtt.async_publish(
self.hass, self.hass,
self._topics[CONF_COMMAND_TOPIC], self._topics[CONF_COMMAND_TOPIC],
self._templates[CONF_COMMAND_OFF_TEMPLATE].async_render(**values), self._templates[CONF_COMMAND_OFF_TEMPLATE].async_render(
parse_result=False, **values
),
self._config[CONF_QOS], self._config[CONF_QOS],
self._config[CONF_RETAIN], self._config[CONF_RETAIN],
) )