-
|
This is a write up based on a conversation between devs working on HA bluetooth. In particular, the idea i'm presenting here is largely just copy/pasting @balloob. See home-assistant/core#77284 for more context. Sometimes we end up with multiple ways to support the same device. A recent example of this is AirThings, where we currently support cloud access but recently work was done to enable local access to these devices over Bluetooth. Accepting the new integration into core would be great but it is challenging because currently HA has a rule of 1 integration per brand. Having multiple integrations here gives the users a choice and then punts it to them completely, and gives them no help to make a choice. It is a bad user experience. To accept Airthings BLE as our policies stand, we would have to ask the PR author to instead merge the code into the main Airthings integration. These integrations may share no code, and some of us have concerns about violating normal HA design principles like seperation of concerns as well as this exposing edge cases in other tooling, processes, etc (e.g. Another option could be extra metadata in the manifest.json to allow HA to group integrations together itself. This would be kind of like "reverse So even though there was an "airthings" and "airthings_ble" the user flows would look more like this: CleanShot_2022-08-29_at_16.14.00.movWe could streamline this and make Home Assistant aware of how a device was supported and what the system was capable of. For example, don't offer bluetooth integrations if there are no bluetooth adapters. Or the choice could be visible but greyed out so that the user understands they could have completely local access, but they don't currently meet the requirements. HA could build the user experience for this choice from manifest metadata. And we could potentially do some interesting things to help guide them. For example, we could potentially show "traffic lights" or green ticks against the choices - "Local Access", "Supports Push", etc. HomeKit controller could participate in this in the future, but it is considered out of scope for now. (In theory we can learn that it is an |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
|
Could this approach potentially retrospectively "merge" cases where the rule was violated (i.e. some or all of the Xiaomi integrations) (this would be hard currently because there are already mulitple domains in live production HA instances around the world). |
Beta Was this translation helpful? Give feedback.
-
|
Thinking about solar inverters there could even be a one-to-many relationship. Most solar inverters seem to have their proprietary local or cloud API. Then there is the SunSpec specifications some manufacturers support via ModbusTCP. There is a SunSpec custom component which could probably be used for multiple different inverters alike that have their own Http API integration. Probably the same will be true for Matter soon 😀 |
Beta Was this translation helpful? Give feedback.
-
|
I guess I like this idea. Not only does it make code easier, it also helps with tagging code owners, tracking issues/PRs and integration services can target only the ones that are supported. However, it's implementation is important that the user still experiences it as a single brand in the frontend. I don't think groups should be used if it is the same API but a different version. Groups should be used when the APIs are different at it's core, ie cloud HTTP/local HTTP/BLE. For example the Hue API should not be 2 integrations as both the v1 and v2 APIs are served over local HTTP. Example manifest for Airthings:
Core will generate a file to easily transfer groups to the frontend, like we do for config entries etc. The impact of this is purely in the frontend/docs. The backend would keep the integrations separately. Integration tabConfig entries belonging to different integrations in a same group will also be grouped on this page. Just like multiple entries of a single integration are grouped (ie esphome). Integration tab -> add integrationThe integration picker will show a single entry based on the logo/name of the main integration. Once selected, a dialog will be prompted to allow the user to choose. We can, but not for MVP, introduce some smartness where we disable an option if it relies on Bluetooth and no Bluetooth adapters are available. Experience similar to the video of Awair above. Device info and other places where we render logoBrand logos will be configured with a symlink to the main integration (docs). That way we can just use the normal logo/icon URL logic. DocumentationEach integration can still have it's own documentation page as it can come with different features. |
Beta Was this translation helpful? Give feedback.
-
|
I've written up my thoughts with a more extended proposal https://docs.google.com/document/d/1990CZGDDLnYPcCHVuspwwCvgOJsHXAmr-19gWWW635w/edit?usp=sharing |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Longtime HA user (and new Airthings device owner) here; I found this through a rabbit hole starting at the Airthings BLE pull request. I hope it's not a faux pas to 'cannonball into the pool' here with my first-ever outreach to your dev community. My question: I see the note that "We want [users] to control their devices locally" in that proposal doc. If a 'primary' integration (the first one created for a given vendor's products) is cloud-based — but then a local option comes along — would there eventually be a world where you'd want to switch which integration had the primary role? So that after a certain HA release, new users would get steered to the local integration by default? If so, I think at some point it'd be worth considering how to swap which integration has the "primary" label — and what an upgrade path looks like for users on the soon-to-be-relegated variant. (This is front of mind for me after the big advancement of "repairs" in 2022.8; this seems like a prime candidate for that kind of hand-holding guidance.) Hope that question is useful. I'm a big fan of this proposal. I think it'll help greatly if any other primarily cloud-controlled device makers expand into local control options in the future. (Looking at Nest Protect, if I'm hoping for the moon.) |
Beta Was this translation helpful? Give feedback.
I guess
groupwould be a better key thanalternative_to. The value ofgroupis the "main" integration whose brand icon needs to be used.I like this idea. Not only does it make code easier, it also helps with tagging code owners, tracking issues/PRs and integration services can target only the ones that are supported. However, it's implementation is important that the user still experiences it as a single brand in the frontend.
I don't think groups should be used if it is the same API but a different version. Groups should be used when the APIs are different at it's core, ie cloud HTTP/local HTTP/BLE. For example the Hue API should not be 2 integrations as both the v1 and v2 APIs are serv…