mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove unneeded preset_mode checks for mqtt climate (#107190)
This commit is contained in:
parent
c7b6c9da31
commit
8c4a29c200
@ -989,23 +989,17 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity):
|
|||||||
|
|
||||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||||
"""Set a preset mode."""
|
"""Set a preset mode."""
|
||||||
if self._feature_preset_mode and self.preset_modes:
|
mqtt_payload = self._command_templates[CONF_PRESET_MODE_COMMAND_TEMPLATE](
|
||||||
if preset_mode not in self.preset_modes and preset_mode is not PRESET_NONE:
|
preset_mode
|
||||||
_LOGGER.warning("'%s' is not a valid preset mode", preset_mode)
|
)
|
||||||
return
|
await self._publish(
|
||||||
mqtt_payload = self._command_templates[CONF_PRESET_MODE_COMMAND_TEMPLATE](
|
CONF_PRESET_MODE_COMMAND_TOPIC,
|
||||||
preset_mode
|
mqtt_payload,
|
||||||
)
|
)
|
||||||
await self._publish(
|
|
||||||
CONF_PRESET_MODE_COMMAND_TOPIC,
|
|
||||||
mqtt_payload,
|
|
||||||
)
|
|
||||||
|
|
||||||
if self._optimistic_preset_mode:
|
if self._optimistic_preset_mode:
|
||||||
self._attr_preset_mode = preset_mode
|
self._attr_preset_mode = preset_mode
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
# Options CONF_AUX_COMMAND_TOPIC, CONF_AUX_STATE_TOPIC
|
# Options CONF_AUX_COMMAND_TOPIC, CONF_AUX_STATE_TOPIC
|
||||||
# and CONF_AUX_STATE_TEMPLATE were deprecated in HA Core 2023.9
|
# and CONF_AUX_STATE_TEMPLATE were deprecated in HA Core 2023.9
|
||||||
|
Loading…
x
Reference in New Issue
Block a user