Skip to content

Problem with Reading ZIgBee sensor data #11175

Closed as duplicate of#11169
Closed as duplicate of#11169
@Usama050

Description

@Usama050

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions