Use shorthand attributes in hlk_sw16 (#99383)
This commit is contained in:
parent
26b1222fae
commit
9e9aa163f7
1 changed files with 2 additions and 11 deletions
|
@ -147,12 +147,8 @@ class SW16Device(Entity):
|
|||
self._device_port = device_port
|
||||
self._is_on = None
|
||||
self._client = client
|
||||
self._name = device_port
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique ID."""
|
||||
return f"{self._entry_id}_{self._device_port}"
|
||||
self._attr_name = device_port
|
||||
self._attr_unique_id = f"{self._entry_id}_{self._device_port}"
|
||||
|
||||
@callback
|
||||
def handle_event_callback(self, event):
|
||||
|
@ -161,11 +157,6 @@ class SW16Device(Entity):
|
|||
self._is_on = event
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return a name for the device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return True if entity is available."""
|
||||
|
|
Loading…
Add table
Reference in a new issue