Julius2342 / pyvlx

PyVLX - controling VELUX windows with Python via KLF 200
GNU Lesser General Public License v3.0
74 stars 26 forks source link

Issue #338: Remove assert for serial number #354

Closed Julius2342 closed 8 months ago

palfrey commented 9 months ago

Note the mypy failures in the build. If you're going to do this, Node will have to accept None as a serial number, and then you can do all the others.

Julius2342 commented 9 months ago

Hrmm :)

Do you think we should introduce a SerialNumber object? Or is this sledgehammer -> walnut?

pawlizio commented 9 months ago

To pass mypy should be engough to change the type hints at all serial_number declarations to Optional[str]. serial_number: Optional[str],

I know this serial_number is like kind of unique_ID intention at HA.

However consider the following statement from here: An entity is looked up in the registry based on a combination of the platform type (e.g., light), and the integration name (domain) (e.g. hue) and the unique ID of the entity. Entities should not include the domain (e.g., your_integration) and platform type (e.g., light) in their Unique ID as the system already accounts for these identifiers.

In HA there are a lot of features in the UI requiring a unique ID, like set a friendly name. Due to the fact that KLF200 does not provide this information for Somfy devices for example, only empty bytes are sent here, you would not be able to use that features if you link that unique_ID to serial_number.

Therefore for HA, considering the above statement, that unique ID is looked up in the registry based on a combination of domain (velux), for pyvlx we can use node_id as unique_ID and I do so with my custom without any issue so far..

This can be combined with a check if serial_number not None, then...