Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deconz driver/adapter (for ConBee/RaspBee Zigbee Coordinator) does not support joining/pairing via install code (or qr code) #1184

Open
Hedda opened this issue Sep 12, 2024 · 30 comments

Comments

@Hedda
Copy link
Contributor

Hedda commented Sep 12, 2024

deconz driver/adapter (for ConBee/RaspBee Zigbee Coordinator) does not support joining/pairing via install code (or qr code), but FYI; Dresden-Elektronik developer has now updated the deCONZ Serial Protocol documentation to v1.22 with info on install codes. See:

Originally posted by @manup in dresden-elektronik/deconz-serial-protocol#20 (comment)

Sorry this took a while, I had reworked the document since the former .docx based one was messy to update. The document references are in a bit rough shape but that's for another version. The new version 1.22 has now been uploaded http://deconz.dresden-elektronik.de/raspbian/deCONZ-Serial-Protocol_en_1.22.pdf

There is a new small section 6.2.3 Zigbee Install Codes which describes the basic usage.

As reference how it works in deCONZ the following sources might be helpful as well:

Calculating the derived Link Key from Zigbee Install Code (I think ZHA and Z2M already have similar code):
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/crypto/mmohash.cpp

How the install code is processed by the REST-API and set to the firmware:
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/0e2dc155e85893b439f354cd5d764e414ad0ed0c/rest_devices.cpp#L1090

Originally posted by @manup in dresden-elektronik/deconz-serial-protocol#20 (comment)

6.2.3 Zigbee Install Codes
The Serial Protocol and firmware doesn’t support Zigbee Install Codes directly. In order to join a
device via Install Code, a device specific Link Key needs to be derived from the Install Code by
the host application.
This 16-byte Link Key together with the device MAC address can than be configured by a Write Parameter Request (0×0B) for the Link Key parameter (0×19).
Once configured, during joining process, the device will receive the Network Key encrypted with
the Link Key instead of the global Truster Center Link Key.

A C++ OpenSSL reference implementation for the key derivation can be found at:
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/crypto/mmohash.cpp

@Maginos2210
Copy link

@Hedda: Thank you for the information.
I'm totally new in the field of home automation, so forgive my beginner question:

Is there any guide on what I have to do now to get my Bosch Thermostat 2 working with a conbee II stick?
How can I calculate the Link Key from the file mmohash.cpp? And what do I have to do then?

Thank you for your help.

Maginos

@Hedda
Copy link
Contributor Author

Hedda commented Sep 13, 2024

Is there any guide on what I have to do now to get my Bosch Thermostat 2 working with a conbee II stick?

As long as you using any ConBee adapter then you are out of luck until install codes function is added the deconz driver here. See:

"Support for commissioning Zigbee 3.0 devices via "Install Code" or "QR Code" has so far only been implemented for 'zstack' (Texas Instruments ZNP) and 'ember' (Silicon Labs EmberZNet) adapter type radios in Zigbee2MQTT. Other radio adapter types are either missing support in their respective adapter/driver for zigbee-herdsman or more likely missing in the manufacturer's firmware commands/APIs and documentation."

It means that unless you are a developer that program and can add that feature to the deconz driver/adapter code in zigbee-herdsman then there is nothing you can do as long as you are using a ConBee (or RaspBee) adapter as your Zigbee Coordinator.

So if you are an end-users looking for a work around that today without it being supported in the deconz driver/adapter you have to migrate to either a 'zstack' (Texas Instruments ZNP) or 'ember' (Silicon Labs EmberZNet) adapter, ...but there is a catch with migrations to/from deconz adapters as well because the deconz driver/adapter in zigbee-herdsman (and thus Zigbee2MQTT) does yet not support backup and restore for Zigbee network from or to ConBee/RaspBee, and therefore you currently would need to use an unofficial third-party external tools (like example zigpy-cli) to backup and restore your Zigbee network from ConBee to a Texas Instruments ZNP or Silicon Labs EmberZNet adapter (which is doable but in turn will require you to also re-pair all your devices regardless). Please respect that this is not the place to to discuss such workarounds.

