Collection of changing entity properties to class attributes - 2 (#51345)

This commit is contained in:
Franck Nijhof 2021-06-01 21:43:55 +02:00 committed by GitHub
parent e5dff49440
commit fcdd8b11a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 70 additions and 215 deletions

View file

@ -37,6 +37,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class SmartHabCover(CoverEntity):
"""Representation a cover."""
_attr_device_class = DEVICE_CLASS_WINDOW
def __init__(self, cover):
"""Initialize a SmartHabCover."""
self._cover = cover
@ -69,11 +71,6 @@ class SmartHabCover(CoverEntity):
"""Return if the cover is closed or not."""
return self._cover.state == 0
@property
def device_class(self) -> str:
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_WINDOW
async def async_open_cover(self, **kwargs):
"""Open the cover."""
await self._cover.async_open()