Add encoding support for publishing
This commit is contained in:
parent
cac2f8ac06
commit
b69b9c60ec
10 changed files with 154 additions and 21 deletions
|
@ -53,7 +53,13 @@ import homeassistant.util.color as color_util
|
|||
|
||||
from .. import MqttCommandTemplate, subscription
|
||||
from ... import mqtt
|
||||
from ..const import CONF_COMMAND_TOPIC, CONF_QOS, CONF_RETAIN, CONF_STATE_TOPIC
|
||||
from ..const import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
CONF_ENCODING,
|
||||
CONF_QOS,
|
||||
CONF_RETAIN,
|
||||
CONF_STATE_TOPIC,
|
||||
)
|
||||
from ..debug_info import log_messages
|
||||
from ..mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity
|
||||
from .schema import MQTT_LIGHT_SCHEMA_SCHEMA
|
||||
|
@ -331,7 +337,9 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity):
|
|||
command_templates[key] = None
|
||||
for key in COMMAND_TEMPLATE_KEYS & config.keys():
|
||||
command_templates[key] = MqttCommandTemplate(
|
||||
config[key], entity=self
|
||||
config[key],
|
||||
entity=self,
|
||||
encoding=self._config.get(CONF_ENCODING) or None,
|
||||
).async_render
|
||||
self._command_templates = command_templates
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue