The connections attribute of devices
#1113
Replies: 2 comments 6 replies
-
|
I don't have a very strong opinion/good idea, but here are some thoughts from my side:
The connection types are largely physical addresses of network interfaces (cable or radio). From how I understand the connection property is meant to reflect physical connectivity between devices. For hard-wired network this works obviously quite well, as these connections are rather static. For Zigbee it's a bit more tricky. Technically, the connection could really represent the mesh. But this likely changes constantly. I guess this is more logically used: All Zigbee devices are part of a network connected through a single controller. So this can be seen as the logical "next hop" in the connection. For wireless devices it gets a bit more tricky, especially if there are multiple WiFi access points/Thread border router: Which WiFi AP/Thread border router is a wireless end device associated with? Furthermore with Thread there is also the discussion above, should the mesh be represented in the connection? Anyhow, I probably overthink this. The question really becomes what the goal of tracking this connections is exactly.
So this is kinda an interesting observation: If it is mainly about identification of a device, why do we even have connection tuples? We could just identify devices based on MAC. A device an also have multiple MACs (e.g. if it has wireless and wired connectivity).
In a way, this is an unrelated issue. But yes, I agree, it makes sense to validate these MACs and only accept valid ones 👍 . Furthermore, integrations should also be careful that what they provide are indeed per-device unique MAC addresses. |
Beta Was this translation helpful? Give feedback.
-
Btw, in Thread the EUI-64 is also named extended address (or ExtAddress). However, for privacy reason the physical EUI-64 addresses are typically not used for communication, but just random ones are generated whenever the Thread network is setup/coonfigured.
From this discussion: https://github.com/orgs/openthread/discussions/9979 In general, with Matter/Thread we see a strong push trying to prevent tracking devices across device resets/commissioning instances. This is probably mostly driven by Google/Apple's push to protect users privacy lately. I think it is a good thing, it is just something we need to keep in mind. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
There are four pre-defined connection types in Home Assistant:
mac,zigbee,bluetoothandupnp(see device_registry.py)These connections are used to identify and merge devices across integrations, which is an important usability feature.
Issue 1 - Naming
The naming of the types is misleading.
Connections of type
macandbluetoothexpect 48bit mac addresses.zigbeeexpects a 64bit address.bluetoothandmacare both EUI-48 addresses, they share the same "number space", so there shouldn't be a differentiation between the two. Two integrations that report("mac", "aa:bb:cc:dd:ee:ff")and("bluetooth", "aa:bb:cc:dd:ee:ff")therefore report the same device, the type of interface is irrelevant.zigbeeis an EUI-64 address and is recommended by the IEEE to be used by "new" applications. Most notably, this includes Zigbee and Thread.From Use of EUI-64 for New Designs:
Issue 2 - Normalization & Validation
Of the connection types, only
machas any form of normalization. It turns the formats: xx-xx-xx-xx-xx-xx, xxxx.xxxx.xxxx and xxxxxxxxxxxx) into the form: xx:xx:xx:xx:xx:xx.If the provided address doesn't match any of the format, it gets passed through. The types
bluetoothandzigbeedon't have any normalization. This isn't an issue from an UX standpoint, as it can be expected that a malformed mac address simply won't match. In the worst case, an integration reports a malformed, possibly huge, mac address that bloats the registry and breaks the UI.Other than that there is a slightly more practical issue: Not every address is suitable as an identifier.
Addresses beginning with 00:00:00:xx:xx:xx(:xx:xx) and group addresses (the least significant bit of the first octet = 1) can't be used to identify individual addresses: See
IEEE Guidelines for Use of Extended Unique Identifier (EUI), Organizationally Unique Identifier OUI), and Company ID
(CID)
This became an issue recently, where some Matter devices reported 00:00:00:00:00:00 as their mac address (see home-assistant/core#121257 (comment)).
Proposition
I propose that the addresses should at least be validated to be suitable as identifiers. (see this code review home-assistant/core#121257 (comment)) Especially, NULL and group addresses have the potential to wrongfully merge a lot of devices into one, leading to a horrendous experience.
I haven't opened an issue (or PR) for this, because the merging of devices and inclusion of entities is a large ongoing UX issue. Blog entry for 2024.7 and this related forum post: Why can’t we add template entities to existing devices?.
I wanted to hear more opinions on how this should be handled going forwards.
Beta Was this translation helpful? Give feedback.
All reactions