-
Notifications
You must be signed in to change notification settings - Fork 43
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
How a light sleep device wake up from sleep? (TZ-806) #323
Comments
It gets woken up by the underling zigbee stack implementation. You can check the esp-zigbee-sdk/examples/esp_zigbee_sleep/light_sleep/main/esp_zb_sleepy_end_device.h Line 30 in 1efb22b
So whenever the sleep function is called, a specific timer is used for the next wake-up. It will not always be the maximum timeout, since different situation require different timeouts. For example during boot up or interviewing the device will wake up way more frequently, so that the communication can be completed in a timely fashion. If you want the device to wake up even less than in the example you would have to call the One thing i forgot to mention is: |
Thank you for your explanation. But there is still one question for me: if I need to implement some extra function, e.g. sensor sampling or screen gui by lvgl, how should I modify the code? Would you mind posting some simple code examples? Thank you. |
@acha666 , Could you please provide more details about the implementation of sensor sampling? If it's not directly related to this issue, it might be better to open another issue to discuss it separately. |
Just a simple I2C temperature&humidity sensor like SHT4x. Currently, I'm working on a HA sensor project, and the device is powered by battery so the sensor will not take measurement continuously. |
@acha666 , I think the temperature sensor is helpful for you to implement your temperature&humidity sensor in ZCL layer. and you can refer to #200 (comment) to get the wake up way from I2C for light sleep device. |
Thank you very much. However, I am still not clear about the principles of light sleep in the ESP32 series. From my understanding, in the light sleep example of this repository, the device enters light sleep when the Zigbee protocol stack throws the Since my sensor implementation requires waking up and reporting once every certain interval (like one minute), I would like to ask:
|
@acha666 ,
It depends on your requirements; the frequency of waking up is not limited by the Zigbee stack. However, note that the maximum sleep time in the Zigbee stack is one day.
Regarding the issue, it is custom approache for application layer. For instance, if the device is a sleep device, you can adjust the priority of the Zigbee tasks. When other higher-priority tasks are idle, the RTOS can call the Zigbee task to run and put the device into sleep. By the way, the above approach serves only as a reference. |
Thank you again. Another question is about how to make sure the device sleep and wake up in an accurate period(in this case, 1 minute perhaps), in order that the sensor task can take measurements just after the device wake up. Maybe I can set zb_zdo_pim_set_long_poll_interval to 60000? |
If so. Typically, the device will wake up after 60000 ms under normal conditions if there are no other interrupts or events, such as scheduler events or interrupts from external. In summary, the Zigbee stack or external signals can affect the wakeup period, but I recommend testing it first and providing feedback with your test results. |
I noticed that the ESP-IDF documentation mentions an Auto Light-sleep mode. Is this mode used in Zigbee implementations? I ask because I saw that the |
@acha666 ,
Yes, you are right. |
Is the auto light-sleep mode compatible with maintaining Zigbee connections? I'm considering enabling it and simply using |
The sleep mode is maintained by the Zigbee task, you can start with the light sleep example, and add your application tasks, you don't need to add any additional logic for sleep. |
I am using the light sleep example; I have found that pressing the button does not instantly wake the device. I have to press the button a few times - it only seems to fire the "zb_buttons_handler" function when the device wakes due to the zigbee sleep timer. Is this the expected behavior? I would have thought that the device would instantly wake up and run the "zb_buttons_handler" function when the button was pushed. |
Question
I'm checking this example, accroading to the example output, the device seems continue go into sleep and then wake up.
I saw
esp_zb_sleep_now()
is triggered when receivingESP_ZB_COMMON_SIGNAL_CAN_SLEEP
signal, that seems make the device sleep.esp-zigbee-sdk/examples/esp_zigbee_sleep/light_sleep/main/esp_zb_sleepy_end_device.c
Line 136 in 1efb22b
But why the device wake up so frequently? The only wake up source configured in file is the button gpio, I think.
Additional context.
No response
The text was updated successfully, but these errors were encountered: