Teach Device Registry about primary and secondary config entries #936
-
ContextWhen we added the device registry, we added the notion that a device can be linked to multiple entities, and that those entities don't need to be all of the same config entry. Image from device registry docs The reason why a device can be linked to multiple config entries is because we have integrations that:
We store all config entries in a set, so we do not know which config entry is the primary responsible for this entity. ProposalThis proposal aims to change this and allow a device entry to know which config entry is responsible. To identify if an integration is primary or not, we can use the device info. I've identified 3 types of device info that we receive. I've opened home-assistant/core#95641 to enforce those 3 types and only needed to fix 6 integrations that were using the wrong keys. The 3 types are:
Once we can identify the 3 types, we can automatically organize primary and secondary config entries:
This logic can either live in ConsequencesThis allows us to:
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
Right now |
Beta Was this translation helpful? Give feedback.
-
@balloob correct me if I'm misunderstanding, but this would only guarantee that the "primary" integration icon is shown if it exists in the set, and it doesn't necessarily have to depending on the config. Moreover, I don't think the primary integration icon is always the "right" one. I think the icon issue is one of cognitive UX/a11y, and I did my best to voice this when they were introduced in home-assistant/frontend#14184. My point there was that users will expect the icon next to the device name in a device table to identify the device in some way, not the integration. The multiple duplicate issues filed by users all verify that expectation. For example, I have a Honeywell thermostat connected via Homekit controller and Zooz switches connected via ZWave. Under this proposal, I think I would still see Homekit and ZWave icons, but the user expectation from a cognitive perspective is to see Honeywell and Zooz icons (or something else like a thumbnail of the device). |
Beta Was this translation helpful? Give feedback.
-
Under this proposal, we would know the primary integration, which presumably identifies the manufacturer. It would then be simple to show the manufacturer logo if it exists and fallback to the integration otherwise without any extra magic. No? I guess as a follow up unrelated to icons, what would happen if I integrate my Honeywell thermostat both with Homekit controller and the Honeywell integration? Multiple primaries? First one wins? |
Beta Was this translation helpful? Give feedback.
-
I created the PR home-assistant/developers.home-assistant#1858 including in the developer documentation what was implemented in home-assistant/core#95641. |
Beta Was this translation helpful? Give feedback.
-
Hey @balloob, how is the category expected for tracker devices that use I think it must be a link due to the implementations of home-assistant/core#63328, as it would only be created if there is another device with the same MAC address. An example is the Unifi Network integration that still has the frontend display problem due to the current category being primary. I think that after this definition here, it would be good to include the information in the developer documentation for the device tacker entity. |
Beta Was this translation helpful? Give feedback.
-
Not sure, if that would be appropriate, but wouldn't it be relatively easy enable users to select the "primary integration" manually? For me it would be sufficient to have an option on the Device Info Card to be able to select the primary integration for the device from the list of integrations that are already displayed. This could also be an option, when a more elaborate solution fails due to some edge case. |
Beta Was this translation helpful? Give feedback.
-
Am i wrong, or is this already full filled since 2023.8 (which includes home-assistant/core#95641)? 🤔 |
Beta Was this translation helpful? Give feedback.
Am i wrong, or is this already full filled since 2023.8 (which includes home-assistant/core#95641)? 🤔