Skip to content

Commit 9a354ae

Browse files
committed
Change virtual methods to callbacks (TODO)
1 parent 9a86d6f commit 9a354ae

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

libraries/Zigbee/src/ZigbeeEP.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) {
6262
// esp_zb_cluster_add_attr function
6363
}
6464

65+
//TODO: Separate manufacturer and model reading
6566
void ZigbeeEP::readManufacturerAndModel(uint8_t endpoint, uint16_t short_addr) {
6667
/* Read peer Manufacture Name & Model Identifier */
6768
esp_zb_zcl_read_attr_cmd_t read_req;
@@ -79,8 +80,13 @@ void ZigbeeEP::readManufacturerAndModel(uint8_t endpoint, uint16_t short_addr) {
7980
read_req.attr_field = attributes;
8081

8182
esp_zb_zcl_read_attr_cmd_req(&read_req);
83+
84+
//Wait for response or timeout
85+
//Semaphore take
8286
}
8387

88+
89+
8490
#pragma GCC diagnostic push
8591
#pragma GCC diagnostic ignored "-Wunused-variable"
8692

libraries/Zigbee/src/ep/ZigbeeThermostat.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,25 @@ void ZigbeeThermostat::getTemperature(){
137137
read_req.clusterID = ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;
138138

139139
uint16_t attributes[] = {
140-
ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID,
140+
ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID
141+
};
142+
read_req.attr_number = ZB_ARRAY_LENTH(attributes);
143+
read_req.attr_field = attributes;
144+
145+
log_i("Sending 'read temperature' command");
146+
esp_zb_lock_acquire(portMAX_DELAY);
147+
esp_zb_zcl_read_attr_cmd_req(&read_req);
148+
esp_zb_lock_release();
149+
}
150+
151+
void ZigbeeThermostat::getSensorSettings(){
152+
/* Send "read attributes" command to the bound sensor */
153+
esp_zb_zcl_read_attr_cmd_t read_req;
154+
read_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
155+
read_req.zcl_basic_cmd.src_endpoint = _endpoint;
156+
read_req.clusterID = ESP_ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT;
157+
158+
uint16_t attributes[] = {
141159
ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_MIN_VALUE_ID,
142160
ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_MAX_VALUE_ID,
143161
ESP_ZB_ZCL_ATTR_TEMP_MEASUREMENT_TOLERANCE_ID

0 commit comments

Comments
 (0)