-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle devices without serial numbers. #42
Conversation
Yes, return None if there is an empty serial number submitted is reasonable! In HA {domain}-{node.node_id} could be used as unique_id if None is returned. The benefit of a unique_id is, that you can change i.e. friendly-name in HA. |
Do we have to change something in HA then?
Is this an appropriate approach for HASS? My idea of a "unique" identifier would be that it is globally unique. |
You are right, my approach contradicts HA principles. Would be good to integrate a config flow on HA integration, so that the config entity ID could be used if None is returned from pyvlx, see home-assistant/architecture#333 (comment) |
Hi, Could it be reasonable to return the name instead? if self.node.serial_number:
return self.node.serial_number
else:
if self.node.name:
return self.node.name
else:
return "velux_#" + str(self.node.node_id) instead of HA_Velux_unique_id |
I think it is ok if pyvlx provide None in case there is s no useful unique ID. The solution could be realized on HA component implementation, where the config flow can be used to assign a unique ID. Actually my custom integration uses just the nodeID as uniqueID which has not caused any user issue so far. Of course if you use the same device with different integrations such as Tahoma, Somfy or Velux in parallel, it would be good if there would be real a unique ID. |
Thank you for your replay. Something like: |
Finally I think that pyvlx implementation is fine by providing "serial_number = None" if there is no usefull serial number. The caption should be done on HA velux component side, not pyvlx side, means here.. |
Thank you for the clarification, I agree with your point. |
Background
Looks like some devices don't report Serial numbers. This should be handled within HASS correctly.
@tschamm @pawlizio : Just an idea, what do you think?