Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4eee08f

Browse filesBrowse files
ci(pre-commit): Apply automatic fixes
1 parent 12e993d commit 4eee08f
Copy full SHA for 4eee08f

File tree

Expand file treeCollapse file tree

3 files changed

+33
-23
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+33
-23
lines changed

‎libraries/Zigbee/examples/Zigbee_Thermostat/Zigbee_Thermostat.ino

Copy file name to clipboardExpand all lines: libraries/Zigbee/examples/Zigbee_Thermostat/Zigbee_Thermostat.ino
+17-11Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "Zigbee.h"
3535

3636
/* Zigbee thermostat configuration */
37-
#define THERMOSTAT_ENDPOINT_NUMBER 1
37+
#define THERMOSTAT_ENDPOINT_NUMBER 1
3838
#define USE_RECEIVE_TEMP_WITH_SOURCE 1
3939
uint8_t button = BOOT_PIN;
4040

@@ -59,7 +59,11 @@ void receiveSensorTempWithSource(float temperature, uint8_t src_endpoint, esp_zb
5959
if (src_address.addr_type == ESP_ZB_ZCL_ADDR_TYPE_SHORT) {
6060
Serial.printf("Temperature sensor value: %.2f°C from endpoint %d, address 0x%04x\n", temperature, src_endpoint, src_address.u.short_addr);
6161
} else {
62-
Serial.printf("Temperature sensor value: %.2f°C from endpoint %d, address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", temperature, src_endpoint, src_address.u.ieee_addr[7], src_address.u.ieee_addr[6], src_address.u.ieee_addr[5], src_address.u.ieee_addr[4], src_address.u.ieee_addr[3], src_address.u.ieee_addr[2], src_address.u.ieee_addr[1], src_address.u.ieee_addr[0]);
62+
Serial.printf(
63+
"Temperature sensor value: %.2f°C from endpoint %d, address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", temperature, src_endpoint,
64+
src_address.u.ieee_addr[7], src_address.u.ieee_addr[6], src_address.u.ieee_addr[5], src_address.u.ieee_addr[4], src_address.u.ieee_addr[3],
65+
src_address.u.ieee_addr[2], src_address.u.ieee_addr[1], src_address.u.ieee_addr[0]
66+
);
6367
}
6468
sensor_temp = temperature;
6569
}
@@ -78,12 +82,12 @@ void setup() {
7882
// Init button switch
7983
pinMode(button, INPUT_PULLUP);
8084

81-
// Set callback function for receiving temperature from sensor - Use only one option
82-
#if USE_RECEIVE_TEMP_WITH_SOURCE == 0
83-
zbThermostat.onTempReceive(receiveSensorTemp); // If you bound only one sensor or you don't need to know the source of the temperature
84-
#else
85-
zbThermostat.onTempReceiveWithSource(receiveSensorTempWithSource);
86-
#endif
85+
// Set callback function for receiving temperature from sensor - Use only one option
86+
#if USE_RECEIVE_TEMP_WITH_SOURCE == 0
87+
zbThermostat.onTempReceive(receiveSensorTemp); // If you bound only one sensor or you don't need to know the source of the temperature
88+
#else
89+
zbThermostat.onTempReceiveWithSource(receiveSensorTempWithSource);
90+
#endif
8791

8892
// Set callback function for receiving sensor configuration
8993
zbThermostat.onConfigReceive(receiveSensorConfig);
@@ -129,9 +133,11 @@ void setup() {
129133
std::list<zb_device_params_t *> boundSensors = zbThermostat.getBoundDevices();
130134
for (const auto &device : boundSensors) {
131135
Serial.println("--------------------------------");
132-
if(device->short_addr == 0x0000 || device->short_addr == 0xFFFF) { //End devices never have 0x0000 short address or 0xFFFF group address
133-
Serial.printf("Device on endpoint %d, IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\r\n", device->endpoint, device->ieee_addr[7], device->ieee_addr[6], device->ieee_addr[5], device->ieee_addr[4],
134-
device->ieee_addr[3], device->ieee_addr[2], device->ieee_addr[1], device->ieee_addr[0]);
136+
if (device->short_addr == 0x0000 || device->short_addr == 0xFFFF) { //End devices never have 0x0000 short address or 0xFFFF group address
137+
Serial.printf(
138+
"Device on endpoint %d, IEEE Address: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\r\n", device->endpoint, device->ieee_addr[7], device->ieee_addr[6],
139+
device->ieee_addr[5], device->ieee_addr[4], device->ieee_addr[3], device->ieee_addr[2], device->ieee_addr[1], device->ieee_addr[0]
140+
);
135141
zbThermostat.getSensorSettings(device->endpoint, device->ieee_addr);
136142
} else {
137143
Serial.printf("Device on endpoint %d, short address: 0x%x\r\n", device->endpoint, device->short_addr);

‎libraries/Zigbee/src/ZigbeeHandlers.cpp

Copy file name to clipboardExpand all lines: libraries/Zigbee/src/ZigbeeHandlers.cpp
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_mes
108108
// List through all Zigbee EPs and call the callback function, with the message
109109
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects.begin(); it != Zigbee.ep_objects.end(); ++it) {
110110
if (message->dst_endpoint == (*it)->getEndpoint()) {
111-
(*it)->zbAttributeRead(message->cluster, &message->attribute, message->src_endpoint, message->src_address); //method zbAttributeRead must be implemented in specific EP class
111+
(*it)->zbAttributeRead(
112+
message->cluster, &message->attribute, message->src_endpoint, message->src_address
113+
); //method zbAttributeRead must be implemented in specific EP class
112114
}
113115
}
114116
return ESP_OK;
@@ -142,7 +144,9 @@ static esp_err_t zb_cmd_read_attr_resp_handler(const esp_zb_zcl_cmd_read_attr_re
142144
} else if (message->info.cluster == ESP_ZB_ZCL_CLUSTER_ID_TIME) {
143145
(*it)->zbReadTimeCluster(&variable->attribute); //method zbReadTimeCluster implemented in the common EP class
144146
} else {
145-
(*it)->zbAttributeRead(message->info.cluster, &variable->attribute, message->info.src_endpoint, message->info.src_address); //method zbAttributeRead must be implemented in specific EP class
147+
(*it)->zbAttributeRead(
148+
message->info.cluster, &variable->attribute, message->info.src_endpoint, message->info.src_address
149+
); //method zbAttributeRead must be implemented in specific EP class
146150
}
147151
}
148152
variable = variable->next;

‎libraries/Zigbee/src/ep/ZigbeeThermostat.cpp

Copy file name to clipboardExpand all lines: libraries/Zigbee/src/ep/ZigbeeThermostat.cpp
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ void ZigbeeThermostat::getTemperature(uint8_t endpoint, esp_zb_ieee_addr_t ieee_
221221
read_req.attr_field = attributes;
222222

223223
log_i(
224-
"Sending 'read temperature' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6], ieee_addr[5],
225-
ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
224+
"Sending 'read temperature' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6],
225+
ieee_addr[5], ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
226226
);
227227
esp_zb_lock_acquire(portMAX_DELAY);
228228
esp_zb_zcl_read_attr_cmd_req(&read_req);
@@ -332,8 +332,8 @@ void ZigbeeThermostat::getSensorSettings(uint8_t endpoint, esp_zb_ieee_addr_t ie
332332
read_req.attr_field = attributes;
333333

334334
log_i(
335-
"Sending 'read sensor settings' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6], ieee_addr[5],
336-
ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
335+
"Sending 'read sensor settings' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6],
336+
ieee_addr[5], ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
337337
);
338338
esp_zb_lock_acquire(portMAX_DELAY);
339339
esp_zb_zcl_read_attr_cmd_req(&read_req);
@@ -364,7 +364,7 @@ void ZigbeeThermostat::setTemperatureReporting(uint16_t min_interval, uint16_t m
364364
.attrType = ESP_ZB_ZCL_ATTR_TYPE_S16,
365365
.min_interval = min_interval,
366366
.max_interval = max_interval,
367-
.reportable_change = (void*)&report_change,
367+
.reportable_change = (void *)&report_change,
368368
},
369369
};
370370
report_cmd.record_number = ZB_ARRAY_LENGHT(records);
@@ -392,7 +392,7 @@ void ZigbeeThermostat::setTemperatureReporting(uint16_t group_addr, uint16_t min
392392
.attrType = ESP_ZB_ZCL_ATTR_TYPE_S16,
393393
.min_interval = min_interval,
394394
.max_interval = max_interval,
395-
.reportable_change = (void*)&report_change,
395+
.reportable_change = (void *)&report_change,
396396
},
397397
};
398398
report_cmd.record_number = ZB_ARRAY_LENGHT(records);
@@ -421,7 +421,7 @@ void ZigbeeThermostat::setTemperatureReporting(uint8_t endpoint, uint16_t short_
421421
.attrType = ESP_ZB_ZCL_ATTR_TYPE_S16,
422422
.min_interval = min_interval,
423423
.max_interval = max_interval,
424-
.reportable_change = (void*)&report_change,
424+
.reportable_change = (void *)&report_change,
425425
},
426426
};
427427
report_cmd.record_number = ZB_ARRAY_LENGHT(records);
@@ -450,15 +450,15 @@ void ZigbeeThermostat::setTemperatureReporting(uint8_t endpoint, esp_zb_ieee_add
450450
.attrType = ESP_ZB_ZCL_ATTR_TYPE_S16,
451451
.min_interval = min_interval,
452452
.max_interval = max_interval,
453-
.reportable_change = (void*)&report_change,
453+
.reportable_change = (void *)&report_change,
454454
},
455455
};
456456
report_cmd.record_number = ZB_ARRAY_LENGHT(records);
457457
report_cmd.record_field = records;
458458

459459
log_i(
460-
"Sending 'configure reporting' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6], ieee_addr[5],
461-
ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
460+
"Sending 'configure reporting' command to endpoint %d, ieee address %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", endpoint, ieee_addr[7], ieee_addr[6],
461+
ieee_addr[5], ieee_addr[4], ieee_addr[3], ieee_addr[2], ieee_addr[1], ieee_addr[0]
462462
);
463463
esp_zb_lock_acquire(portMAX_DELAY);
464464
esp_zb_zcl_config_report_cmd_req(&report_cmd);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.