Skip to content
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

Merged
merged 7 commits into from May 22, 2020
Merged

Conversation

Julius2342
Copy link
Owner

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?

@coveralls
Copy link

coveralls commented May 17, 2020

Coverage Status

Coverage increased (+0.2%) to 81.814% when pulling bf551a6 on serial-number-none into eb28f3b on master.

@pawlizio
Copy link
Collaborator

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.

@Julius2342
Copy link
Owner Author

Yes, return None if there is an empty serial number submitted is reasonable!

Do we have to change something in HA then?

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.

Is this an appropriate approach for HASS? My idea of a "unique" identifier would be that it is globally unique.

@pawlizio
Copy link
Collaborator

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)

@Julius2342 Julius2342 merged commit 5fdf74b into master May 22, 2020
@Julius2342 Julius2342 deleted the serial-number-none branch May 22, 2020 09:00
@DCEM
Copy link

DCEM commented Sep 2, 2022

Hi,
returning None results in beeing unable to assign them to a room in HA. 66262

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

@pawlizio
Copy link
Collaborator

pawlizio commented Sep 5, 2022

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.

@DCEM
Copy link

DCEM commented Sep 6, 2022

Thank you for your replay.
That you are using a custom integration seems to confirm that there is an issue that could be solved by returning something different then None.
If this solution is not "the ideal way" maybe it would be acceptable do enable such a behaviour in the yaml until the underlying issue in HA is fixed?

Something like:
velux:
host:
password: !secret velux_password
use_name_as_unique_id_if_no_serial: True

@pawlizio
Copy link
Collaborator

pawlizio commented Sep 6, 2022

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

@DCEM
Copy link

DCEM commented Sep 6, 2022

Thank you for the clarification, I agree with your point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants