1 """Support for Netatmo/Bubendorff covers."""
3 from __future__
import annotations
8 from pyatmo
import modules
as NaModules
21 from .const
import CONF_URL_CONTROL, NETATMO_CREATE_COVER
22 from .data_handler
import HOME, SIGNAL_NAME, NetatmoDevice
23 from .entity
import NetatmoModuleEntity
25 _LOGGER = logging.getLogger(__name__)
31 async_add_entities: AddEntitiesCallback,
33 """Set up the Netatmo cover platform."""
36 def _create_entity(netatmo_device: NetatmoDevice) ->
None:
38 _LOGGER.debug(
"Adding cover %s", entity)
41 entry.async_on_unload(
47 """Representation of a Netatmo cover device."""
49 _attr_supported_features = (
50 CoverEntityFeature.OPEN
51 | CoverEntityFeature.CLOSE
52 | CoverEntityFeature.STOP
53 | CoverEntityFeature.SET_POSITION
55 _attr_configuration_url = CONF_URL_CONTROL
56 _attr_device_class = CoverDeviceClass.SHUTTER
58 device: NaModules.Shutter
60 def __init__(self, netatmo_device: NetatmoDevice) ->
None:
61 """Initialize the Netatmo device."""
67 self._publishers.extend(
71 "home_id": self.
homehome.entity_id,
76 self.
_attr_unique_id_attr_unique_id = f
"{self.device.entity_id}-{self.device_type}"
79 """Close the cover."""
80 await self.
devicedevice.async_close()
86 await self.
devicedevice.async_open()
95 """Move the cover shutter to a specific position."""
96 await self.
devicedevice.async_set_target_position(kwargs[ATTR_POSITION])
100 """Update the entity's state."""
None async_set_cover_position(self, **Any kwargs)
None async_open_cover(self, **Any kwargs)
_attr_current_cover_position
None __init__(self, NetatmoDevice netatmo_device)
None async_update_callback(self)
None async_stop_cover(self, **Any kwargs)
None async_close_cover(self, **Any kwargs)
None async_write_ha_state(self)
None async_stop(HomeAssistant hass)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)