dresden-elektronik / openthread-r21

OpenThread Border Router for R21 based ConBee II and RaspBee II
BSD 3-Clause "New" or "Revised" License
35 stars 0 forks source link

[REQUEST] Out-of-the-box support for Home Assistant Add-on: OpenThread Border Router Add-on #1

Open Hedda opened 1 year ago

Hedda commented 1 year ago

Suggest that you look into adding out-of-the-box support Home Assistant Add-on: OpenThread Border Router Add-on:

https://github.com/home-assistant/addons-development/tree/master/openthread_border_router

Home Assistant depends on that addon for its Matter (formerly "Project CHIP") integration when devices use Thread, and the idea is that users should be able to use other OTBR adapters than the official Home Assistant SkyConnect USB adapter than was recently made available:

https://www.home-assistant.io/integrations/matter/

https://community.home-assistant.io/t/chip-matter-support-including-thread/305633

As well see the related discussion here about support for other OTBR adapters than their official Home Assistant SkyConnect adapter:

https://github.com/home-assistant/addons-development/issues/38

There are also some indirect discussions about Thread radio hardware adapter compatibility here:

https://github.com/zigpy/zigpy/discussions/894

PPS: Also recommend follow its developer (@agners) development on GitHub + his posts on Twitter + activity on HA community forums:

https://community.home-assistant.io/u/agners/activity

https://github.com/agners

https://twitter.com/falstaff_ch

Haerteleric commented 1 year ago

Hi Hedda,

Thank you for your feedback. Out of the Box support for Home-Assistant ist the main goal of this project. AFAIK Home-Assistant didn't make any major changes to the Openthread-Border-Router-Daemon so once the Firmware is ready it should seamlessly work with the Home Assistant Integrations. I will validate that in the coming days.

Also thanks for the redirects, i found a lot of things to consider in the posts you linked!

Hedda commented 1 year ago

Want to raise a slightly off-topic related feature in Home Assistant OS to consider, especially when releasing future USB adapters;

FYI, for enhanced out-of-the-box user experience when using the same radio USB dongle with different types of firmware images (e.g. pure Zigbee NCP firmware image versus OpenThread RCP firmware image) in Home Assistant you should also keep in mind that "Home Assistant Operating System" (appliance OS distribution) + integrations can and do support a feature for "USB discovery" which has white-listings for some USB dongles which it then can discover and recommend to the end-user which integration(s) which that specific USB dongle is compatible with (and thus offer an easy option for end-users to quick start setup of the installation config flow for compatible integration).

So far it supports detecting newly connected USB devices and showing up in the discovered section on the integrations page in the configuration panel, and today it already does that for the native ZHA (Zigbee Home Automation) integration and the Z-Wave integration, so I would suspect that the same "USB discovery" feature will also be used for OpenThread USB radio dongles.

ConBee II is one of those USB dongles that is already whitelisted for the ZHA integration so suspect that from an end user's point-of-view that might conflict in the future if it is instead flashed with OpenThread firmware and want to use Thread for Matter(?).

https://www.home-assistant.io/blog/2021/09/01/release-20219/#usb-discovery

https://www.home-assistant.io/integrations/usb/

https://community.home-assistant.io/t/community-help-wanted-to-whitelist-all-compatible-zigbee-and-z-wave-usb-adapters-for-automatic-discovery-in-home-assistant-os/344412

https://www.home-assistant.io/integrations/zha/#discovery-via-usb-or-zeroconf

https://www.home-assistant.io/integrations/zwave_js/#discovery-via-usb

Haerteleric commented 1 year ago

Thanks for pointing that out, i wasn't aware of this. Coincidentally we are using a different USB-Stack in this Firmware, compared to the DeCONZ-Firmware. Because of that the Conbee on Thread Firmware gets a different USB-Device ID than on the DeCONZ-firmware.

ConBee on Deconz (ASF-USB): 1fc1:0030 ConBee on Thread-RCP (Tiny-USB): 1fc1:0032

So i guess this shouldn't be an issue

Hedda commented 1 year ago

Coincidentally we are using a different USB-Stack in this Firmware, compared to the DeCONZ-Firmware. Because of that the Conbee on Thread Firmware gets a different USB-Device ID than on the DeCONZ-firmware.

ConBee on Deconz (ASF-USB): 1fc1:0030 ConBee on Thread-RCP (Tiny-USB): 1fc1:0032

So i guess this shouldn't be an issue

It does not matter if VID and PID is the same or not for USB as long as the USB "Product Description String" field value for the device is different, (VID and PID alone in combunation are normally not enough to be sure it is a unique product, as usually also need "description" as well).

That is, the USB discovery feature uses a combination of VID/PID + "description" to identify the device it as a unique product.

In the end is actually the "Product Description String" field value that is the most important of those as other devices from others can use the same VID and PID if the manufacturer does not pay for unique USB ID but instead just uses the default from the USB-to-seriel convrter vendor, just as as long as the "Product Description String" field value is changed to something unqiue then the VID or PID does not need to be unqiue.

So the key thing to remember is to add a unqieue "description" for USB:

https://community.home-assistant.io/t/unique-friendly-name-description-for-automatic-zigbee-usb-adapter-discovery-in-home-assistant-zha-using-dongle-vendor-product-ids/337077

See manifest for ZHA:

https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/manifest.json

Also check out this pull request example for adding a unique USB device product for ZHA (Zigbee):

https://github.com/home-assistant/core/pull/56201

Hedda commented 1 year ago

Not sure if this "matter" will be the correct component / domain which will need to use USB discovery for quick start setup to initiate the installation config flow for Matter over Thread using an OTBR (OpenThread Border Router) radio USB dongles(?):

https://github.com/home-assistant/core/blob/dev/homeassistant/components/matter/manifest.json

If so then you/they will add "usb" to that component's manifest in Home Assistant for USB discovery, similar to the ZHA manifest:

https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/manifest.json