How can I calculate the Link Key from the file mmohash.cpp? And what do I have to do then?

While related I believe that question too is also off-topic here in regards to specifically calculate Link Key for Bosch Thermostat 2 if you are an end-users that is now no longer using the deconz driver/adapter with ConBee/RaspBee as have instead migrated to Texas Instruments ZNP or Silicon Labs EmberZNet adapter. Regardless we do not want to spam this zigbee-herdsman feature request issue with discussions about device specific questions.

Hence, if you are and end-user and go the way of migrating to Texas Instruments ZNP or Silicon Labs EmberZNet adapter and then still need help calculating Link Keys for your Bosch Thermostat 2 devices then please post in the Zigbee2MQTT's discussions instead -> https://github.com/Koenkk/zigbee2mqtt/discussions (or in zigbee-herdsman-converters if related to changing or extending the zigbee-herdsman-converter for that device -> https://github.com/Koenkk/zigbee-herdsman-converters/issues ).

@Maginos2210
Copy link

Thank you @Hedda for your explanations. I ordered a Sonoff zigbee stick with a Texas Instruments chip. With this, it should work. Migration is not needed, since the Bosch thermostat is my first device.

@Hedda
Copy link
Contributor Author

Hedda commented Sep 13, 2024

@ChrisHae @manup @Haerteleric any chance one of you guys would be interested and willing to spare some of your time to take a closer look at this requested feature/function of adding support for "install codes" provisioning in deconz driver (for ConBee/RaspBee Zigbee Coordinator adapters) inside the zigbee-herdsman framework so that Zigbee2MQTT users with ConBee/RaspBee adapters can provision Zigbee devices that require install code or QR code commissioning?

This is needed for feature parity with 'zstack' (Texas Instruments ZNP) or 'ember' (Silicon Labs EmberZNet) adapters which already support this.

PS: While I can only speak for myself, think I can still say that as it stands right now many of us who are a part of the Zigbee2MQTT and overall Zigbee open source projects communities can currently not with good conscience recommend ConBee II / RaspBee II or even the ConBee III to new Zigbee2MQTT end-users as they would not be able to add any Zigbee devices that require install code / QR code for provisioning. 😞

@markusmauch
Copy link

It looks to me as if Dresden Electronik already has implemented Zigbee Install Codes.
Is it realistic to hope to see this implemented for a Conbee II stick and Zigbee2MQTT in the near future?

@Hedda
Copy link
Contributor Author

Hedda commented Nov 8, 2024

It looks to me as if Dresden Electronik already has implemented Zigbee Install Codes.

FYI, it not clear but also sounds as if zigpy/zha developers have implemeneted it too as closed issue -> zigpy/zigpy-deconz#214

Is it realistic to hope to see this implemented for a Conbee II stick and Zigbee2MQTT in the near future?

That depends if Dresden-Elektronik's own developers submit PR for it to zigbee-herdsman or some other volunteering steps-up.

Suggest that you maybe post to ask in their phoscon.de forum at https://forum.phoscon.de/c/general/5 as not been replying here.

@Koenkk
Copy link
Owner

Koenkk commented Nov 24, 2024

@Nerivec added support for this in #1243, neither @Nerivec or me have a device to test this with so would be great if someone can test this. This change will be available in the dev branch after the 1 December release.

@SoftwareSchlosser
Copy link

SoftwareSchlosser commented Dec 1, 2024

Just tried to add a Bosch thermostat (using v1.42.0 and ConBee II) and this is what I get:

z2m: Error: Add install code is not supported
    at DeconzAdapter.addInstallCode (/app/node_modules/zigbee-herdsman/src/adapter/deconz/adapter/deconzAdapter.ts:312:37)
    at Controller.addInstallCode (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:274:28)
    at Zigbee.addInstallCode (/app/lib/zigbee.ts:397:29)
    at Bridge.installCodeAdd (/app/lib/extension/bridge.ts:325:27)
    at Bridge.onMQTTMessage (/app/lib/extension/bridge.ts:200:63)
    at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:211:23)
    at EventEmitter.emit (node:events:529:35)
    at EventBus.emitMQTTMessage (/app/lib/eventBus.ts:144:22)
    at MQTT.onMessage (/app/lib/mqtt.ts:150:27)
    at WebSocket.<anonymous> (/app/lib/extension/frontend.ts:170:27)

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 1, 2024

