mirror of
https://github.com/home-assistant/core
synced 2024-09-28 03:04:04 +02:00
Add unique_id to WOL integration (#49604)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
a7393cd8b4
commit
41d6d64ca4
@ -14,6 +14,7 @@ from homeassistant.const import (
|
||||
CONF_MAC,
|
||||
CONF_NAME,
|
||||
)
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.script import Script
|
||||
|
||||
@ -87,6 +88,7 @@ class WolSwitch(SwitchEntity):
|
||||
)
|
||||
self._state = False
|
||||
self._assumed_state = host is None
|
||||
self._unique_id = dr.format_mac(mac_address)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
@ -108,6 +110,11 @@ class WolSwitch(SwitchEntity):
|
||||
"""Return false if assumed state is true."""
|
||||
return not self._assumed_state
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the unique id of this switch."""
|
||||
return self._unique_id
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the device on."""
|
||||
service_kwargs = {}
|
||||
|
Loading…
Reference in New Issue
Block a user