Could the Home Assistant UI and companion apps support QR code scanning to add new Zigbee 3.0 (ZB3) devices for ‘quick-start’ joining/pairing in ZHA integration component using qr_code
parameter?
Enabling this could allow users to open Home Assistant’s UI or companion app on Android/iOS, scan the QR code of the Zigbee 3.0 device or its box to initiate device joining/pairing in Home Assistant ZHA.
As I understand backend support for “qr_code” and “install_code” is already available Home Assistant core for ZHA integration via a “zha.permit" service which allows nodes to join the Zigbee network.
https://www.home-assistant.io/integrations/zha/
This is a Zigbee feature that is already available in the frontend of a few commercial gateways/hubs.
The QR code tags can be used as IEEE address (as a kind of UUID value) for secured joining/pairing onboarding processes with compatible systems that support this Zigbee 3.0 feature. These QR codes or bar codes should be printed on newer Zigbee 3.0 certified products in order to make adding new devices more user-friendly.
Examples are Samsung SmartThings and Tuya devices:
This Zigbee device QR code for pairing/joining is a ‘newish’ (part of official Zigbee 3.0 specification since 2016) feature that is part of Zigbee 3.0 security model specification which allow users to add devices to their Zigbee network by scanning quick response QR codes (a.k.a. two-dimensional barcodes or 2D barcode) which contains Zigbee installation codes, (sometimes also referred to as “install codes”), which is the devices 64-bit IEEE MAC address (“EUI64”).
Note that this requires a Zigbee 3.0 coordinator hardware + firmware compatible with Home Assistant as well as support for Zigbee 3.0 joining via install codes in the zigpy radio library, which so far is only supported in the bellows and zigpy_znp libraries.
@dmulcahey question was asked in Refactor zha.permit service to allow joining using install codes by Adminiuga · Pull Request #40652 · home-assistant/core · GitHub by @Adminiuga if QR code scanning be embedded into ZHA UI as that pull request also added to Home Assistant core support for qr_code
parameter.
Add extra parameters to allow joining ZB3 devices using install codes. Currently only supported with EZSP based or TI (using zigpy_znp) radios.
Three new parameters were added:
source_ieee
– IEEE of the joining devices, must be used withinstall_code
, can’t be used withqr_code
paraminstall_code
– Install code of the joining device, must be used withsource_ieee
, can’t be used withqr_code
qr_code
– QR Code of the install code, containing IEEE and install code. Can’t be used withsource_ieee
orinstall_code
qr_code
is experimental and since every vendor encodes ieee and install code differently, this would need to be added for every vendor, assuming it can be matched by a regex. Based on a limited samples of QR install codes current attempt is to support the QR codes from the following vendors:
- Aqara
- Bosch
- Consciot
- Embrighten
Proposal
Allow adding Zigbee 3.0 devices by scanning the QR code on the physical device or box it shipped in if it has a QR code.
As an example you can look at the latest Samsung SmartThings app which has added Zigbee QR scanner:
Samsung SmartThings app now has the option to scan several Zigbee 3.0 QR codes to configure multiple devices in a single go.
Consequences
To make this feasible for ZHA, QRcode scanning and new Zigbee device setup would really need to be implemented Home Assistant companion apps for Android and iOS to scan QR codes and sent to ZHA.
The install code must probably be entered into the coordinator before starting the discovery process(?).
If so this would need some kind of collaboration between companion app developers and HA core devs, I assume that a similar effort to how the new tags feature got added to Home Assistant is needed:.
Companion applications for Mac and Windows could also work with this in the future?
Alternatively one would perhaps use web-camera directly to Home Assistant?
This would officially only work with Zigbee 3.0 certified devices, or at least only those are required to support the feature. List here: