Update the Status of a Zigbee Light
Posted: Wed Jul 24, 2024 9:14 pm
Hello,
I have a working dimmable light that I can control fine using zigbee2mqtt. However my device has a button, and I've configured the button so it can turn the light on and off.
I'm having trouble finding the right API calls in the documentation on how I would properly update the Zigbee network about the changed light status.
I have tried modifying the example code from the temperature sensor and just exchange endpoint and cluster, but this does not seem to work:
What would be the proper way to update the zigbee network on the updated state of my device? It's only about the level control and the on_off clusters.
thank you!
I have a working dimmable light that I can control fine using zigbee2mqtt. However my device has a button, and I've configured the button so it can turn the light on and off.
I'm having trouble finding the right API calls in the documentation on how I would properly update the Zigbee network about the changed light status.
I have tried modifying the example code from the temperature sensor and just exchange endpoint and cluster, but this does not seem to work:
Code: Select all
esp_zb_lock_acquire(portMAX_DELAY);
esp_zb_zcl_set_attribute_val(HA_COLOR_DIMMABLE_LIGHT_ENDPOINT,
ESP_ZB_ZCL_CLUSTER_ID_LEVEL_CONTROL, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
ESP_ZB_ZCL_ATTR_LEVEL_CONTROL_CURRENT_LEVEL_ID, &light_level, false);
esp_zb_zcl_set_attribute_val(HA_COLOR_DIMMABLE_LIGHT_ENDPOINT,
ESP_ZB_ZCL_CLUSTER_ID_ON_OFF, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
ESP_ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID, &light_state, false);
esp_zb_lock_release();
thank you!