1 """Support for Tasmota switches."""
5 from hatasmota
import relay
as tasmota_relay
6 from hatasmota.entity
import TasmotaEntity
as HATasmotaEntity
7 from hatasmota.models
import DiscoveryHashType
16 from .const
import DATA_REMOVE_DISCOVER_COMPONENT
17 from .discovery
import TASMOTA_DISCOVERY_ENTITY_NEW
18 from .entity
import TasmotaAvailability, TasmotaDiscoveryUpdate, TasmotaOnOffEntity
23 config_entry: ConfigEntry,
24 async_add_entities: AddEntitiesCallback,
26 """Set up Tasmota switch dynamically through discovery."""
30 tasmota_entity: HATasmotaEntity, discovery_hash: DiscoveryHashType
32 """Discover and add a Tasmota switch."""
36 tasmota_entity=tasmota_entity, discovery_hash=discovery_hash
41 hass.data[DATA_REMOVE_DISCOVER_COMPONENT.format(switch.DOMAIN)] = (
44 TASMOTA_DISCOVERY_ENTITY_NEW.format(switch.DOMAIN),
52 TasmotaDiscoveryUpdate,
56 """Representation of a Tasmota switch."""
58 _tasmota_entity: tasmota_relay.TasmotaRelay
61 """Turn the device on."""
65 """Turn the device off."""
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_discover(DiscoveryInfo discovery_info)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)