1 """Support for EufyHome switches."""
3 from __future__
import annotations
18 add_entities: AddEntitiesCallback,
19 discovery_info: DiscoveryInfoType |
None =
None,
21 """Set up EufyHome switches."""
22 if discovery_info
is None:
28 """Representation of a EufyHome switch."""
31 """Initialize the light."""
34 self.
_name_name = device[
"name"]
36 self.
_code_code = device[
"code"]
37 self.
_type_type = device[
"type"]
42 """Synchronise state from the switch."""
48 """Return the ID of this light."""
53 """Return the name of the device if any."""
54 return self.
_name_name
58 """Return true if device is on."""
62 """Turn the specified switch on."""
64 self.
_switch_switch.set_state(
True)
65 except BrokenPipeError:
67 self.
_switch_switch.set_state(power=
True)
70 """Turn the specified switch off."""
72 self.
_switch_switch.set_state(
False)
73 except BrokenPipeError:
75 self.
_switch_switch.set_state(
False)
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
def __init__(self, device)
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)