Skip to content
Snippets Groups Projects
Unverified Commit 37240e81 authored by Antonio Larrosa's avatar Antonio Larrosa Committed by GitHub
Browse files

Add melcloud standard horizontal vane modes (#136654)

parent 0b7a023d
No related branches found
No related tags found
No related merge requests found
......@@ -152,6 +152,14 @@ class AtaDeviceClimate(MelCloudClimate):
self._attr_unique_id = f"{self.api.device.serial}-{self.api.device.mac}"
self._attr_device_info = self.api.device_info
async def async_added_to_hass(self) -> None:
"""When entity is added to hass."""
await super().async_added_to_hass()
# We can only check for vane_horizontal once we fetch the device data from the cloud
if self._device.vane_horizontal:
self._attr_supported_features |= ClimateEntityFeature.SWING_HORIZONTAL_MODE
@property
def extra_state_attributes(self) -> dict[str, Any] | None:
"""Return the optional state attributes with device specific additions."""
......@@ -274,15 +282,29 @@ class AtaDeviceClimate(MelCloudClimate):
"""Return vertical vane position or mode."""
return self._device.vane_vertical
@property
def swing_horizontal_mode(self) -> str | None:
"""Return horizontal vane position or mode."""
return self._device.vane_horizontal
async def async_set_swing_mode(self, swing_mode: str) -> None:
"""Set vertical vane position or mode."""
await self.async_set_vane_vertical(swing_mode)
async def async_set_swing_horizontal_mode(self, swing_horizontal_mode: str) -> None:
"""Set horizontal vane position or mode."""
await self.async_set_vane_horizontal(swing_horizontal_mode)
@property
def swing_modes(self) -> list[str] | None:
"""Return a list of available vertical vane positions and modes."""
return self._device.vane_vertical_positions
@property
def swing_horizontal_modes(self) -> list[str] | None:
"""Return a list of available horizontal vane positions and modes."""
return self._device.vane_horizontal_positions
async def async_turn_on(self) -> None:
"""Turn the entity on."""
await self._device.set({"power": True})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment