Skip to content

feat(zigbee): Add endpoint identification in read handlers + command structures fix #11425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#include "Zigbee.h"

/* Zigbee thermostat configuration */
#define THERMOSTAT_ENDPOINT_NUMBER 5
#define THERMOSTAT_ENDPOINT_NUMBER 1
#define USE_RECIEVE_TEMP_WITH_SOURCE 1
uint8_t button = BOOT_PIN;

ZigbeeThermostat zbThermostat = ZigbeeThermostat(THERMOSTAT_ENDPOINT_NUMBER);
Expand All @@ -48,13 +49,24 @@ float sensor_tolerance;
struct tm timeinfo = {}; // Time structure for Time cluster

/****************** Temperature sensor handling *******************/
#if USE_RECIEVE_TEMP_WITH_SOURCE == 0
void recieveSensorTemp(float temperature) {
Serial.printf("Temperature sensor value: %.2f°C\n", temperature);
sensor_temp = temperature;
}
#else
void recieveSensorTempWithSource(float temperature, uint8_t src_endpoint, esp_zb_zcl_addr_t src_address) {
if (src_address.addr_type == ESP_ZB_ZCL_ADDR_TYPE_SHORT) {
Serial.printf("Temperature sensor value: %.2f°C from endpoint %d, address 0x%04x\n", temperature, src_endpoint, src_address.u.short_addr);
} else {
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]);
}
sensor_temp = temperature;
}
#endif

void recieveSensorConfig(float min_temp, float max_temp, float tolerance) {
Serial.printf("Temperature sensor settings: min %.2f°C, max %.2f°C, tolerance %.2f°C\n", min_temp, max_temp, tolerance);
Serial.printf("Temperature sensor config: min %.2f°C, max %.2f°C, tolerance %.2f°C\n", min_temp, max_temp, tolerance);
sensor_min_temp = min_temp;
sensor_max_temp = max_temp;
sensor_tolerance = tolerance;
Expand All @@ -66,8 +78,14 @@ void setup() {
// Init button switch
pinMode(button, INPUT_PULLUP);

// Set callback functions for temperature and configuration receive
zbThermostat.onTempRecieve(recieveSensorTemp);
// Set callback function for recieving temperature from sensor - Use only one option
#if USE_RECIEVE_TEMP_WITH_SOURCE == 0
zbThermostat.onTempRecieve(recieveSensorTemp); // If you bound only one sensor or you don't need to know the source of the temperature
#else
zbThermostat.onTempRecieveWithSource(recieveSensorTempWithSource);
#endif

// Set callback function for recieving sensor configuration
zbThermostat.onConfigRecieve(recieveSensorConfig);

//Optional: set Zigbee device name and model
Expand Down Expand Up @@ -107,19 +125,28 @@ void setup() {

Serial.println();

// Get temperature sensor configuration
zbThermostat.getSensorSettings();
// Get temperature sensor configuration for all bound sensors by endpoint number and address
std::list<zb_device_params_t *> boundSensors = zbThermostat.getBoundDevices();
for (const auto &device : boundSensors) {
Serial.println("--------------------------------");
if(device->short_addr == 0x0000 || device->short_addr == 0xFFFF) { //End devices never have 0x0000 short address or 0xFFFF group address
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],
device->ieee_addr[3], device->ieee_addr[2], device->ieee_addr[1], device->ieee_addr[0]);
zbThermostat.getSensorSettings(device->endpoint, device->ieee_addr);
} else {
Serial.printf("Device on endpoint %d, short address: 0x%x\r\n", device->endpoint, device->short_addr);
zbThermostat.getSensorSettings(device->endpoint, device->short_addr);
}
}
}

