1 """Support for the Dynalite channels as covers."""
15 from .bridge
import DynaliteBridge
16 from .entity
import DynaliteBase, async_setup_entry_base
21 config_entry: ConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Record the async_add_entities function to add them later when received from Dynalite."""
27 def cover_from_device(device: Any, bridge: DynaliteBridge) -> CoverEntity:
33 hass, config_entry, async_add_entities,
"cover", cover_from_device
38 """Representation of a Dynalite Channel as a Home Assistant Cover."""
40 def __init__(self, device: Any, bridge: DynaliteBridge) ->
None:
41 """Initialize the cover."""
43 device_class = try_parse_enum(CoverDeviceClass, self.
_device_device.device_class)
48 """Return the position of the cover from 0 to 100."""
49 return self.
_device_device.current_cover_position
53 """Return true if cover is opening."""
54 return self.
_device_device.is_opening
58 """Return true if cover is closing."""
59 return self.
_device_device.is_closing
63 """Return true if cover is closed."""
64 return self.
_device_device.is_closed
71 """Close the cover."""
75 """Set the cover position."""
83 """Initialize the state from cache."""
84 target_level = state.attributes.get(ATTR_CURRENT_POSITION)
85 if target_level
is not None:
86 self.
_device_device.init_level(target_level)
90 """Representation of a Dynalite Channel as a Home Assistant Cover that uses up and down for tilt."""
94 """Return the current tilt position."""
95 return self.
_device_device.current_cover_tilt_position
98 """Open cover tilt."""
102 """Close cover tilt."""
106 """Set the cover tilt position."""
110 """Stop the cover tilt."""
current_cover_tilt_position
None async_stop_cover_tilt(self, **Any kwargs)
None async_open_cover_tilt(self, **Any kwargs)
None async_set_cover_tilt_position(self, **Any kwargs)
None async_close_cover_tilt(self, **Any kwargs)
None async_open_cover(self, **Any kwargs)
None async_close_cover(self, **Any kwargs)
def initialize_state(self, state)
None async_stop_cover(self, **Any kwargs)
None __init__(self, Any device, DynaliteBridge bridge)
None async_set_cover_position(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
None async_setup_entry_base(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities, str platform, Callable entity_from_device)