Use shorthand attributes in hlk_sw16 (#99383)

This commit is contained in:
Joost Lekkerkerker 2023-09-02 16:42:32 +02:00 committed by GitHub
parent 26b1222fae
commit 9e9aa163f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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."""