1 """Support for button entity in wake on lan."""
3 from __future__
import annotations
5 from functools
import partial
18 _LOGGER = logging.getLogger(__name__)
24 async_add_entities: AddEntitiesCallback,
26 """Set up the Wake on LAN button entry."""
27 broadcast_address: str |
None = entry.options.get(CONF_BROADCAST_ADDRESS)
28 broadcast_port: int |
None = entry.options.get(CONF_BROADCAST_PORT)
29 mac_address: str = entry.options[CONF_MAC]
30 name: str = entry.title
45 """Representation of a wake on lan button."""
53 broadcast_address: str |
None,
54 broadcast_port: int |
None,
56 """Initialize the WOL button."""
62 connections={(dr.CONNECTION_NETWORK_MAC, self.
_attr_unique_id_attr_unique_id)},
67 """Press the button."""
68 service_kwargs: dict[str, Any] = {}
75 "Send magic packet to mac %s (broadcast: %s, port: %s)",
81 await self.
hasshass.async_add_executor_job(
82 partial(wakeonlan.send_magic_packet, self.
_mac_address_mac_address, **service_kwargs)