-
Notifications
You must be signed in to change notification settings - Fork 147
Pass the device name without mapping to the component #184
Pass the device name without mapping to the component #184
Conversation
Is there a need to be so specific when matching for type? I think I would simply merge all those different versions into one, if there's no specific reason for that. Or more broadly, is it even necessary to have this type information available at all? |
The type will be important some day because every ceiling lamp has different features for example. But you are right... we shouldn't map the device type here. The full name should be passed to the component. |
This PR will change the entity id of discovered yeelights: We could introduce some legacy handling. Suggestions? |
netdisco/discoverables/yeelight.py
Outdated
@@ -30,11 +31,12 @@ def info_from_entry(self, entry): | |||
elif entry.name.startswith("yeelink-light-ceiling2_"): | |||
device_type = "ceiling2" | |||
else: | |||
logging.warning("Unknown miio device found: %s", entry) | |||
device_type = \ | |||
entry.name.replace(DEVICE_NAME_PREFIX, '').rsplit('_', 1)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldn't we always do this? It seems unnecessary for us to make up our own device types instead of using the ones provided by Yeelink.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device_type
is part of the entity id if the device is auto-discovered. The old mapping provides stable entity ids.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the previous mapping would be a breaking change for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will only be a breaking change if not resolved in Home Assistant. I think that it is weird that a discovery library is introducing their own names for types. We should follow the vendor types.
I've removed the mapping and will introduce it at Home Assistant. |
No description provided.