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>
13static const char *
const TAG =
"zigbee.number";
19 ESP_LOGD(TAG,
"Set attribute endpoint: %d, present_value %f", this->
endpoint_,
21 ZB_ZCL_SET_ATTRIBUTE(this->
endpoint_, ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_SERVER_ROLE,
31 " Endpoint: %d, present_value %f",
36 zb_zcl_device_callback_param_t *p_device_cb_param = ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);
37 zb_zcl_device_callback_id_t device_cb_id = p_device_cb_param->device_cb_id;
38 zb_uint16_t cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;
39 zb_uint16_t attr_id = p_device_cb_param->cb_param.set_attr_value_param.attr_id;
41 switch (device_cb_id) {
43 case ZB_ZCL_SET_ATTR_VALUE_CB_ID:
44 if (cluster_id == ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT) {
45 ESP_LOGI(TAG,
"Analog output attribute setting");
48 *
reinterpret_cast<const float *
>(&p_device_cb_param->cb_param.set_attr_value_param.values.data32);
49 this->
defer([
this, value]() {
58 ESP_LOGI(TAG,
"Unhandled cluster attribute id: %d", cluster_id);
59 p_device_cb_param->status = RET_NOT_IMPLEMENTED;
63 p_device_cb_param->status = RET_NOT_IMPLEMENTED;
67 ESP_LOGD(TAG,
"%s status: %hd", __func__, p_device_cb_param->status);
72static zb_ret_t check_value_analog_server(zb_uint16_t attr_id, zb_uint8_t endpoint,
74 zb_ret_t ret = RET_OK;
79 ret = ZB_ZCL_CHECK_BOOL_VALUE(*value) ? RET_OK : RET_ERROR;
100 zb_zcl_add_cluster_handlers(ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_SERVER_ROLE,
101 esphome::zigbee::check_value_analog_server, (zb_zcl_cluster_write_attr_hook_t) NULL,
102 (zb_zcl_cluster_handler_t) NULL);
106 zb_zcl_add_cluster_handlers(ZB_ZCL_CLUSTER_ID_ANALOG_OUTPUT, ZB_ZCL_CLUSTER_CLIENT_ROLE,
107 (zb_zcl_cluster_check_value_t) NULL, (zb_zcl_cluster_write_attr_hook_t) NULL,
108 (zb_zcl_cluster_handler_t) NULL);
ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi defer)(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call.
NumberCall & set_value(float value)
void add_on_state_callback(std::function< void(float)> &&callback)
void add_callback(zb_uint8_t endpoint, std::function< void(zb_bufid_t bufid)> &&cb)
ZigbeeComponent * parent_
AnalogAttrsOutput * cluster_attributes_
void zcl_device_cb_(zb_bufid_t bufid)
void dump_config() override
const zb_uint8_t ZB_ZCL_ANALOG_OUTPUT_STATUS_FLAG_MAX_VALUE
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