void loop() {
// Handle button switch in loop()
if (digitalRead(button) == LOW) { // Push button pressed

// Key debounce handling
while (digitalRead(button) == LOW) {
delay(50);
}

// Set reporting interval for temperature sensor
zbThermostat.setTemperatureReporting(0, 10, 2);
}
Expand All @@ -130,5 +157,6 @@ void loop() {
last_print = millis();
int temp_percent = (int)((sensor_temp - sensor_min_temp) / (sensor_max_temp - sensor_min_temp) * 100);
Serial.printf("Loop temperature info: %.2f°C (%d %%)\n", sensor_temp, temp_percent);
zbThermostat.printBoundDevices(Serial);
}
}
12 changes: 6 additions & 6 deletions libraries/Zigbee/src/ZigbeeEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ bool ZigbeeEP::setBatteryVoltage(uint8_t voltage) {

bool ZigbeeEP::reportBatteryPercentage() {
/* Send report attributes command */
esp_zb_zcl_report_attr_cmd_t report_attr_cmd;
esp_zb_zcl_report_attr_cmd_t report_attr_cmd = {0};
report_attr_cmd.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
report_attr_cmd.attributeID = ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID;
report_attr_cmd.direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI;
Expand All @@ -166,7 +166,7 @@ bool ZigbeeEP::reportBatteryPercentage() {

char *ZigbeeEP::readManufacturer(uint8_t endpoint, uint16_t short_addr, esp_zb_ieee_addr_t ieee_addr) {
/* Read peer Manufacture Name & Model Identifier */
esp_zb_zcl_read_attr_cmd_t read_req;
esp_zb_zcl_read_attr_cmd_t read_req = {0};

if (short_addr != 0) {
read_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
Expand Down Expand Up @@ -204,7 +204,7 @@ char *ZigbeeEP::readManufacturer(uint8_t endpoint, uint16_t short_addr, esp_zb_i

char *ZigbeeEP::readModel(uint8_t endpoint, uint16_t short_addr, esp_zb_ieee_addr_t ieee_addr) {
/* Read peer Manufacture Name & Model Identifier */
esp_zb_zcl_read_attr_cmd_t read_req;
esp_zb_zcl_read_attr_cmd_t read_req = {0};

if (short_addr != 0) {
read_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
Expand Down Expand Up @@ -375,7 +375,7 @@ bool ZigbeeEP::setTimezone(int32_t gmt_offset) {

tm ZigbeeEP::getTime(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_addr_t ieee_addr) {
/* Read peer time */
esp_zb_zcl_read_attr_cmd_t read_req;
esp_zb_zcl_read_attr_cmd_t read_req = {0};

if (short_addr >= 0) {
read_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
Expand Down Expand Up @@ -427,7 +427,7 @@ tm ZigbeeEP::getTime(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_addr_t ie

int32_t ZigbeeEP::getTimezone(uint8_t endpoint, int32_t short_addr, esp_zb_ieee_addr_t ieee_addr) {
/* Read peer timezone */
esp_zb_zcl_read_attr_cmd_t read_req;
esp_zb_zcl_read_attr_cmd_t read_req = {0};

if (short_addr >= 0) {
read_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_ENDP_PRESENT;
Expand Down Expand Up @@ -543,7 +543,7 @@ static void findOTAServer(esp_zb_zdp_status_t zdo_status, uint16_t addr, uint8_t
}

void ZigbeeEP::requestOTAUpdate() {
esp_zb_zdo_match_desc_req_param_t req;
esp_zb_zdo_match_desc_req_param_t req = {0};
uint16_t cluster_list[] = {ESP_ZB_ZCL_CLUSTER_ID_OTA_UPGRADE};

/* Match the OTA server of coordinator */
Expand Down
2 changes: 1 addition & 1 deletion libraries/Zigbee/src/ZigbeeEP.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ZigbeeEP {

// list of all handlers function calls, to be override by EPs implementation
virtual void zbAttributeSet(const esp_zb_zcl_set_attr_value_message_t *message) {};
virtual void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) {};
virtual void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute, uint8_t src_endpoint, esp_zb_zcl_addr_t src_address) {};
virtual void zbReadBasicCluster(const esp_zb_zcl_attribute_t *attribute); //already implemented
virtual void zbIdentify(const esp_zb_zcl_set_attr_value_message_t *message);
virtual void zbWindowCoveringMovementCmd(const esp_zb_zcl_window_covering_movement_message_t *message) {};
Expand Down
4 changes: 2 additions & 2 deletions libraries/Zigbee/src/ZigbeeHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_mes
// List through all Zigbee EPs and call the callback function, with the message
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects.begin(); it != Zigbee.ep_objects.end(); ++it) {
if (message->dst_endpoint == (*it)->getEndpoint()) {
(*it)->zbAttributeRead(message->cluster, &message->attribute); //method zbAttributeRead must be implemented in specific EP class
(*it)->zbAttributeRead(message->cluster, &message->attribute, message->src_endpoint, message->src_address); //method zbAttributeRead must be implemented in specific EP class
}
}
return ESP_OK;
Expand Down Expand Up @@ -142,7 +142,7 @@ static esp_err_t zb_cmd_read_attr_resp_handler(const esp_zb_zcl_cmd_read_attr_re
} else if (message->info.cluster == ESP_ZB_ZCL_CLUSTER_ID_TIME) {
(*it)->zbReadTimeCluster(&variable->attribute); //method zbReadTimeCluster implemented in the common EP class
} else {
(*it)->zbAttributeRead(message->info.cluster, &variable->attribute); //method zbAttributeRead must be implemented in specific EP class
(*it)->zbAttributeRead(message->info.cluster, &variable->attribute, message->info.src_endpoint, message->info.src_address); //method zbAttributeRead must be implemented in specific EP class
}
}
variable = variable->next;
Expand Down
48 changes: 24 additions & 24 deletions libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ZigbeeColorDimmerSwitch::findCb(esp_zb_zdp_status_t zdo_status, uint16_t ad
ZigbeeColorDimmerSwitch *instance = static_cast<ZigbeeColorDimmerSwitch *>(user_ctx);
if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS) {
log_d("Found light endpoint");
esp_zb_zdo_bind_req_param_t bind_req;
esp_zb_zdo_bind_req_param_t bind_req = {0};
zb_device_params_t *light = (zb_device_params_t *)malloc(sizeof(zb_device_params_t));
light->endpoint = endpoint;
light->short_addr = addr;
Expand Down Expand Up @@ -97,7 +97,7 @@ void ZigbeeColorDimmerSwitch::findEndpoint(esp_zb_zdo_match_desc_req_param_t *cm
// Methods to control the light
void ZigbeeColorDimmerSwitch::lightToggle() {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.on_off_cmd_id = ESP_ZB_ZCL_CMD_ON_OFF_TOGGLE_ID;
Expand All @@ -112,7 +112,7 @@ void ZigbeeColorDimmerSwitch::lightToggle() {

void ZigbeeColorDimmerSwitch::lightToggle(uint16_t group_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = group_addr;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT;
Expand All @@ -128,7 +128,7 @@ void ZigbeeColorDimmerSwitch::lightToggle(uint16_t group_addr) {

void ZigbeeColorDimmerSwitch::lightToggle(uint8_t endpoint, uint16_t short_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
Expand All @@ -145,7 +145,7 @@ void ZigbeeColorDimmerSwitch::lightToggle(uint8_t endpoint, uint16_t short_addr)

void ZigbeeColorDimmerSwitch::lightToggle(uint8_t endpoint, esp_zb_ieee_addr_t ieee_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
Expand All @@ -165,7 +165,7 @@ void ZigbeeColorDimmerSwitch::lightToggle(uint8_t endpoint, esp_zb_ieee_addr_t i

void ZigbeeColorDimmerSwitch::lightOn() {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.on_off_cmd_id = ESP_ZB_ZCL_CMD_ON_OFF_ON_ID;
Expand All @@ -180,7 +180,7 @@ void ZigbeeColorDimmerSwitch::lightOn() {

void ZigbeeColorDimmerSwitch::lightOn(uint16_t group_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = group_addr;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT;
Expand All @@ -196,7 +196,7 @@ void ZigbeeColorDimmerSwitch::lightOn(uint16_t group_addr) {

void ZigbeeColorDimmerSwitch::lightOn(uint8_t endpoint, uint16_t short_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
Expand All @@ -213,7 +213,7 @@ void ZigbeeColorDimmerSwitch::lightOn(uint8_t endpoint, uint16_t short_addr) {

void ZigbeeColorDimmerSwitch::lightOn(uint8_t endpoint, esp_zb_ieee_addr_t ieee_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
Expand All @@ -233,7 +233,7 @@ void ZigbeeColorDimmerSwitch::lightOn(uint8_t endpoint, esp_zb_ieee_addr_t ieee_

void ZigbeeColorDimmerSwitch::lightOff() {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.on_off_cmd_id = ESP_ZB_ZCL_CMD_ON_OFF_OFF_ID;
Expand All @@ -248,7 +248,7 @@ void ZigbeeColorDimmerSwitch::lightOff() {

void ZigbeeColorDimmerSwitch::lightOff(uint16_t group_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = group_addr;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT;
Expand All @@ -264,7 +264,7 @@ void ZigbeeColorDimmerSwitch::lightOff(uint16_t group_addr) {

void ZigbeeColorDimmerSwitch::lightOff(uint8_t endpoint, uint16_t short_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
Expand All @@ -281,7 +281,7 @@ void ZigbeeColorDimmerSwitch::lightOff(uint8_t endpoint, uint16_t short_addr) {

void ZigbeeColorDimmerSwitch::lightOff(uint8_t endpoint, esp_zb_ieee_addr_t ieee_addr) {
if (_is_bound) {
esp_zb_zcl_on_off_cmd_t cmd_req;
esp_zb_zcl_on_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
Expand All @@ -301,7 +301,7 @@ void ZigbeeColorDimmerSwitch::lightOff(uint8_t endpoint, esp_zb_ieee_addr_t ieee

void ZigbeeColorDimmerSwitch::lightOffWithEffect(uint8_t effect_id, uint8_t effect_variant) {
if (_is_bound) {
esp_zb_zcl_on_off_off_with_effect_cmd_t cmd_req;
esp_zb_zcl_on_off_off_with_effect_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.effect_id = effect_id;
Expand All @@ -317,7 +317,7 @@ void ZigbeeColorDimmerSwitch::lightOffWithEffect(uint8_t effect_id, uint8_t effe

void ZigbeeColorDimmerSwitch::lightOnWithSceneRecall() {
if (_is_bound) {
esp_zb_zcl_on_off_on_with_recall_global_scene_cmd_t cmd_req;
esp_zb_zcl_on_off_on_with_recall_global_scene_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
log_v("Sending 'light on with scene recall' command");
Expand All @@ -331,7 +331,7 @@ void ZigbeeColorDimmerSwitch::lightOnWithSceneRecall() {

void ZigbeeColorDimmerSwitch::lightOnWithTimedOff(uint8_t on_off_control, uint16_t time_on, uint16_t time_off) {
if (_is_bound) {
esp_zb_zcl_on_off_on_with_timed_off_cmd_t cmd_req;
esp_zb_zcl_on_off_on_with_timed_off_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.on_off_control = on_off_control; //TODO: Test how it works, then maybe change API
Expand All @@ -348,7 +348,7 @@ void ZigbeeColorDimmerSwitch::lightOnWithTimedOff(uint8_t on_off_control, uint16

void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level) {
if (_is_bound) {
esp_zb_zcl_move_to_level_cmd_t cmd_req;
esp_zb_zcl_move_to_level_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.level = level;
Expand All @@ -364,7 +364,7 @@ void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level) {

void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level, uint16_t group_addr) {
if (_is_bound) {
esp_zb_zcl_move_to_level_cmd_t cmd_req;
esp_zb_zcl_move_to_level_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = group_addr;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT;
Expand All @@ -381,7 +381,7 @@ void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level, uint16_t group_addr)

void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level, uint8_t endpoint, uint16_t short_addr) {
if (_is_bound) {
esp_zb_zcl_move_to_level_cmd_t cmd_req;
esp_zb_zcl_move_to_level_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
Expand All @@ -399,7 +399,7 @@ void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level, uint8_t endpoint, uin

void ZigbeeColorDimmerSwitch::setLightLevel(uint8_t level, uint8_t endpoint, esp_zb_ieee_addr_t ieee_addr) {
if (_is_bound) {
esp_zb_zcl_move_to_level_cmd_t cmd_req;
esp_zb_zcl_move_to_level_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
Expand All @@ -422,7 +422,7 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t
if (_is_bound) {
espXyColor_t xy_color = espRgbToXYColor(red, green, blue);

esp_zb_zcl_color_move_to_color_cmd_t cmd_req;
esp_zb_zcl_color_move_to_color_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT;
cmd_req.color_x = xy_color.x;
Expand All @@ -441,7 +441,7 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t
if (_is_bound) {
espXyColor_t xy_color = espRgbToXYColor(red, green, blue);

esp_zb_zcl_color_move_to_color_cmd_t cmd_req;
esp_zb_zcl_color_move_to_color_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = group_addr;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_16_GROUP_ENDP_NOT_PRESENT;
Expand All @@ -461,7 +461,7 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t
if (_is_bound) {
espXyColor_t xy_color = espRgbToXYColor(red, green, blue);

esp_zb_zcl_color_move_to_color_cmd_t cmd_req;
esp_zb_zcl_color_move_to_color_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.zcl_basic_cmd.dst_addr_u.addr_short = short_addr;
Expand All @@ -482,7 +482,7 @@ void ZigbeeColorDimmerSwitch::setLightColor(uint8_t red, uint8_t green, uint8_t
if (_is_bound) {
espXyColor_t xy_color = espRgbToXYColor(red, green, blue);

esp_zb_zcl_color_move_to_color_cmd_t cmd_req;
esp_zb_zcl_color_move_to_color_cmd_t cmd_req = {0};
cmd_req.zcl_basic_cmd.src_endpoint = _endpoint;
cmd_req.zcl_basic_cmd.dst_endpoint = endpoint;
cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_64_ENDP_PRESENT;
Expand Down
Loading
Loading