1 """Support for VeSync switches."""
12 from .const
import DEV_TYPE_TO_HA, DOMAIN, VS_DISCOVERY, VS_SWITCHES
13 from .entity
import VeSyncDevice
15 _LOGGER = logging.getLogger(__name__)
20 config_entry: ConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Set up switches."""
27 """Add new devices to platform."""
30 config_entry.async_on_unload(
39 """Check if device is online and add entity."""
42 if DEV_TYPE_TO_HA.get(dev.device_type) ==
"outlet":
44 elif DEV_TYPE_TO_HA.get(dev.device_type) ==
"switch":
48 "%s - Unknown device type - %s", dev.device_name, dev.device_type
56 """Base class for VeSync switch Device Representations."""
61 """Turn the device on."""
66 """Representation of a VeSync switch."""
69 """Initialize the VeSync switch device."""
74 """Update outlet details and energy usage."""
80 """Handle representation of VeSync Light Switch."""
83 """Initialize Light Switch device class."""
None turn_on(self, **Any kwargs)
def __init__(self, switch)
list[tuple[str, int]] discover(HomeAssistant hass)
def update_energy(device)
def _setup_entities(devices, async_add_entities)
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)