1 """Demo platform that has some fake switches."""
3 from __future__
import annotations
14 from .device
import async_create_device
19 config_entry: ConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Set up the demo switch platform."""
25 config_entry.entry_id,
28 {
"number_of_sockets":
"2"},
36 device_name=
"Outlet 1",
40 via_device=
"2_ch_power_strip",
44 device_name=
"Outlet 2",
48 via_device=
"2_ch_power_strip",
55 """Representation of a demo switch."""
57 _attr_has_entity_name =
True
58 _attr_should_poll =
False
65 entity_name: str |
None,
68 translation_key: str |
None =
None,
69 device_class: SwitchDeviceClass |
None =
None,
70 via_device: str |
None =
None,
72 """Initialize the Demo switch."""
79 identifiers={(DOMAIN, unique_id)},
87 """Turn the switch on."""
92 """Turn the device off."""
None turn_off(self, **Any kwargs)
None turn_on(self, **Any kwargs)
None __init__(self, *str unique_id, str device_name, str|None entity_name, bool state, bool assumed, str|None translation_key=None, SwitchDeviceClass|None device_class=None, str|None via_device=None)
None schedule_update_ha_state(self, bool force_refresh=False)
dr.DeviceEntry async_create_device(HomeAssistant hass, str config_entry_id, str|None device_name, str|None device_translation_key, dict[str, str]|None device_translation_placeholders, str unique_id)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)