Add unique id's to Vallox entities (#58459)

* Add unique id's to Vallox entities

* Cache uuid properties

Requested in code review.

Caching None isn't a problem as the underlying implementation of get_uuid
in the vallox_websocket_api library can never return None.

* Simplify get_uuid type check

Based on review comments.

* Set _attr_unique_id in init

* Import the library get_uuid under a different name

There are a few options here:

1. Rename the get_uuid method with a synonym
2. Import get_uuid under a different name
3. Convert get_uuid into a property
4. Rename get_uuid in the Vallox library

None of these options is that appealing. I'll start with option two,
anyways.
This commit is contained in:
Arto Jantunen 2021-11-15 18:28:19 +02:00 committed by GitHub
parent a4208c0926
commit 5cc594682f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -99,6 +99,8 @@ class ValloxFan(CoordinatorEntity, FanEntity):
self._attr_name = name
self._attr_unique_id = str(self.coordinator.data.get_uuid())
@property
def supported_features(self) -> int:
"""Flag supported features."""