Home Assistant Unofficial Reference 2024.12.1
cover.py
Go to the documentation of this file.
1 """Support for Tellstick covers."""
2 
3 from __future__ import annotations
4 
5 from typing import Any
6 
7 from homeassistant.components.cover import CoverEntity
8 from homeassistant.core import HomeAssistant
9 from homeassistant.helpers.entity_platform import AddEntitiesCallback
10 from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
11 
12 from .const import (
13  ATTR_DISCOVER_CONFIG,
14  ATTR_DISCOVER_DEVICES,
15  DATA_TELLSTICK,
16  DEFAULT_SIGNAL_REPETITIONS,
17 )
18 from .entity import TellstickDevice
19 
20 
22  hass: HomeAssistant,
23  config: ConfigType,
24  add_entities: AddEntitiesCallback,
25  discovery_info: DiscoveryInfoType | None = None,
26 ) -> None:
27  """Set up the Tellstick covers."""
28  if discovery_info is None or discovery_info[ATTR_DISCOVER_DEVICES] is None:
29  return
30 
31  signal_repetitions = discovery_info.get(
32  ATTR_DISCOVER_CONFIG, DEFAULT_SIGNAL_REPETITIONS
33  )
34 
36  [
37  TellstickCover(hass.data[DATA_TELLSTICK][tellcore_id], signal_repetitions)
38  for tellcore_id in discovery_info[ATTR_DISCOVER_DEVICES]
39  ],
40  True,
41  )
42 
43 
45  """Representation of a Tellstick cover."""
46 
47  @property
48  def is_closed(self) -> None:
49  """Return the current position of the cover is not possible."""
50  return None
51 
52  @property
53  def assumed_state(self) -> bool:
54  """Return True if unable to access real state of the entity."""
55  return True
56 
57  def close_cover(self, **kwargs: Any) -> None:
58  """Close the cover."""
59  self._tellcore_device_tellcore_device.down()
60 
61  def open_cover(self, **kwargs: Any) -> None:
62  """Open the cover."""
63  self._tellcore_device_tellcore_device.up()
64 
65  def stop_cover(self, **kwargs: Any) -> None:
66  """Stop the cover."""
67  self._tellcore_device_tellcore_device.stop()
68 
69  def _parse_tellcore_data(self, tellcore_data):
70  """Turn the value received from tellcore into something useful."""
71 
72  def _parse_ha_data(self, kwargs):
73  """Turn the value from HA into something useful."""
74 
75  def _update_model(self, new_state, data):
76  """Update the device entity state to match the arguments."""
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)
Definition: cover.py:26