mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add support for Supla garage doors (#90593)
* Adding support for additional Supla channel types Newly supported channel types are - CONTROLLINGTHEGARAGEDOOR, DIMMER, RGBLIGHTING. * Remove light platform additions * Remove light devices * Update homeassistant/components/supla/cover.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Removing some Black automatic formatting. --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
parent
1eadc63cd5
commit
34245a6b3d
@ -30,6 +30,7 @@ SCAN_INTERVAL = timedelta(seconds=10)
|
|||||||
SUPLA_FUNCTION_HA_CMP_MAP = {
|
SUPLA_FUNCTION_HA_CMP_MAP = {
|
||||||
"CONTROLLINGTHEROLLERSHUTTER": Platform.COVER,
|
"CONTROLLINGTHEROLLERSHUTTER": Platform.COVER,
|
||||||
"CONTROLLINGTHEGATE": Platform.COVER,
|
"CONTROLLINGTHEGATE": Platform.COVER,
|
||||||
|
"CONTROLLINGTHEGARAGEDOOR": Platform.COVER,
|
||||||
"LIGHTSWITCH": Platform.SWITCH,
|
"LIGHTSWITCH": Platform.SWITCH,
|
||||||
}
|
}
|
||||||
SUPLA_FUNCTION_NONE = "NONE"
|
SUPLA_FUNCTION_NONE = "NONE"
|
||||||
|
@ -16,6 +16,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
SUPLA_SHUTTER = "CONTROLLINGTHEROLLERSHUTTER"
|
SUPLA_SHUTTER = "CONTROLLINGTHEROLLERSHUTTER"
|
||||||
SUPLA_GATE = "CONTROLLINGTHEGATE"
|
SUPLA_GATE = "CONTROLLINGTHEGATE"
|
||||||
|
SUPLA_GARAGE_DOOR = "CONTROLLINGTHEGARAGEDOOR"
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(
|
async def async_setup_platform(
|
||||||
@ -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(
|
entities.append(
|
||||||
SuplaGateDoor(
|
SuplaDoor(
|
||||||
device,
|
device,
|
||||||
hass.data[DOMAIN][SUPLA_SERVERS][server_name],
|
hass.data[DOMAIN][SUPLA_SERVERS][server_name],
|
||||||
hass.data[DOMAIN][SUPLA_COORDINATORS][server_name],
|
hass.data[DOMAIN][SUPLA_COORDINATORS][server_name],
|
||||||
@ -90,33 +91,33 @@ class SuplaCover(SuplaChannel, CoverEntity):
|
|||||||
await self.async_action("STOP")
|
await self.async_action("STOP")
|
||||||
|
|
||||||
|
|
||||||
class SuplaGateDoor(SuplaChannel, CoverEntity):
|
class SuplaDoor(SuplaChannel, CoverEntity):
|
||||||
"""Representation of a Supla gate door."""
|
"""Representation of a Supla door."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_closed(self) -> bool | None:
|
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")
|
state = self.channel_data.get("state")
|
||||||
if state and "hi" in state:
|
if state and "hi" in state:
|
||||||
return state.get("hi")
|
return state.get("hi")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def async_open_cover(self, **kwargs: Any) -> None:
|
async def async_open_cover(self, **kwargs: Any) -> None:
|
||||||
"""Open the gate."""
|
"""Open the door."""
|
||||||
if self.is_closed:
|
if self.is_closed:
|
||||||
await self.async_action("OPEN_CLOSE")
|
await self.async_action("OPEN_CLOSE")
|
||||||
|
|
||||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||||
"""Close the gate."""
|
"""Close the door."""
|
||||||
if not self.is_closed:
|
if not self.is_closed:
|
||||||
await self.async_action("OPEN_CLOSE")
|
await self.async_action("OPEN_CLOSE")
|
||||||
|
|
||||||
async def async_stop_cover(self, **kwargs: Any) -> None:
|
async def async_stop_cover(self, **kwargs: Any) -> None:
|
||||||
"""Stop the gate."""
|
"""Stop the door."""
|
||||||
await self.async_action("OPEN_CLOSE")
|
await self.async_action("OPEN_CLOSE")
|
||||||
|
|
||||||
async def async_toggle(self, **kwargs: Any) -> None:
|
async def async_toggle(self, **kwargs: Any) -> None:
|
||||||
"""Toggle the gate."""
|
"""Toggle the door."""
|
||||||
await self.async_action("OPEN_CLOSE")
|
await self.async_action("OPEN_CLOSE")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user