Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions homeassistant/components/supla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
SUPLA_FUNCTION_HA_CMP_MAP = {
"CONTROLLINGTHEROLLERSHUTTER": Platform.COVER,
"CONTROLLINGTHEGATE": Platform.COVER,
"CONTROLLINGTHEGARAGEDOOR": Platform.COVER,
Comment thread
alh84001 marked this conversation as resolved.
"LIGHTSWITCH": Platform.SWITCH,
}
SUPLA_FUNCTION_NONE = "NONE"
Expand Down
19 changes: 10 additions & 9 deletions homeassistant/components/supla/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

SUPLA_SHUTTER = "CONTROLLINGTHEROLLERSHUTTER"
SUPLA_GATE = "CONTROLLINGTHEGATE"
SUPLA_GARAGE_DOOR = "CONTROLLINGTHEGARAGEDOOR"


async def async_setup_platform(
Expand Down Expand Up @@ -44,9 +45,9 @@ async def async_setup_platform(
)
)

elif device_name == SUPLA_GATE:
elif device_name in {SUPLA_GATE, SUPLA_GARAGE_DOOR}:
entities.append(
SuplaGateDoor(
SuplaDoor(
device,
hass.data[DOMAIN][SUPLA_SERVERS][server_name],
hass.data[DOMAIN][SUPLA_COORDINATORS][server_name],
Expand Down Expand Up @@ -90,33 +91,33 @@ async def async_stop_cover(self, **kwargs: Any) -> None:
await self.async_action("STOP")


class SuplaGateDoor(SuplaChannel, CoverEntity):
"""Representation of a Supla gate door."""
class SuplaDoor(SuplaChannel, CoverEntity):
"""Representation of a Supla door."""

@property
def is_closed(self) -> bool | None:
"""Return if the gate is closed or not."""
"""Return if the door is closed or not."""
state = self.channel_data.get("state")
if state and "hi" in state:
return state.get("hi")
return None

async def async_open_cover(self, **kwargs: Any) -> None:
"""Open the gate."""
"""Open the door."""
if self.is_closed:
await self.async_action("OPEN_CLOSE")

async def async_close_cover(self, **kwargs: Any) -> None:
"""Close the gate."""
"""Close the door."""
if not self.is_closed:
await self.async_action("OPEN_CLOSE")

async def async_stop_cover(self, **kwargs: Any) -> None:
"""Stop the gate."""
"""Stop the door."""
await self.async_action("OPEN_CLOSE")

async def async_toggle(self, **kwargs: Any) -> None:
"""Toggle the gate."""
"""Toggle the door."""
await self.async_action("OPEN_CLOSE")

@property
Expand Down