Skip to content

Problem with Reading ZIgBee sensor data #11175

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

Closed
1 task done
Usama050 opened this issue Mar 25, 2025 · 2 comments
Closed
1 task done

Problem with Reading ZIgBee sensor data #11175

Usama050 opened this issue Mar 25, 2025 · 2 comments
Assignees
Labels
Area: Zigbee Issues and Feature Request about Zigbee Status: Awaiting triage Issue is waiting for triage

Comments

@Usama050
Copy link

Board

ESP32H2

Device Description

I am using esp32h2 and Zigbee door sensor. Wireless communication

Hardware Configuration

I am using esp32h2 and Zigbee door sensor. Wireless communication

Version

latest master (checkout manually)

IDE Name

Arduino

Operating System

Window 11

Flash frequency

64 MHz

PSRAM enabled

no

Upload speed

921600

Description

I am using esp32h2 and it is working as a ZigBee coordinator in my project. The door sensor is connected with this coordinator but can not read it value.

Sketch

#include "Zigbee.h"

#define COORDINATOR_ENDPOINT 1
ZigbeeContactSwitch zbCoordinator(COORDINATOR_ENDPOINT);

void setup() {
  Serial.begin(115200);
  
  // Initialize coordinator
  Zigbee.addEndpoint(&zbCoordinator);
  Zigbee.setRebootOpenNetwork(180);
  
  if(!Zigbee.begin(ZIGBEE_COORDINATOR)) {
    Serial.println("Coordinator init failed!");
    ESP.restart();
  }
  
  Serial.println("Zigbee Coordinator Ready");
}

void loop() {
  static uint32_t lastCheck = 0;
  
  if(millis() - lastCheck > 5000) {
    lastCheck = millis();
    
    auto devices = zbCoordinator.getBoundDevices();
    Serial.printf("\nConnected Devices: %d\n", devices);
    
    for(auto& dev : devices) {
      esp_zb_lock_acquire(portMAX_DELAY);
      esp_zb_zcl_attr_t *attr = esp_zb_zcl_get_attribute(
        dev->endpoint,
        ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE,
        ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
        ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID
      );
      
      if(attr && attr->data_p) {
        uint16_t zoneStatus = *((uint16_t *)attr->data_p);
        bool isOpen = (zoneStatus & 0x0001);
        Serial.printf("Device 0x%04X: %s\n", dev->short_addr, isOpen ? "OPEN" : "CLOSED");
      }
      esp_zb_lock_release();
    }
  }
}

Debug Message

14:32:51.860 -> 
14:32:51.860 -> Connected Devices: 1082248564
14:32:56.856 -> 
14:32:56.856 -> Connected Devices: 1082248564
14:33:00.950 -> [ 44093][V][ZigbeeHandlers.cpp:104] zb_attribute_reporting_handler(): Received report from address(0x90a3) src endpoint(1) to dst endpoint(1) cluster(0x1)
14:33:00.950 -> [ 44107][V][ZigbeeHandlers.cpp:104] zb_attribute_reporting_handler(): Received report from address(0x90a3) src endpoint(1) to dst endpoint(1) cluster(0x1)
14:33:01.852 -> 
14:33:01.852 -> Connected Devices: 1082248564
14:33:06.846 -> 
14:33:06.846 -> Connected Devices: 1082248564
14:33:10.993 -> [ 54125][V][ZigbeeHandlers.cpp:104] zb_attribute_reporting_handler(): Received report from address(0x90a3) src endpoint(1) to dst endpoint(1) cluster(0x1)
14:33:10.993 -> [ 54139][V][ZigbeeHandlers.cpp:104] zb_attribute_reporting_handler(): Received report from address(0x90a3) src endpoint(1) to dst endpoint(1) cluster(0x1)
14:33:11.876 -> 
14:33:11.876 -> Connected Devices: 1082248564
14:33:16.865 -> 
14:33:16.865 -> Connected Devices: 1082248564
14:33:21.865 -> 
14:33:21.865 -> Connected Devices: 1082248564
14:33:26.861 -> 
14:33:26.861 -> Connected Devices: 1082248564

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@Usama050 Usama050 added the Status: Awaiting triage Issue is waiting for triage label Mar 25, 2025
@Parsaabasi
Copy link

Hi @P-R-O-C-H-Y

Would you please take a look at this?

Thanks

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Mar 25, 2025
@P-R-O-C-H-Y P-R-O-C-H-Y added the Area: Zigbee Issues and Feature Request about Zigbee label Mar 25, 2025
@P-R-O-C-H-Y
Copy link
Member

@Usama050 Please don't open multiple Issues, I am closing this one as duplicate of #11169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Zigbee Issues and Feature Request about Zigbee Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

3 participants