2#if defined(USE_ZIGBEE) && defined(USE_NRF52) && defined(USE_NUMBER)
6#include <zboss_api_addons.h>
7#include <zb_nrf_platform.h>
8#include <zigbee/zigbee_app_utils.h>
9#include <zb_error_to_string.h>
18 ESP_LOGD(TAG,
"Set attribute endpoint: %d, present_value %f", this->
endpoint_,
20 ZB_ZCL_SET_ATTRIBUTE(this->
endpoint_, ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_SERVER_ROLE,
30 " Endpoint: %d, present_value %f",
35 zb_zcl_device_callback_param_t *p_device_cb_param = ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);
36 zb_zcl_device_callback_id_t device_cb_id = p_device_cb_param->device_cb_id;
37 zb_uint16_t cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;
38 zb_uint16_t attr_id = p_device_cb_param->cb_param.set_attr_value_param.attr_id;
40 switch (device_cb_id) {
42 case ZB_ZCL_SET_ATTR_VALUE_CB_ID:
43 if (cluster_id == ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT) {
44 ESP_LOGI(TAG,
"Analog output attribute setting");
47 *
reinterpret_cast<const float *
>(&p_device_cb_param->cb_param.set_attr_value_param.values.data32);
48 this->
defer([
this, value]() {
57 ESP_LOGI(TAG,
"Unhandled cluster attribute id: %d", cluster_id);
58 p_device_cb_param->status = RET_NOT_IMPLEMENTED;
62 p_device_cb_param->status = RET_NOT_IMPLEMENTED;
66 ESP_LOGD(TAG,
"%s status: %hd", __func__, p_device_cb_param->status);
71static zb_ret_t check_value_analog_server(zb_uint16_t attr_id, zb_uint8_t endpoint,
73 zb_ret_t
ret = RET_OK;
78 ret = ZB_ZCL_CHECK_BOOL_VALUE(*
value) ? RET_OK : RET_ERROR;
99 zb_zcl_add_cluster_handlers(ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_SERVER_ROLE,
100 esphome::zigbee::check_value_analog_server, (zb_zcl_cluster_write_attr_hook_t) NULL,
101 (zb_zcl_cluster_handler_t) NULL);
105 zb_zcl_add_cluster_handlers(ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_CLIENT_ROLE,
106 (zb_zcl_cluster_check_value_t) NULL, (zb_zcl_cluster_write_attr_hook_t) NULL,
107 (zb_zcl_cluster_handler_t) NULL);
void defer(const char *name, SchedulerCallback &&f)
Defer a callback to the next loop() call with a const char* name.
NumberCall & set_value(float value)
void add_on_state_callback(F &&callback)
ZigbeeComponent * parent_
AnalogAttrsOutput * cluster_attributes_
void on_zcl_device_event(zb_bufid_t bufid)
void dump_config() override
const zb_uint8_t ZB_ZCL_ANALOG_OUTPUT_STATUS_FLAG_MAX_VALUE
ESPHOME_LOG_TAG(TAG, "zigbee.time")
void zb_zcl_analog_output_init_server()
void zb_zcl_analog_output_init_client()
@ ZB_ZCL_ATTR_ANALOG_OUTPUT_PRESENT_VALUE_ID
@ ZB_ZCL_ATTR_ANALOG_OUTPUT_OUT_OF_SERVICE_ID
@ ZB_ZCL_ATTR_ANALOG_OUTPUT_STATUS_FLAG_ID