1 """Support for HomeMatic covers."""
3 from __future__
import annotations
17 from .const
import ATTR_DEVICE_TYPE, ATTR_DISCOVER_DEVICES
18 from .entity
import HMDevice
20 HM_GARAGE = (
"IPGarage",)
26 add_entities: AddEntitiesCallback,
27 discovery_info: DiscoveryInfoType |
None =
None,
29 """Set up the platform."""
30 if discovery_info
is None:
33 devices: list[HMCover] = []
34 for conf
in discovery_info[ATTR_DISCOVER_DEVICES]:
35 if conf[ATTR_DEVICE_TYPE]
in HM_GARAGE:
44 """Representation a HomeMatic Cover."""
48 """Return current position of cover.
50 None is unknown, 0 is closed, 100 is fully open.
55 """Move the cover to a specific position."""
56 if ATTR_POSITION
in kwargs:
57 position =
float(kwargs[ATTR_POSITION])
58 position =
min(100,
max(0, position))
59 level = position / 100.0
64 """Return whether the cover is closed."""
74 """Close the cover."""
78 """Stop the device if in motion."""
82 """Generate a data dictionary (self._data) from metadata."""
85 if "LEVEL_2" in self.
_hmdevice_hmdevice.WRITENODE:
86 self._data.
update({
"LEVEL_2":
None})
90 """Return current position of cover tilt.
92 None is unknown, 0 is closed, 100 is fully open.
94 if not (position := self._data.
get(
"LEVEL_2", 0)):
96 return int(position * 100)
99 """Move the cover tilt to a specific position."""
100 if "LEVEL_2" in self._data
and ATTR_TILT_POSITION
in kwargs:
101 position =
float(kwargs[ATTR_TILT_POSITION])
102 position =
min(100,
max(0, position))
103 level = position / 100.0
107 """Open the cover tilt."""
108 if "LEVEL_2" in self._data:
112 """Close the cover tilt."""
113 if "LEVEL_2" in self._data:
117 """Stop cover tilt."""
118 if "LEVEL_2" in self._data:
123 """Represents a Homematic Garage cover. Homematic garage covers do not support position attributes."""
125 _attr_device_class = CoverDeviceClass.GARAGE
129 """Return current position of cover.
131 None is unknown, 0 is closed, 100 is fully open.
138 """Return whether the cover is closed."""
142 """Generate a data dictionary (self._data) from metadata."""
current_cover_tilt_position
None stop_cover(self, **Any kwargs)
int|None current_cover_position(self)
int|None current_cover_position(self)
None set_cover_tilt_position(self, **Any kwargs)
None close_cover(self, **Any kwargs)
None stop_cover(self, **Any kwargs)
None open_cover_tilt(self, **Any kwargs)
None set_cover_position(self, **Any kwargs)
None open_cover(self, **Any kwargs)
None close_cover_tilt(self, **Any kwargs)
None stop_cover_tilt(self, **Any kwargs)
bool|None is_closed(self)
def _init_data_struct(self)
def _init_data_struct(self)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
web.Response get(self, web.Request request, str config_key)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)