mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use shorthand attributes in hlk_sw16 (#99383)
This commit is contained in:
parent
26b1222fae
commit
9e9aa163f7
@ -147,12 +147,8 @@ class SW16Device(Entity):
|
|||||||
self._device_port = device_port
|
self._device_port = device_port
|
||||||
self._is_on = None
|
self._is_on = None
|
||||||
self._client = client
|
self._client = client
|
||||||
self._name = device_port
|
self._attr_name = device_port
|
||||||
|
self._attr_unique_id = f"{self._entry_id}_{self._device_port}"
|
||||||
@property
|
|
||||||
def unique_id(self):
|
|
||||||
"""Return a unique ID."""
|
|
||||||
return f"{self._entry_id}_{self._device_port}"
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def handle_event_callback(self, event):
|
def handle_event_callback(self, event):
|
||||||
@ -161,11 +157,6 @@ class SW16Device(Entity):
|
|||||||
self._is_on = event
|
self._is_on = event
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return a name for the device."""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
"""Return True if entity is available."""
|
"""Return True if entity is available."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user