As Koenkk mentioned, support will be in dev branch. It won't be in release branch until next release (as part of 2.0.0).

@SoftwareSchlosser
Copy link

Sorry, forgot to mention that in fact I'm using the koenkk/zigbee2mqtt:latest-dev docker image.

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 1, 2024

2.0.0 is not yet available in dev branch, have to wait until the release process is over, lots of moving pieces on this one.
Koenkk/zigbee2mqtt#24492

@SoftwareSchlosser
Copy link

OK then I misunderstood this post:

This change will be available in the dev branch after the 1 December release.

Didn't know there is a 2.0.0 dev-branch besides the 1.x dev-branch.
Thank you for clarifying that, I'll just wait then ;)

@Koenkk
Copy link
Owner

Koenkk commented Dec 1, 2024

It's available in the dev branch now.

@SoftwareSchlosser
Copy link

SoftwareSchlosser commented Dec 2, 2024

Thank you :)
Trying to pair a Bosch BTH-RA the install code is now accepted:

[2024-12-02 07:21:16] debug:    z2m:mqtt: Received MQTT message on 'zigbee2mqtt/bridge/request/install_code/add' with data '{"transaction":"ywsnz-4","value":"RB01SG0D83101826480080000000000000000000XXXXXXXXXXXXXXXXDLKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}'
[2024-12-02 07:21:16] info:     zh:controller: Adding install code for 0xXXXXXXXXXXXXXXXX.

However, after that nothing else happens. The device is in pairing mode (also tried to reset it) but it doesn't pair.
Maybe I am missing something?

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 2, 2024

Can you provide the rest of the logs after that, to see what happens exactly?

@SoftwareSchlosser
Copy link

SoftwareSchlosser commented Dec 2, 2024

I didn't see any related log messages this morning but after re-trying it right now I noticed a timeout error after 10s:

[2024-12-02 18:56:47] debug: 	zh:deconz:driver: Timeout for request - CMD: 0xb seqNr: 1
[2024-12-02 18:56:47] error: 	z2m: Request 'zigbee2mqtt/bridge/request/install_code/add' failed with error: 'TIMEOUT'
[2024-12-02 18:56:47] debug: 	z2m: Error: TIMEOUT
    at Driver.processBusyQueue (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:508:28)
    at Timeout._onTimeout (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:160:46)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)
[2024-12-02 18:56:47] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/install_code/add', payload '{"data":{},"error":"TIMEOUT","status":"error","transaction":"md2q6-1"}'

Hard to tell if there's more because there is a lot of traffic on my zigbee network and it's hard to separate what message belongs to which device/event.

Maybe I could create a test-instance with a fresh config for this...

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 2, 2024

Are you seeing this timeout every time? If it didn't work, I'd expect an error response, but not a timeout.

Worth mentioning that deconz's API considers adding install codes as experimental...
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/0e2dc155e85893b439f354cd5d764e414ad0ed0c/rest_devices.cpp#L1088
Not sure how that fares for support on the firmware side...

@Hedda
Copy link
Contributor Author

Hedda commented Dec 3, 2024

Worth mentioning that deconz's API considers adding install codes as experimental...
https://github.com/dresden-elektronik/deconz-rest-plugin/blob/0e2dc155e85893b439f354cd5d764e414ad0ed0c/rest_devices.cpp#L1088
Not sure how that fares for support on the firmware side...

Tip is that @manup have replied to direct questions posted in their repository here -> dresden-elektronik/deconz-serial-protocol#20

@gramels
Copy link

gramels commented Dec 8, 2024

I do get the same errors as @SoftwareSchlosser .
Adding Install Code, then time out.

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 8, 2024

@gramels Are you using a Conbee II also? Can you provide a full debug log from the moment you add the install code, to a few seconds after the timeout? We need to see if there is a special response coming in that isn't currently handled by the driver.

