mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Add support for swing horizontal mode for mqtt climate (#139303)
* Add support for swing horizontal mode for mqtt climate * Fix import
This commit is contained in:
@@ -11,6 +11,7 @@ from homeassistant.components.climate import (
|
||||
ATTR_HUMIDITY,
|
||||
ATTR_HVAC_MODE,
|
||||
ATTR_PRESET_MODE,
|
||||
ATTR_SWING_HORIZONTAL_MODE,
|
||||
ATTR_SWING_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
@@ -20,10 +21,11 @@ from homeassistant.components.climate import (
|
||||
SERVICE_SET_HUMIDITY,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
SERVICE_SET_PRESET_MODE,
|
||||
SERVICE_SET_SWING_HORIZONTAL_MODE,
|
||||
SERVICE_SET_SWING_MODE,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.components.climate.const import HVACMode
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_TEMPERATURE,
|
||||
@@ -211,6 +213,20 @@ def set_operation_mode(
|
||||
hass.services.call(DOMAIN, SERVICE_SET_HVAC_MODE, data)
|
||||
|
||||
|
||||
async def async_set_swing_horizontal_mode(
|
||||
hass: HomeAssistant, swing_horizontal_mode: str, entity_id: str = ENTITY_MATCH_ALL
|
||||
) -> None:
|
||||
"""Set new target swing horizontal mode."""
|
||||
data = {ATTR_SWING_HORIZONTAL_MODE: swing_horizontal_mode}
|
||||
|
||||
if entity_id is not None:
|
||||
data[ATTR_ENTITY_ID] = entity_id
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_SET_SWING_HORIZONTAL_MODE, data, blocking=True
|
||||
)
|
||||
|
||||
|
||||
async def async_set_swing_mode(
|
||||
hass: HomeAssistant, swing_mode: str, entity_id: str = ENTITY_MATCH_ALL
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user