@@ -31,7 +31,7 @@ void ZigbeeDoorWindowHandle::setIASClientEndpoint(uint8_t ep_number) {
31
31
32
32
void ZigbeeDoorWindowHandle::setClosed () {
33
33
log_v (" Setting Door/Window handle to closed" );
34
- uint8_t closed = 0 ; // ALARM1 = 0, ALARM2 = 0
34
+ uint8_t closed = 0 ; // ALARM1 = 0, ALARM2 = 0
35
35
esp_zb_lock_acquire (portMAX_DELAY);
36
36
esp_zb_zcl_set_attribute_val (
37
37
_endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, &closed, false
@@ -43,19 +43,17 @@ void ZigbeeDoorWindowHandle::setClosed() {
43
43
44
44
void ZigbeeDoorWindowHandle::setOpen () {
45
45
log_v (" Setting Door/Window handle to open" );
46
- uint8_t open = ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM1 | ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM2; // ALARM1 = 1, ALARM2 = 1
46
+ uint8_t open = ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM1 | ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM2; // ALARM1 = 1, ALARM2 = 1
47
47
esp_zb_lock_acquire (portMAX_DELAY);
48
- esp_zb_zcl_set_attribute_val (
49
- _endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, &open , false
50
- );
48
+ esp_zb_zcl_set_attribute_val (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, &open , false );
51
49
esp_zb_lock_release ();
52
50
_zone_status = open ;
53
51
report ();
54
52
}
55
53
56
54
void ZigbeeDoorWindowHandle::setTilted () {
57
55
log_v (" Setting Door/Window handle to tilted" );
58
- uint8_t tilted = ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM1; // ALARM1 = 1, ALARM2 = 0
56
+ uint8_t tilted = ESP_ZB_ZCL_IAS_ZONE_ZONE_STATUS_ALARM1; // ALARM1 = 1, ALARM2 = 0
59
57
esp_zb_lock_acquire (portMAX_DELAY);
60
58
esp_zb_zcl_set_attribute_val (
61
59
_endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_ZONESTATUS_ID, &tilted, false
@@ -71,7 +69,7 @@ void ZigbeeDoorWindowHandle::report() {
71
69
esp_zb_zcl_ias_zone_status_change_notif_cmd_t status_change_notif_cmd;
72
70
status_change_notif_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
73
71
status_change_notif_cmd.zcl_basic_cmd .src_endpoint = _endpoint;
74
- status_change_notif_cmd.zcl_basic_cmd .dst_endpoint = _ias_cie_endpoint; // default is 1
72
+ status_change_notif_cmd.zcl_basic_cmd .dst_endpoint = _ias_cie_endpoint; // default is 1
75
73
memcpy (status_change_notif_cmd.zcl_basic_cmd .dst_addr_u .addr_long , _ias_cie_addr, sizeof (esp_zb_ieee_addr_t ));
76
74
77
75
status_change_notif_cmd.zone_status = _zone_status;
@@ -88,14 +86,20 @@ void ZigbeeDoorWindowHandle::report() {
88
86
void ZigbeeDoorWindowHandle::zbIASZoneEnrollResponse (const esp_zb_zcl_ias_zone_enroll_response_message_t *message) {
89
87
if (message->info .cluster == ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE) {
90
88
log_v (" IAS Zone Enroll Response: zone id(%d), status(%d)" , message->zone_id , message->response_code );
91
- if (message->response_code == ESP_ZB_ZCL_IAS_ZONE_ENROLL_RESPONSE_CODE_SUCCESS) {
89
+ if (message->response_code == ESP_ZB_ZCL_IAS_ZONE_ENROLL_RESPONSE_CODE_SUCCESS) {
92
90
log_v (" IAS Zone Enroll Response: success" );
93
91
esp_zb_lock_acquire (portMAX_DELAY);
94
- memcpy (_ias_cie_addr, (*(esp_zb_ieee_addr_t *)esp_zb_zcl_get_attribute (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID)->data_p ),sizeof (esp_zb_ieee_addr_t ));
92
+ memcpy (
93
+ _ias_cie_addr,
94
+ (*(esp_zb_ieee_addr_t *)
95
+ esp_zb_zcl_get_attribute (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_IAS_ZONE, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_IAS_ZONE_IAS_CIE_ADDRESS_ID)
96
+ ->data_p ),
97
+ sizeof (esp_zb_ieee_addr_t )
98
+ );
95
99
esp_zb_lock_release ();
96
100
_zone_id = message->zone_id ;
97
- }
98
-
101
+ }
102
+
99
103
} else {
100
104
log_w (" Received message ignored. Cluster ID: %d not supported for On/Off Light" , message->info .cluster );
101
105
}
0 commit comments