@gramels
Copy link

gramels commented Dec 10, 2024

2024-12-10 11:19:00zh:controller: Adding install code for xxx.
Info 2024-12-10 11:19:08z2m: Successfully added new install code
Info 2024-12-10 11:19:08z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/install_code/add', payload '{"data":{"value":"xxx"},"status":"ok","transaction":"o3hyh-1"}'
Info 2024-12-10 11:19:08z2m: Zigbee: allowing new devices to join.
Info 2024-12-10 11:19:12z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/permit_join', payload '{"data":{"time":254},"status":"ok","transaction":"o3hyh-2"}'

I tried now from remote (without the Bosch TRV in pairing mode) and did not get a time out. So as it appears the time out is a strange response. I use a conbee III (3).

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 10, 2024

We're going to need a full debug log of adding the code + pairing (or timeout) and likely a sniff of the zigbee network to figure out what's going on with the adapter. If someone can provide that, let me know (we can exchange the data in private if preferred).

@gramels
Copy link

gramels commented Dec 10, 2024

I enabled debug on z2m, thats what I got. Where would I enable/ extract the details you need (on hass os)?

@Nerivec
Copy link
Collaborator

Nerivec commented Dec 10, 2024

It does not appear you have enabled debug level from your last logs, this is info level (missing lines like send write parameter request).

https://www.zigbee2mqtt.io/advanced/zigbee/04_sniff_zigbee_traffic.html for details on sniffing (requires a spare adapter to sniff with, easiest currently being EmberZNet-based ones). It's done separately from Z2M/HA, any computer will do.

@gramels
Copy link

gramels commented Dec 10, 2024

no debug messages:
Screenshot 2024-12-10 at 20 40 26

@raoulbhatia
Copy link

I am also trying to add Bosch devices to my z2m installation
but receive z2m: Request 'zigbee2mqtt/bridge/request/install_code/add' failed with error: 'TIMEOUT'

Please let me know if I can provide more details.

Setup

I am using a Home Assistant Green with

  • HAOS, version 14.1
  • HA, version 2024.12.5
  • Mosquitto broker add-on, version: 6.4.1
  • Zigbee2MQTT Edge add-on, version: edge

Zigbee2MQTT

  • Zigbee2MQTT version: 1.42.0-dev commit: 62e18a6
  • Coordinator type: ConBee3
  • Coordinator revision: 0x26530900 (latest version from 11-Jul-2024 from deconz-firmware)
  • zigbee-herdsman-converters version: 21.9.2
  • zigbee-herdsman version: 3.1.1

Logs

  1. I've enabled zh:debug mode
  2. Please note that I am also running a few SNZB-02 devices in this setup
[2024-12-31 10:00:56] debug: 	zh:deconz:frameparser: DEVICE_STATE changed: 101010
[2024-12-31 10:00:56] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:00:56] debug: 	zh:deconz:driver: query aps data indication
[2024-12-31 10:00:56] debug: 	zh:deconz:driver: DATA_INDICATION - sending read data request - SeqNr. 95
[2024-12-31 10:00:56] debug: 	zh:deconz:frameparser: DATA_INDICATION RESPONSE - seqNr. 95 srcAddr: 0xaecc destAddr: 0x0 profile id: 0x104 cluster id: 0x402 lqi: 200
[2024-12-31 10:00:56] debug: 	zh:deconz:frameparser: response payload: 185f0a000029e207
[2024-12-31 10:00:56] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:00:56] debug: 	zh:controller: Received payload: clusterID=1026, address=44748, groupID=0, endpoint=1, destinationEndpoint=1, wasBroadcast=false, linkQuality=200, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":95,"commandIdentifier":10},"payload":[{"attrId":0,"dataType":41,"attrData":2018}],"command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}}
[2024-12-31 10:00:56] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/SNZB-02 1D1F', payload '{"battery":95.5,"humidity":52.29,"linkquality":200,"temperature":20.18,"voltage":2900}'
[2024-12-31 10:00:59] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 96
[2024-12-31 10:00:59] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:00:59] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:04] info: 	zh:controller: Install code was adjusted for reason 'missing CRC'.
[2024-12-31 10:01:04] info: 	zh:controller: Adding install code for 0x000D6F0019933538.
[2024-12-31 10:01:04] debug: 	zh:deconz:driver: send write parameter request from queue. seqNr: 97 paramId: 25 param: 56,53,147,25,0,111,13,0,104,36,80,155,167,113,54,189,19,236,247,91,95,89,131,141
[2024-12-31 10:01:14] debug: 	zh:deconz:driver: Timeout for request - CMD: 0xb seqNr: 97
[2024-12-31 10:01:14] error: 	z2m: Request 'zigbee2mqtt/bridge/request/install_code/add' failed with error: 'TIMEOUT'
[2024-12-31 10:01:14] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/install_code/add', payload '{"data":{},"error":"TIMEOUT","status":"error","transaction":"izmwx-4"}'
[2024-12-31 10:01:14] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 98
[2024-12-31 10:01:14] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:01:14] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:19] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 99
[2024-12-31 10:01:19] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:01:19] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:29] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 100
[2024-12-31 10:01:29] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:01:29] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:38] debug: 	zh:deconz:frameparser: DEVICE_STATE changed: 101010
[2024-12-31 10:01:38] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:38] debug: 	zh:deconz:driver: query aps data indication
[2024-12-31 10:01:38] debug: 	zh:deconz:driver: DATA_INDICATION - sending read data request - SeqNr. 101
[2024-12-31 10:01:38] debug: 	zh:deconz:frameparser: DATA_INDICATION RESPONSE - seqNr. 101 srcAddr: 0x6365 destAddr: 0x0 profile id: 0x104 cluster id: 0x405 lqi: 194
[2024-12-31 10:01:38] debug: 	zh:deconz:frameparser: response payload: 18130a0000218c16
[2024-12-31 10:01:38] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:38] debug: 	zh:controller: Received payload: clusterID=1029, address=25445, groupID=0, endpoint=1, destinationEndpoint=1, wasBroadcast=false, linkQuality=194, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":19,"commandIdentifier":10},"payload":[{"attrId":0,"dataType":33,"attrData":5772}],"command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}}
[2024-12-31 10:01:38] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/SNZB-02 1CF1', payload '{"battery":100,"humidity":57.72,"linkquality":194,"temperature":18.18,"voltage":3000}'
[2024-12-31 10:01:39] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 102
[2024-12-31 10:01:39] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:01:39] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: send read device state from queue. seqNr: 103
[2024-12-31 10:01:49] debug: 	zh:deconz:frameparser: device state: 100010
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:49] debug: 	zh:deconz:frameparser: DEVICE_STATE changed: 101010
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 1 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: query aps data indication
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: DATA_INDICATION - sending read data request - SeqNr. 104
[2024-12-31 10:01:49] debug: 	zh:deconz:frameparser: DATA_INDICATION RESPONSE - seqNr. 104 srcAddr: 0xf1f4 destAddr: 0x0 profile id: 0x104 cluster id: 0x405 lqi: 183
[2024-12-31 10:01:49] debug: 	zh:deconz:frameparser: response payload: 18f50a0000212616
[2024-12-31 10:01:49] debug: 	zh:deconz:driver: networkstate: 2 apsDataConfirm: 0 apsDataIndication: 0 configChanged: 0 apsRequestFreeSlots: 1
[2024-12-31 10:01:49] debug: 	zh:controller: Received payload: clusterID=1029, address=61940, groupID=0, endpoint=1, destinationEndpoint=1, wasBroadcast=false, linkQuality=183, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":245,"commandIdentifier":10},"payload":[{"attrId":0,"dataType":33,"attrData":5670}],"command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}}
[2024-12-31 10:01:49] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/SNZB-02 1147', payload '{"battery":91,"humidity":56.7,"linkquality":183,"temperature":20.02,"voltage":2900}'

@raoulbhatia
Copy link

raoulbhatia commented Jan 5, 2025

@Nerivec @Koenkk please let me know what I can do to help get the install code to work in z2m 😊

Update:

  1. I pulled the latest zigbee2mqtt edge add-on:
    • Zigbee2MQTT version: 2.0.0-dev commit: c33946f
  2. After a restart of the add-on, I tried to add the install code again
  3. To my surprise, this worked (I didn't get to reset my Twinguard fast enough so it made it into pairing on time though)

My assumption is thus, that the Conbee III might just take > 10s to process the command and thus the command is aborted?

Logs from the successful attempt:

[2025-01-05 20:44:15] info: 	zh:controller: Install code was adjusted for reason 'missing CRC'.
[2025-01-05 20:44:15] info: 	zh:controller: Adding install code for 0x000D6F0019933538.
[2025-01-05 20:44:19] info: 	z2m: Successfully added new install code
[2025-01-05 20:44:19] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/install_code/add', payload '{"data":{"value":"RB01SG0D836591B3CC0010000000000000000000000D6F0019933538DLK07C0A885D6107EE86D5BC3248658B27E"},"status":"ok","transaction":"tmx9h-1"}'
[2025-01-05 20:44:19] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/SNZB-02 1CF1', payload '{"battery":88.5,"humidity":63.79,"linkquality":200,"temperature":19.49,"voltage":2900}'
[2025-01-05 20:44:19] info: 	z2m: Zigbee: allowing new devices to join.
[2025-01-05 20:44:20] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/permit_join', payload '{"data":{"time":254},"status":"ok","transaction":"tmx9h-2"}'


Thanks,
Raoul

@Nerivec
Copy link
Collaborator

Nerivec commented Jan 6, 2025

A little strange that it would take >10s and then sometimes succeeds in less than 5sec (pretty slow in any case though).
Could be linked to load status of the NCP I suppose, if it does some crypto op with the install code, that definitely could drag its perf way down until it's done...

Can you reproduce the successful add reliably?
Can you also confirm if the device pairs successfully after a successful add?

@raoulbhatia
Copy link

This morning, after >10h of not touching anything,
I tried to add the install code again and this succeeded (logs below, though without debug)

However, I did NOT manage to pair the Twinguard.

I will enable debug logs and try again in a few hours.
Could you please let me know if zh debug logs are sufficient, or if I better switch everything to debug?

[2025-01-06 08:08:15] info: 	zh:controller: Install code was adjusted for reason 'missing CRC'.
[2025-01-06 08:08:15] info: 	zh:controller: Adding install code for 0x000D6F0019933538.
[2025-01-06 08:08:19] info: 	z2m: Successfully added new install code
[2025-01-06 08:08:19] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/install_code/add', payload '{"data":{"value":"RB01SG0D836591B3CC0010000000000000000000000D6F0019933538DLK07C0A885D6107EE86D5BC3248658B27E"},"status":"ok","transaction":"681jv-1"}'
[2025-01-06 08:08:19] info: 	z2m: Zigbee: allowing new devices to join.
[2025-01-06 08:08:20] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/permit_join', payload '{"data":{"time":254},"status":"ok","transaction":"681jv-2"}'

@raoulbhatia
Copy link

I tried to add the install code again after a few hours.

The first attempt did not succeed. What I find interesting is the following logs hinting at

https://github.com/Koenkk/zigbee-herdsman/blob/master/src/adapter/deconz/driver/driver.ts#L508

I did not dig into the timeoutcounter logic,
but perhaps there is a relation to the problem at hand?

[2025-01-06 11:27:00] debug: 	z2m: Error: TIMEOUT
    at Driver.processBusyQueue (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:508:28)
    at Timeout._onTimeout (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/deconz/driver/driver.ts:160:46)
    at listOnTimeout (node:internal/timers:594:17)
    at processTimers (node:internal/timers:529:7)

After changing the log level again to ensure EVERYTHING Is logged at debug level,
I was able to successfully add the install code.

However, the device did not manage to join.
You can find the logs at https://nem3d.net/z2m_debug_20240106a.txt

FYI I am running my Zigbee network on channel 25.
But from what I read this should also be supported by Bosch's own controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants