[nrf52,zigbee] count sleep time of zigbee thread (#13933)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
tomaszduda23
2026-02-11 22:21:10 +01:00
committed by GitHub
parent 7287a43f2a
commit 374cbf4452
2 changed files with 14 additions and 3 deletions
+12 -3
View File
@@ -61,11 +61,19 @@ void ZigbeeComponent::zboss_signal_handler_esphome(zb_bufid_t bufid) {
break;
}
auto before = millis();
auto err = zigbee_default_signal_handler(bufid);
if (err != RET_OK) {
ESP_LOGE(TAG, "Zigbee_default_signal_handler ERROR %u [%s]", err, zb_error_to_string_get(err));
}
if (sig == ZB_COMMON_SIGNAL_CAN_SLEEP) {
this->sleep_remainder_ += millis() - before;
uint32_t seconds = this->sleep_remainder_ / 1000;
this->sleep_remainder_ -= seconds * 1000;
this->sleep_time_ += seconds;
}
switch (sig) {
case ZB_BDB_SIGNAL_STEERING:
ESP_LOGD(TAG, "ZB_BDB_SIGNAL_STEERING, status: %d", status);
@@ -213,6 +221,7 @@ void ZigbeeComponent::dump_config() {
"Zigbee\n"
" Wipe on boot: %s\n"
" Device is joined to the network: %s\n"
" Sleep time: %us\n"
" Current channel: %d\n"
" Current page: %d\n"
" Sleep threshold: %ums\n"
@@ -221,9 +230,9 @@ void ZigbeeComponent::dump_config() {
" Short addr: 0x%04X\n"
" Long pan id: 0x%s\n"
" Short pan id: 0x%04X",
get_wipe_on_boot(), YESNO(zb_zdo_joined()), zb_get_current_channel(), zb_get_current_page(),
zb_get_sleep_threshold(), role(), ieee_addr_buf, zb_get_short_address(), extended_pan_id_buf,
zb_get_pan_id());
get_wipe_on_boot(), YESNO(zb_zdo_joined()), this->sleep_time_, zb_get_current_channel(),
zb_get_current_page(), zb_get_sleep_threshold(), role(), ieee_addr_buf, zb_get_short_address(),
extended_pan_id_buf, zb_get_pan_id());
dump_reporting_();
}
@@ -92,6 +92,8 @@ class ZigbeeComponent : public Component {
CallbackManager<void()> join_cb_;
Trigger<> join_trigger_;
bool force_report_{false};
uint32_t sleep_time_{};
uint32_t sleep_remainder_{};
};
class ZigbeeEntity {