Add mqtt encoding support for publishing (#62739)
* encoding support for mqtt publishing - todo tests * signature allows None values for qos and retain * common test for mqtt publishing encoding * better test with command templates * more tests * fix tests alarm control panel+tests light basic * tests light json and template * add tests vacuum and fix tests light_template
This commit is contained in:
parent
2cc4d9846b
commit
d0c4f0fec4
33 changed files with 1283 additions and 27 deletions
|
@ -42,7 +42,14 @@ from homeassistant.util.percentage import (
|
|||
|
||||
from . import PLATFORMS, MqttCommandTemplate, subscription
|
||||
from .. import mqtt
|
||||
from .const import CONF_COMMAND_TOPIC, CONF_QOS, CONF_RETAIN, CONF_STATE_TOPIC, DOMAIN
|
||||
from .const import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
CONF_ENCODING,
|
||||
CONF_QOS,
|
||||
CONF_RETAIN,
|
||||
CONF_STATE_TOPIC,
|
||||
DOMAIN,
|
||||
)
|
||||
from .debug_info import log_messages
|
||||
from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_setup_entry_helper
|
||||
|
||||
|
@ -542,6 +549,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||
mqtt_payload,
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
self._config[CONF_ENCODING],
|
||||
)
|
||||
if percentage:
|
||||
await self.async_set_percentage(percentage)
|
||||
|
@ -563,6 +571,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||
mqtt_payload,
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
self._config[CONF_ENCODING],
|
||||
)
|
||||
if self._optimistic:
|
||||
self._state = False
|
||||
|
@ -583,6 +592,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||
mqtt_payload,
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
self._config[CONF_ENCODING],
|
||||
)
|
||||
|
||||
if self._optimistic_percentage:
|
||||
|
@ -606,6 +616,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||
mqtt_payload,
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
self._config[CONF_ENCODING],
|
||||
)
|
||||
|
||||
if self._optimistic_preset_mode:
|
||||
|
@ -632,6 +643,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||
mqtt_payload,
|
||||
self._config[CONF_QOS],
|
||||
self._config[CONF_RETAIN],
|
||||
self._config[CONF_ENCODING],
|
||||
)
|
||||
|
||||
if self._optimistic_oscillation:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue