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

Please expose functionality to set Standard Distributed Key (TZ-119) #25

Closed
spark404 opened this issue May 18, 2023 · 4 comments
Closed

Comments

@spark404
Copy link

The current API doesn't expose a function to set the Standard Distributed Key. This would be nice to have in order to join networks that don't use the standard Zigbee Alliance Key Transport Key. Recognisable by having the Key Id set to 2 in the Security Control Field of the ZigBee Security Header.

This functionality is available in the boss library with the function call 'zb_zdo_set_tc_standard_distributed_key'. I was able to get my ZigBee device connected to the network by using a workaround. I reconfigured the on/off light example with 'CONFIG_ZB_ZCZR=y' to link against the zczr libraries that expose that function. And defined the function as external

extern void zb_zdo_set_tc_standard_distributed_key(unsigned char *key_ptr);

Calling this function with the correct key after invoking esp_zb_init allowed the module to extract the Standard Network Key from the Transport Key message. The module is correctly sending a Device Announcement with the network key.

Details:

ESP32-C6-DevKitC-1

I (275) cpu_start: Application information:
I (277) cpu_start: Project name:     light_bulb
I (283) cpu_start: App version:      v5.2-dev-503-g17451f1fb3-dirty
I (290) cpu_start: Compile time:     May 18 2023 19:34:07
I (296) cpu_start: ELF file SHA256:  d2e13cbd956f6be1...
I (302) cpu_start: ESP-IDF:          v5.2-dev-503-g17451f1fb3-dirty
I (309) cpu_start: Min chip rev:     v0.0
I (313) cpu_start: Max chip rev:     v0.99
I (318) cpu_start: Chip rev:         v0.0

dependencies:
  espressif/esp-zboss-lib:
    component_hash: 963540d31dd481b96caf1f9d61b213504faeb18b72b33a4617fd327a47bd013f
    source:
      service_url: https://api.components.espressif.com/
      type: service
    version: 0.3.6
  espressif/esp-zigbee-lib:
    component_hash: 37ec54b0e32e017f99b850afe0fd3e3ff493fc1c033591c57d5227eb5c683165
    source:
      service_url: https://api.components.espressif.com/
      type: service
    version: 0.5.5
  espressif/led_strip:
    component_hash: 7e92a0c8a2e35b40904f88e88ce3c0dffff504a2763f70fba7ef4787cf2eec83
    source:
      service_url: https://api.components.espressif.com/
      type: service
    version: 2.0.0
  idf:
    component_hash: null
    source:
      type: idf
    version: 5.2.0
manifest_hash: 1eb30226f3e4c780c0bf127d7afbf2f8f69c666bd5d51ca78990da67017e7e05
target: esp32c6
version: 1.0.0
@likunqiao097304
Copy link
Contributor

We will provide API for this, thanks for pointing out

@tom-borcin tom-borcin changed the title Please expose functionality to set Standard Distributed Key Please expose functionality to set Standard Distributed Key May 23, 2023
@github-actions github-actions bot changed the title Please expose functionality to set Standard Distributed Key Please expose functionality to set Standard Distributed Key (TZ-119) May 23, 2023
@chshu
Copy link
Collaborator

chshu commented May 26, 2023

@spark404
Copy link
Author

Hi @chshu, thank you for doing this work.

It works like a charm in my test project. However I tried using this with the Zigbee device type set to "Zigbee End Device" and received the following error. If I set the device type to Zigbee Coordinator or Router device it works without problems.

/Users/hugo/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /Users/hugo/Projects/HackerHotelBadge/zll-light/managed_components/espressif__esp-zigbee-lib/lib/esp32c6/libesp_zb_api_ed.a(esp_zigbee_secur.c.obj): in function `.L0 ':
(.text.esp_zb_secur_TC_standard_distributed_key_set+0x4): undefined reference to `zb_zdo_set_tc_standard_distributed_key'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@xieqinan
Copy link
Contributor

xieqinan commented Jun 1, 2023

Thank you for your test. Currently, the end device of Zigbee does not support temporarily setting the distributed key. However, this feature will be fixed in the next week.

espressif-bot pushed a commit that referenced this issue Jun 5, 2023
* fix callback for custom cluster
* stringify zigbee app signal
* fix end device distributed key setting
* register attribute from local variable to static
* fix reportable_change data type

Closes: #25
Closes: #27
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

4 participants