1 """Support for Fibaro cover - curtains, rollershutters etc."""
3 from __future__
import annotations
5 from typing
import Any, cast
7 from pyfibaro.fibaro_device
import DeviceModel
21 from .
import FibaroController
22 from .const
import DOMAIN
23 from .entity
import FibaroEntity
29 async_add_entities: AddEntitiesCallback,
31 """Set up the Fibaro covers."""
32 controller: FibaroController = hass.data[DOMAIN][entry.entry_id]
34 [
FibaroCover(device)
for device
in controller.fibaro_devices[Platform.COVER]],
40 """Representation a Fibaro Cover."""
42 def __init__(self, fibaro_device: DeviceModel) ->
None:
43 """Initialize the Vera device."""
49 CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
56 """Normalize the position."""
59 position =
int(position)
67 """Return if only open / close is supported."""
73 """Update the state."""
84 if device_state.has_value:
88 closed: bool |
None =
None
90 if device_state.has_value
and device_state.str_value().lower() !=
"unknown":
91 closed = device_state.str_value().lower() ==
"closed"
97 """Move the cover to a specific position."""
98 self.
set_levelset_level(cast(int, kwargs.get(ATTR_POSITION)))
101 """Move the cover to a specific position."""
102 self.
set_level2set_level2(cast(int, kwargs.get(ATTR_TILT_POSITION)))
105 """Open the cover."""
109 """Close the cover."""
110 self.
actionaction(
"close")
113 """Open the cover tilt."""
117 """Close the cover."""
121 """Stop the cover."""
int|None current_cover_position(self)
None close_cover_tilt(self, **Any kwargs)
_attr_current_cover_position
None stop_cover(self, **Any kwargs)
None set_cover_tilt_position(self, **Any kwargs)
None set_cover_position(self, **Any kwargs)
bool _is_open_close_only(self)
None __init__(self, DeviceModel fibaro_device)
None open_cover_tilt(self, **Any kwargs)
None close_cover(self, **Any kwargs)
None open_cover(self, **Any kwargs)
_attr_current_cover_tilt_position
None action(self, str cmd, *Any args)
None set_level2(self, int level)
None set_level(self, int level)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)