Skip to content

Commit d2c4c73

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 80b1592 commit d2c4c73

File tree

9 files changed

+54
-33
lines changed

9 files changed

+54
-33
lines changed

docs/en/zigbee/ep_contact_switch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Sets the IAS Client endpoint number (default is 1).
8888
requestIASZoneEnroll
8989
^^^^^^^^^^^^^^^^^^^^
9090

91-
Requests a new IAS Zone enrollment. Can be called to enroll a new device or to re-enroll an already enrolled device.
91+
Requests a new IAS Zone enrollment. Can be called to enroll a new device or to re-enroll an already enrolled device.
9292

9393
.. code-block:: arduino
9494

libraries/Zigbee/examples/Zigbee_Contact_Switch/Zigbee_Contact_Switch.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Preferences preferences;
4646
void setup() {
4747
Serial.begin(115200);
4848

49-
preferences.begin("Zigbee", false); // Save ENROLLED flag in flash so it persists across reboots
50-
bool enrolled = preferences.getBool("ENROLLED"); // Get ENROLLED flag from preferences
49+
preferences.begin("Zigbee", false); // Save ENROLLED flag in flash so it persists across reboots
50+
bool enrolled = preferences.getBool("ENROLLED"); // Get ENROLLED flag from preferences
5151
preferences.end();
5252

5353
// Init button + switch
@@ -96,7 +96,7 @@ void setup() {
9696
// Skip writing if we just restored enrollment (flag was already true)
9797
if (!enrolled) {
9898
preferences.begin("Zigbee", false);
99-
preferences.putBool("ENROLLED", true); // set ENROLLED flag to true
99+
preferences.putBool("ENROLLED", true); // set ENROLLED flag to true
100100
preferences.end();
101101
Serial.println("ENROLLED flag saved to preferences");
102102
}
@@ -126,7 +126,7 @@ void loop() {
126126
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
127127
// Clear the ENROLLED flag from preferences
128128
preferences.begin("Zigbee", false);
129-
preferences.putBool("ENROLLED", false); // set ENROLLED flag to false
129+
preferences.putBool("ENROLLED", false); // set ENROLLED flag to false
130130
preferences.end();
131131
Serial.println("ENROLLED flag cleared from preferences");
132132
delay(1000);

libraries/Zigbee/examples/Zigbee_Vibration_Sensor/Zigbee_Vibration_Sensor.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Preferences preferences;
4646
void setup() {
4747
Serial.begin(115200);
4848

49-
preferences.begin("Zigbee", false); // Save ENROLLED flag in flash so it persists across reboots
50-
bool enrolled = preferences.getBool("ENROLLED"); // Get ENROLLED flag from preferences
49+
preferences.begin("Zigbee", false); // Save ENROLLED flag in flash so it persists across reboots
50+
bool enrolled = preferences.getBool("ENROLLED"); // Get ENROLLED flag from preferences
5151
preferences.end();
5252

5353
// Init button + sensor
@@ -96,7 +96,7 @@ void setup() {
9696
// Skip writing if we just restored enrollment (flag was already true)
9797
if (!enrolled) {
9898
preferences.begin("Zigbee", false);
99-
preferences.putBool("ENROLLED", true); // set ENROLLED flag to true
99+
preferences.putBool("ENROLLED", true); // set ENROLLED flag to true
100100
preferences.end();
101101
Serial.println("ENROLLED flag saved to preferences");
102102
}
@@ -130,7 +130,7 @@ void loop() {
130130
Serial.println("Resetting Zigbee to factory and rebooting in 1s.");
131131
// Clear the ENROLLED flag from preferences
132132
preferences.begin("Zigbee", false);
133-
preferences.putBool("ENROLLED", false); // set ENROLLED flag to false
133+
preferences.putBool("ENROLLED", false); // set ENROLLED flag to false
134134
preferences.end();
135135
Serial.println("ENROLLED flag cleared from preferences");
136136
delay(1000);

libraries/Zigbee/src/ep/ZigbeeContactSwitch.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,12 @@ bool ZigbeeContactSwitch::requestIASZoneEnroll() {
137137

138138
bool ZigbeeContactSwitch::restoreIASZoneEnroll() {
139139
esp_zb_lock_acquire(portMAX_DELAY);
140-
esp_zb_zcl_attr_t *ias_cie_attr = 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);
141-
esp_zb_zcl_attr_t *zone_id_attr = 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_ZONEID_ID);
140+
esp_zb_zcl_attr_t *ias_cie_attr =
141+
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);
142+
esp_zb_zcl_attr_t *zone_id_attr =
143+
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_ZONEID_ID);
142144
esp_zb_lock_release();
143-
145+
144146
if (ias_cie_attr == NULL || ias_cie_attr->data_p == NULL) {
145147
log_e("Failed to restore IAS Zone enroll: ias cie address attribute not found");
146148
return false;
@@ -149,12 +151,15 @@ bool ZigbeeContactSwitch::restoreIASZoneEnroll() {
149151
log_e("Failed to restore IAS Zone enroll: zone id attribute not found");
150152
return false;
151153
}
152-
154+
153155
memcpy(_ias_cie_addr, (esp_zb_ieee_addr_t *)ias_cie_attr->data_p, sizeof(esp_zb_ieee_addr_t));
154156
_zone_id = (*(uint8_t *)zone_id_attr->data_p);
155-
156-
log_d("Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1], _ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]);
157-
157+
158+
log_d(
159+
"Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1],
160+
_ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]
161+
);
162+
158163
if (_zone_id == 0xFF) {
159164
log_e("Failed to restore IAS Zone enroll: zone id not valid");
160165
return false;

libraries/Zigbee/src/ep/ZigbeeContactSwitch.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class ZigbeeContactSwitch : public ZigbeeEP {
7777
bool restoreIASZoneEnroll();
7878

7979
// Check if the device is enrolled in the IAS Zone
80-
bool enrolled() { return _enrolled; }
80+
bool enrolled() {
81+
return _enrolled;
82+
}
8183

8284
private:
8385
void zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_enroll_response_message_t *message) override;

libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ bool ZigbeeDoorWindowHandle::requestIASZoneEnroll() {
154154

155155
bool ZigbeeDoorWindowHandle::restoreIASZoneEnroll() {
156156
esp_zb_lock_acquire(portMAX_DELAY);
157-
esp_zb_zcl_attr_t *ias_cie_attr = 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);
158-
esp_zb_zcl_attr_t *zone_id_attr = 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_ZONEID_ID);
157+
esp_zb_zcl_attr_t *ias_cie_attr =
158+
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);
159+
esp_zb_zcl_attr_t *zone_id_attr =
160+
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_ZONEID_ID);
159161
esp_zb_lock_release();
160-
162+
161163
if (ias_cie_attr == NULL || ias_cie_attr->data_p == NULL) {
162164
log_e("Failed to restore IAS Zone enroll: ias cie address attribute not found");
163165
return false;
@@ -166,12 +168,15 @@ bool ZigbeeDoorWindowHandle::restoreIASZoneEnroll() {
166168
log_e("Failed to restore IAS Zone enroll: zone id attribute not found");
167169
return false;
168170
}
169-
171+
170172
memcpy(_ias_cie_addr, (esp_zb_ieee_addr_t *)ias_cie_attr->data_p, sizeof(esp_zb_ieee_addr_t));
171173
_zone_id = (*(uint8_t *)zone_id_attr->data_p);
172-
173-
log_d("Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1], _ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]);
174-
174+
175+
log_d(
176+
"Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1],
177+
_ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]
178+
);
179+
175180
if (_zone_id == 0xFF) {
176181
log_e("Failed to restore IAS Zone enroll: zone id not valid");
177182
return false;

libraries/Zigbee/src/ep/ZigbeeDoorWindowHandle.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ class ZigbeeDoorWindowHandle : public ZigbeeEP {
8181
bool restoreIASZoneEnroll();
8282

8383
// Check if the device is enrolled in the IAS Zone
84-
bool enrolled() { return _enrolled; }
84+
bool enrolled() {
85+
return _enrolled;
86+
}
8587

8688
private:
8789
void zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_enroll_response_message_t *message) override;

libraries/Zigbee/src/ep/ZigbeeVibrationSensor.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ bool ZigbeeVibrationSensor::requestIASZoneEnroll() {
119119

120120
bool ZigbeeVibrationSensor::restoreIASZoneEnroll() {
121121
esp_zb_lock_acquire(portMAX_DELAY);
122-
esp_zb_zcl_attr_t *ias_cie_attr = 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);
123-
esp_zb_zcl_attr_t *zone_id_attr = 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_ZONEID_ID);
122+
esp_zb_zcl_attr_t *ias_cie_attr =
123+
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);
124+
esp_zb_zcl_attr_t *zone_id_attr =
125+
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_ZONEID_ID);
124126
esp_zb_lock_release();
125-
127+
126128
if (ias_cie_attr == NULL || ias_cie_attr->data_p == NULL) {
127129
log_e("Failed to restore IAS Zone enroll: ias cie address attribute not found");
128130
return false;
@@ -131,12 +133,15 @@ bool ZigbeeVibrationSensor::restoreIASZoneEnroll() {
131133
log_e("Failed to restore IAS Zone enroll: zone id attribute not found");
132134
return false;
133135
}
134-
136+
135137
memcpy(_ias_cie_addr, (esp_zb_ieee_addr_t *)ias_cie_attr->data_p, sizeof(esp_zb_ieee_addr_t));
136138
_zone_id = (*(uint8_t *)zone_id_attr->data_p);
137-
138-
log_d("Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1], _ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]);
139-
139+
140+
log_d(
141+
"Restored IAS Zone enroll: zone id(%d), ias cie address(%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X)", _zone_id, _ias_cie_addr[0], _ias_cie_addr[1],
142+
_ias_cie_addr[2], _ias_cie_addr[3], _ias_cie_addr[4], _ias_cie_addr[5], _ias_cie_addr[6], _ias_cie_addr[7]
143+
);
144+
140145
if (_zone_id == 0xFF) {
141146
log_e("Failed to restore IAS Zone enroll: zone id not valid");
142147
return false;

libraries/Zigbee/src/ep/ZigbeeVibrationSensor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ class ZigbeeVibrationSensor : public ZigbeeEP {
7474
bool restoreIASZoneEnroll();
7575

7676
// Check if the device is enrolled in the IAS Zone
77-
bool enrolled() { return _enrolled; }
77+
bool enrolled() {
78+
return _enrolled;
79+
}
7880

7981
private:
8082
void zbIASZoneEnrollResponse(const esp_zb_zcl_ias_zone_enroll_response_message_t *message) override;

0 commit comments

Comments
 (0)