-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Implement Zigbee in Arduino #10135
Comments
Hi, love the work so far. I'm so excited to get this running. It looks like it's going to be the next best thing since sliced bread! Are there any intentions to add power source/battery level into the config? If mains powered could it act as a router as well or is that too much for a H2? Maybe ok for the C6.. Many thanks and appreciate the hard work! |
Dev update 12/08/2024 pushed to the dev branch:
|
Oh wow, that looks amazing! So easy, I'm going to love this. Thanks! |
Thank you for your feedback 👍 I really appreciate it. About the power source/baterry level I will add it on the list as good to have, so I will look after having the main part done :) |
Dev Update 14/08/2024 pushed to dev branch:
|
Nice, |
@elgerg The temperature sensor + thermostat are on the list of upcoming tasks. Edit: found your issue you opened. Added a comment. |
Thanks for adding to espressif/esp-zigbee-sdk#401 |
Hi @P-R-O-C-H-Y Any chance I can add this to the "Nice to have" list? In the current Temp sensor version there is an identify cluster (?) added:
Any chance you can add something like that to the list so we can blink an LED when triggered? No idea how to do that at the moment.. Thanks! |
Hi @elgerg, Can you explain a bit more? I am not sure if I got it correctly. |
Hi @P-R-O-C-H-Y There is an identify button. In theory this should allow for the device to identify itself by blinking an LED or something when the button is pressed so you can figure out which device is which. This article explains really well on what identify is: So what would be good to have is a simple way of using this just like you are doing with the rest of the wrapper. Does that make a little more sense? Thanks |
Thanks for explaining. That can be really helpful. Adding it to the list :) |
Excellent. Thanks :) |
Dev Update 16/08/2024 pushed to dev branch:
|
If you're taking requests I'd also like to implement some kind of way of getting the current time from the coordinator to display on a screen. Do you know if it's possible to get the time into some sort of callback? Thanks :) |
@elgerg Do you have any example of this feature? |
Dev Update 28/08/2024 pushed to dev branch:
|
Hi, how can I enable logging? I build with Zigbee ED -Debug but I definitely don't see all messages. |
When my dimmable light is joined to Home Assistant ZHA and calling Now when I join this end-point with exact the same firmware to the Philips HUE network all is working form the App point of view. But the App is not updated when setLight ( Is there someone who can give a hint in the right direction? |
I've only been loosely following, I do have a hue hub and an esp32-c6 devkit 1.2 on had that I could test with, finding time is the hard part. I would start by looking at what's different about the pairing process. Did ZHA make any different calls out to the light that Hue didn't, like setting up automatic reporting, or binding? Some Zigbee coordinators setup automatic reporting where the light reports it's status after an action, and some will just call for Report Attributes regularly. Could you post a capture of the joining of the light and then subsequent activity? though if this is your personal zigbee network that would expose your network key to the internet which isn't ideal and we can look at other ways of trouble shooting. I'm not expert, I've just had to trouble shoot my company's own zigbee networks against Hue and it's pretty eye opening when staring at sniffer logs all day. |
Hi cpuchip, thank you for offering to help. I've captured the commisioning and rejoining of my dimmable light (zbee_nwk.addr == 0xe0b6). zigbee capture dimmable light commisioning and rejoining.zip |
I finally had a minute to open your packet capture, I'm not used to wireshark I mostly work in Simplicity Studio's network analyzer, however you have to have an EFR32MG dev kit to make that work (which aren't cheap) I was able to open it in both wireshark and simplicity studio as an import and can start to piece things together. It would probably take me too long to fully get up to speed on wireshark... I think I'll just try reproducing your issues with hue. I found your repo and blog post, I'll try tomorrow or Thursday to compile your example code here : https://github.com/wejn/esp32-huello-world/tree/24d50e985e004b97d97231551daf6966734a7223 Sorry I'm not helpful at the moment. |
Hello @P-R-O-C-H-Y and everyone, Thank you for your recent work on creating a high level wrapper for the Zigbee library. Would it be possible to implement an endpoint with the PM2.5 measurement? Are there plans to have similar voltage, current and power measurement endpoints and battery level reporting in the future? These would be highly useful for many projects. Once again. Huge thanks for your work. |
@jaccobezemer What may be the thing HA is doing differently is the data pooling. |
Hello @VAVorontsov, Yes I can add the PM2.5 measurement endpoint. Please open a Feature Request so its easier to track and plan the work :) About the power management, currently only power source, and battery level are supported. This can be extended to also support current, voltage etc. typedef enum {
ZB_POWER_SOURCE_UNKNOWN = 0x00,
ZB_POWER_SOURCE_MAINS = 0x01,
ZB_POWER_SOURCE_BATTERY = 0x03,
} zb_power_source_t;
// Set Power source and battery percentage for battery powered devices
void setPowerSource(zb_power_source_t power_source, uint8_t percentage);
void setBatteryPercentage(uint8_t percentage);
void reportBatteryPercentage(); |
Thanks Jan, but I don't have that problem with ZHA. It's working oké there. It's with the Philips Hue bridge where it doesn't work. |
Sure, but I pointed out what may be different on Philips Hue. If there is also any settings like that to enable the polling for updates. That may solve the problem. |
Ah, sorry. I misunderstood you. No, no setting in the Hue Bridge to do this. The only setting that is Zigbee related is the channel number. |
It took an embarrassing long time to get your example working, mostly because I didn't have a good way of "factory" resetting the esp32-c6 so that it would network steer and pair to my hue bridge. I have it paired with Hue and can see that it's pulling the esp32-c6 for on/off (cluster 6) and dimmable (cluster 8) but cluster 300 (color) has some unsupported it's returning, like hue and saturation. Now Hue is asking for is: 4000, 0001, 0003, 0004, 0008, 4002 to which the ESP32-C6 says 4000, 0001, and 4002 are UNSUPPORTED That may be where we're running into issues? ColorMode is set to 0x01 which is CurrentX/CurrentY A future note to myself, mainly, the pairing key needed is the ZLL Trust Center key. Note: short address from attached packet capture |
now I don't know how to call ZigbeeDimmableLight::setLight or where to call it. so I am blocked on reproducing your issue at this point. Though figuring out how to implement those attributes would probably solve the problem would be my guess? Also Hue automatically read attributes for on/off, dimm level, and color automatically and regularly does it every 3 seconds (at least when there's only 2 lights attached) Hue is very chatty Zigbee wise. |
@cpuchip Many thanks for your efforts and insights. Setlight is available in the arduino-esp32 dimmable light example. |
@jaccobezemer My total bad, I went through and re read everything and I understand where I went wrong. I thought the blog post and linked repo was your example, not one that you were basing off of to get your dimmable example working. I'll push on that thread and make the changes you've made to the default example and see if I can get that working too. I learned a lot in the process :D like how to build https://github.com/wejn/esp32-huello-world/tree/24d50e985e004b97d97231551daf6966734a7223 on windows. I also figured out how to get each of the esp-zigbee-sdk examples working as well on my esp32-c6 dev kit. It might take me a few days to find another time slot though. I apologize for convoluting this thread a little. |
@cpuchip. No need to apologize! I'm happy with your attention. |
@jaccobezemer I was able to make the changes you suggested against the Arduino Zigbee library and I did get my esp32-c6 to join Hue hub once, and noticed that hue queried the endpoints, and but didn't regularly then go on to read the attributes regularly. The only thing I can think of is that the Hue bridge doesn't like something in the Node Description Response coming back from the esp32 or something in the Simple Description Response. The only differences I found in the Node Description Response to a temp dimmable Hue light was ESP32-C6 I don't think that's it really. I'll keep digging as I have more time. Is there a Discord I could join and be a little more real time, I don't mind posting back here with major findings, I also don't mind adding creating a PR with any changes we come up with here that fixes this. I think it'd be fun actually. Also thank you @P-R-O-C-H-Y I really like the fact that the button is dual purpose and can reset the esp32 on long press and short press does something, like change level. Nice touch with the example code! |
@cpuchip It's nice to read that you experience the same issues as I am. |
How about the "Arduino Core for Espressif" Discord? |
@P-R-O-C-H-Y Would you consider also adding Zigbee End Device support to the ESPHome firmware for ESP32-H2 (and ESP32-C6) in a similar approach that tomaszduda23 is now working on for a competing platform? Please see: Maybe you could collaborate with tomaszduda23 or at least give feedback to hin on that pull request for ESPHome so that it can be implemented in a way that could also make it compatible with your/Espressif API for Zigbee within Arduino? |
@cpuchip and @P-R-O-C-H-Y last update about my Philips Hue issues before changing to Discord. I managed to get things going by defining the dimmable light also as a ZIGBEE_ROUTER. That changed it to a Full-Function device. ZigBee Device Profile, Device Announcement, Nwk Addr: 0xf520, Ext Addr: Espressif_ff:fe:57:9e:8c The Philips Hue bridge apparently expects that a light is also a router because it now reads the onoff and level attributes every 53-55 seconds. What made this search more difficult than needed 😉
So, now it works as other Zigbee 3 devices with Philips Hue. Finally 😊🙌 Thanks @cpuchip for thinking along and thanks @P-R-O-C-H-Y for your great API wrapper. |
@jaccobezemer I am glad that its finally working for you :)
Is there anything that needs to be added in order for Philips Hue to work or it's just about the correct configuration? |
@jaccobezemer After a bunch of testing and comparing with Huello-world example : https://github.com/wejn/esp32-huello-world/tree/24d50e985e004b97d97231551daf6966734a7223 which does work with the polling of the Hue bridge, I was suspecting it was that Huello world is a FFD (full functioning device with router capable zigbee radio firmware) and what arduino defaults to which is RFD (Reduced functioning device or end device firmware) I don't know why Hue wouldn't think to pull a device still if it's marked as mains powered.... I finally figured out how to switch the dimmable example over to ZCZR firmware to act as a full functioning device, and got that paired to the Hue bridge and indeed it pulls the light every 1 second or so. as an aside I did get the bulb paired to my companies Zigbee bridge which does setup reporting on attribute change and have verified that that does work with the example arduino dimmable firmware, when clicking the boot button, the esp32-c6 will report level changes. Our bridge does not pull by using ReadAttribueRequests..... which is a long story. Anyways, there's something else missing in the pairing process that our Zigbee gateway is looking for that this example code isn't providing. I'll save that investigation for another day. The Hue bridge does not setup binding or reporting schedule so the arduino example firmware will not automatically push it's attribute changes up, that's just how Hue works. As a note @P-R-O-C-H-Y the only thing we need are zigbee_dimmable_light_cfg_t light_cfg = ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG(); // correct the off behavior _ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_DIMMABLE_LIGHT_DEVICE_ID, .app_device_version = 1}; // set default values And the ability to set the ZLL truct center key in ZigbeeCore.cpp I would also suggest changes to the Zigbee_Dimmable_light.ino and the color one too ` #include "Zigbee.h" #ifdef ZIGBEE_MODE_ZCZR update role I can make an PR for that tomorrow, unless you just want to do it yourself which is fine, the only part I'm unsure on is a proper way to add an API for |
@cpuchip We've figured it out. See my post of yesterday where I came up with the same conclusion😊 As for the app_device_version, there is already a methode for that: What we mis so far @P-R-O-C-H-Y, is what @cpuchip mentioned in the previous post. Also we need a way to change an attribute value to change these attributes: @cpuchip If you want to make a PR, please do. I'm happy to work on that with you. |
I'm still working on this, I have a branch on my fork of this repo: https://github.com/cpuchip/arduino-esp32/tree/feature/zigbee-tc-support Sorry it's taking me longer to get to this then I thought, but I'm making progress. |
@P-R-O-C-H-Y I wanted to try out the OTA functionality but it was not clear to me how i should create the OTA binary. Is it even possible to do that? |
@P-R-O-C-H-Y Thank you so much for adding Zigbee support to the Arduine IDE! |
Related area
Create an API for Zigbee within Arduino
Hardware specification
ESP32-C6 and ESP32-H2 as Standalone Nodes. Other SoC can be used as radio co-processor attached to a RPC (802.15.4 radio layer).
Is your feature request related to a problem?
This is an issue to track the progress of developing Zigbee library, a new API for Arduino.
Describe the solution you'd like
Initial tasks:
Zigbee library (wrapper) tasks:
PR: #10265
Good to have features:
more tasks will be added while in progress.
Development branch
Describe alternatives you've considered
No other usable Zigbee wrapper around.
Additional context
Related issues:
#8807 #9156 #9962 #9480
I have checked existing list of Feature requests and the Contribution Guide
The text was updated successfully, but these errors were encountered: