Simplify unique ID handling in Plugwise (#65839)

This commit is contained in:
Franck Nijhof 2022-02-05 23:59:37 +01:00 committed by GitHub
parent acb7e24852
commit a6e36a6eb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 16 deletions

View file

@ -92,6 +92,7 @@ class SmileBinarySensor(PlugwiseEntity, BinarySensorEntity):
super().__init__(api, coordinator, name, dev_id)
self._binary_sensor = binary_sensor
self._attr_is_on = False
self._attr_unique_id = f"{dev_id}-{binary_sensor}"
if dev_id == self._api.heater_id:
self._entity_name = "Auxiliary"
@ -102,8 +103,6 @@ class SmileBinarySensor(PlugwiseEntity, BinarySensorEntity):
if dev_id == self._api.gateway_id:
self._entity_name = f"Smile {self._entity_name}"
self._unique_id = f"{dev_id}-{binary_sensor}"
@callback
def _async_process_data(self) -> None:
"""Update the entity."""