Skip to content

feat(zigbee): Support min/max setting for Analog EP #11451

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 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
ci(pre-commit): Apply automatic fixes
  • Loading branch information
pre-commit-ci-lite[bot] authored Jun 10, 2025
commit ec747bb029aec933eb0502c1ed3ab4d088ff1702
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void setup() {
zbAnalogDevice.setAnalogOutputResolution(1);

// Set the min and max values for the analog output which is used by HA to limit the range of the analog output
zbAnalogDevice.setAnalogOutputMinMax(-10000, 10000); //-10000 to 10000 RPM
zbAnalogDevice.setAnalogOutputMinMax(-10000, 10000); //-10000 to 10000 RPM

// If analog output cluster is added, set callback function for analog output change
zbAnalogDevice.onAnalogOutputChange(onAnalogOutputChange);
Expand Down
7 changes: 3 additions & 4 deletions libraries/Zigbee/src/ep/ZigbeeAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ bool ZigbeeAnalog::addAnalogInput() {
"Analog Input";
uint32_t application_type = 0x00000000 | (ESP_ZB_ZCL_AI_GROUP_ID << 24);
float resolution = 0.1; // Default resolution of 0.1
float min = -FLT_MAX; // Default min value for float
float max = FLT_MAX; // Default max value for float
float min = -FLT_MAX; // Default min value for float
float max = FLT_MAX; // Default max value for float

esp_err_t ret = esp_zb_analog_input_cluster_add_attr(esp_zb_analog_input_cluster, ESP_ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID, (void *)default_description);
if (ret != ESP_OK) {
Expand Down Expand Up @@ -93,7 +93,7 @@ bool ZigbeeAnalog::addAnalogOutput() {
uint32_t application_type = 0x00000000 | (ESP_ZB_ZCL_AO_GROUP_ID << 24);
float resolution = 1; // Default resolution of 1
float min = -FLT_MAX; // Default min value for float
float max = FLT_MAX; // Default max value for float
float max = FLT_MAX; // Default max value for float

esp_err_t ret =
esp_zb_analog_output_cluster_add_attr(esp_zb_analog_output_cluster, ESP_ZB_ZCL_ATTR_ANALOG_OUTPUT_DESCRIPTION_ID, (void *)default_description);
Expand Down Expand Up @@ -126,7 +126,6 @@ bool ZigbeeAnalog::addAnalogOutput() {
return false;
}


ret = esp_zb_cluster_list_add_analog_output_cluster(_cluster_list, esp_zb_analog_output_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
if (ret != ESP_OK) {
log_e("Failed to add Analog Output cluster: 0x%x: %s", ret, esp_err_to_name(ret));
Expand Down
Loading