1 """Support for Netatmo/BTicino/Legrande switches."""
3 from __future__
import annotations
8 from pyatmo
import modules
as NaModules
16 from .const
import CONF_URL_CONTROL, NETATMO_CREATE_SWITCH
17 from .data_handler
import HOME, SIGNAL_NAME, NetatmoDevice
18 from .entity
import NetatmoModuleEntity
20 _LOGGER = logging.getLogger(__name__)
26 async_add_entities: AddEntitiesCallback,
28 """Set up the Netatmo switch platform."""
31 def _create_entity(netatmo_device: NetatmoDevice) ->
None:
33 _LOGGER.debug(
"Adding switch %s", entity)
36 entry.async_on_unload(
42 """Representation of a Netatmo switch device."""
45 _attr_configuration_url = CONF_URL_CONTROL
46 device: NaModules.Switch
50 netatmo_device: NetatmoDevice,
52 """Initialize the Netatmo device."""
55 self._publishers.extend(
59 "home_id": self.
homehome.entity_id,
64 self.
_attr_unique_id_attr_unique_id = f
"{self.device.entity_id}-{self.device_type}"
69 """Update the entity's state."""
73 """Turn the zone on."""
74 await self.
devicedevice.async_on()
79 """Turn the zone off."""
80 await self.
devicedevice.async_off()
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None __init__(self, NetatmoDevice netatmo_device)
None async_update_callback(self)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)