1 """Demo platform that offers a fake button entity."""
3 from __future__
import annotations
17 config_entry: ConfigEntry,
18 async_add_entities: AddEntitiesCallback,
20 """Set up the demo button platform."""
24 unique_id=
"2_ch_power_strip",
26 device_translation_key=
"n_ch_power_strip",
27 device_translation_placeholders={
"number_of_sockets":
"2"},
28 entity_name=
"Restart",
35 """Representation of a demo button entity."""
37 _attr_has_entity_name =
True
38 _attr_should_poll =
False
43 device_name: str |
None,
44 device_translation_key: str |
None,
45 device_translation_placeholders: dict[str, str] |
None,
46 entity_name: str |
None,
48 """Initialize the Demo button entity."""
51 identifiers={(DOMAIN, unique_id)},
53 translation_key=device_translation_key,
54 translation_placeholders=device_translation_placeholders,
59 """Send out a persistent notification."""
60 persistent_notification.async_create(
61 self.
hasshass,
"Button pressed", title=
"Button"
63 self.
hasshass.bus.async_fire(
"demo_button_pressed")