1 """Demo platform for the cover component."""
3 from __future__
import annotations
5 from datetime
import datetime
26 config_entry: ConfigEntry,
27 async_add_entities: AddEntitiesCallback,
29 """Set up the demo cover platform."""
32 DemoCover(hass,
"cover_1",
"Kitchen Window"),
33 DemoCover(hass,
"cover_2",
"Hall Window", 10),
34 DemoCover(hass,
"cover_3",
"Living Room Window", 70, 50),
39 device_class=CoverDeviceClass.GARAGE,
40 supported_features=(CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE),
48 CoverEntityFeature.OPEN_TILT
49 | CoverEntityFeature.STOP_TILT
50 | CoverEntityFeature.CLOSE_TILT
51 | CoverEntityFeature.SET_TILT_POSITION
59 """Representation of a demo cover."""
61 _attr_has_entity_name =
True
63 _attr_should_poll =
False
70 position: int |
None =
None,
71 tilt_position: int |
None =
None,
72 device_class: CoverDeviceClass |
None =
None,
73 supported_features: CoverEntityFeature |
None =
None,
75 """Initialize the cover."""
93 self.
_closed_closed = position <= 0
105 """Return unique ID for cover."""
110 """Return the current position of the cover."""
115 """Return the current tilt position of the cover."""
120 """Return if the cover is closed."""
125 """Return if the cover is closing."""
130 """Return if the cover is opening."""
134 """Close the cover."""
148 """Close the cover tilt."""
156 """Open the cover."""
170 """Open the cover tilt."""
178 """Move the cover to a specific position."""
179 position: int = kwargs[ATTR_POSITION]
190 """Move the cover til to a specific position."""
191 tilt_position: int = kwargs[ATTR_TILT_POSITION]
202 """Stop the cover."""
213 """Stop the cover tilt."""
224 """Listen for changes in cover."""
231 """Track time changes."""
249 """Listen for changes in cover tilt."""
256 """Track time changes."""
current_cover_tilt_position
None async_stop_cover_tilt(self, **Any kwargs)
int|None current_cover_position(self)
None async_stop_cover(self, **Any kwargs)
None async_set_cover_tilt_position(self, **Any kwargs)
int|None current_cover_position(self)
None _listen_cover_tilt(self)
None async_open_cover(self, **Any kwargs)
None _time_changed_cover_tilt(self, datetime now)
_unsub_listener_cover_tilt
None async_stop_cover_tilt(self, **Any kwargs)
None async_stop_cover(self, **Any kwargs)
None async_open_cover_tilt(self, **Any kwargs)
None async_close_cover_tilt(self, **Any kwargs)
None _time_changed_cover(self, datetime now)
None __init__(self, HomeAssistant hass, str unique_id, str device_name, int|None position=None, int|None tilt_position=None, CoverDeviceClass|None device_class=None, CoverEntityFeature|None supported_features=None)
None async_set_cover_position(self, **Any kwargs)
None async_close_cover(self, **Any kwargs)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
CALLBACK_TYPE async_track_utc_time_change(HomeAssistant hass, Callable[[datetime], Coroutine[Any, Any, None]|None] action, Any|None hour=None, Any|None minute=None, Any|None second=None, bool local=False)