mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add device classes to homematicip_cloud cover (#52793)
Make HMIP covers report a SHUTTER/BLIND/GARAGE device_class (as appropriate).
This commit is contained in:
parent
574cb03acc
commit
e556722281
@ -15,6 +15,9 @@ from homematicip.base.enums import DoorCommand, DoorState
|
||||
from homeassistant.components.cover import (
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DEVICE_CLASS_BLIND,
|
||||
DEVICE_CLASS_GARAGE,
|
||||
DEVICE_CLASS_SHUTTER,
|
||||
CoverEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -63,6 +66,11 @@ async def async_setup_entry(
|
||||
class HomematicipBlindModule(HomematicipGenericEntity, CoverEntity):
|
||||
"""Representation of the HomematicIP blind module."""
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the class of the cover."""
|
||||
return DEVICE_CLASS_BLIND
|
||||
|
||||
@property
|
||||
def current_cover_position(self) -> int:
|
||||
"""Return current position of cover."""
|
||||
@ -151,6 +159,11 @@ class HomematicipMultiCoverShutter(HomematicipGenericEntity, CoverEntity):
|
||||
hap, device, channel=channel, is_multi_channel=is_multi_channel
|
||||
)
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the class of the cover."""
|
||||
return DEVICE_CLASS_SHUTTER
|
||||
|
||||
@property
|
||||
def current_cover_position(self) -> int:
|
||||
"""Return current position of cover."""
|
||||
@ -264,6 +277,11 @@ class HomematicipGarageDoorModule(HomematicipGenericEntity, CoverEntity):
|
||||
}
|
||||
return door_state_to_position.get(self._device.doorState)
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the class of the cover."""
|
||||
return DEVICE_CLASS_GARAGE
|
||||
|
||||
@property
|
||||
def is_closed(self) -> bool | None:
|
||||
"""Return if the cover is closed."""
|
||||
@ -290,6 +308,11 @@ class HomematicipCoverShutterGroup(HomematicipGenericEntity, CoverEntity):
|
||||
device.modelType = f"HmIP-{post}"
|
||||
super().__init__(hap, device, post, is_multi_channel=False)
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the class of the cover."""
|
||||
return DEVICE_CLASS_SHUTTER
|
||||
|
||||
@property
|
||||
def current_cover_position(self) -> int:
|
||||
"""Return current position of cover."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user