11#include "esp_zigbee.h"
23static const uint8_t MAX_CHILDREN = 10;
24static const uint32_t EZB_PRIMARY_CHANNEL_MASK = 0x07FFF800U;
25static constexpr uint8_t MAX_ZB_QUEUE_SIZE = 32;
27#define EZB_DEFAULT_RADIO_CONFIG() \
28 { .radio_mode = ESP_ZIGBEE_RADIO_MODE_NATIVE, }
30uint8_t *
get_zcl_string(
const char *str, uint8_t max_size,
bool use_max_size =
false);
41 void setup()
override;
49 void add_cluster(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role);
55 uint8_t max_size, T value);
58 void add_attr(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t max_size, T value);
91 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_END_DEVICE;
93 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_ROUTER;
99 void handle_attribute_(ezb_zcl_message_info_t info, ezb_zcl_attribute_t attribute);
105 ezb_af_device_desc_t
dev_desc_ = ezb_af_create_device_desc();
123 bool string_attr_exists_(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id);
128 uint8_t max_size, T value) {
129 this->
add_attr<T>(
nullptr, endpoint_id, cluster_id, role, attr_id, max_size, value);
134 uint16_t attr_id, uint8_t max_size, T value) {
137 if constexpr (std::is_same<T, std::string>::value) {
139 if (attr !=
nullptr) {
140 this->
attributes_[{endpoint_id, cluster_id, role, attr_id}] = attr;
145 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, zcl_str);
147 }
else if constexpr (std::is_convertible<T, const char *>::value) {
149 if (attr !=
nullptr) {
150 this->
attributes_[{endpoint_id, cluster_id, role, attr_id}] = attr;
155 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, zcl_str);
158 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, &value);
164 uint16_t attr_id, T *value_p) {
165 ezb_af_ep_desc_t ep_desc = ezb_af_device_get_endpoint_desc(this->
dev_desc_, endpoint_id);
166 if (ep_desc == NULL) {
169 ezb_zcl_cluster_desc_t cluster_desc = ezb_af_endpoint_get_cluster_desc(ep_desc, cluster_id, role);
170 if (cluster_desc == NULL) {
174 ezb_zcl_attr_desc_t attr_desc = ezb_zcl_cluster_get_attr_desc(cluster_desc, attr_id, EZB_ZCL_STD_MANUF_CODE);
176 if (attr_desc != NULL) {
177 static_assert(
sizeof(*value_p) <= 4);
180 memcpy(&attr_value.
value, value_p,
sizeof(*value_p));
186 if (attr !=
nullptr) {
187 this->
attributes_[{endpoint_id, cluster_id, role, attr_id}] = attr;
BedjetMode mode
BedJet operating mode.
std::vector< AttrValue > attr_values_
CallbackManager< void(bool)> join_cb_
struct esphome::zigbee::ZigbeeComponent::@206 basic_cluster_data_
bool string_attr_exists_(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id)
bool is_battery_powered()
void add_on_start_callback(F &&cb)
void create_default_cluster(uint8_t endpoint_id, uint16_t device_id)
friend void enqueue_zb_event(Args... args)
std::atomic< bool > factory_new_
void handle_attribute_(ezb_zcl_message_info_t info, ezb_zcl_attribute_t attribute)
esphome::LockFreeQueue< ZBEvent, MAX_ZB_QUEUE_SIZE > zb_events_
std::map< std::tuple< uint8_t, uint16_t, uint8_t, uint16_t >, ZigbeeAttribute * > attributes_
void update_basic_cluster_(ezb_af_ep_desc_t ep_desc)
void add_cluster(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role)
static void esp_zigbee_alarm_bdb_commissioning(ezb_bdb_comm_mode_mask_t mode)
LazyCallbackManager< void()> start_cb_
static bool app_signal_handler(const ezb_app_signal_t *app_signal)
std::atomic< bool > joined_
std::atomic< bool > started_
void set_keep_alive(uint32_t keep_alive)
std::atomic< bool > join_pending_
ezb_nwk_device_type_t device_role_
void set_basic_cluster(const char *model, const char *manufacturer, const char *location, const char *sw_build_id, uint8_t power_source, uint8_t app_version)
void add_on_join_callback(F &&cb)
void dump_config() override
esphome::EventPool< ZBEvent, MAX_ZB_QUEUE_SIZE - 1 > zb_event_pool_
void set_sleepy(bool sleepy)
void add_attr(ZigbeeAttribute *attr, uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t max_size, T value)
ezb_af_device_desc_t dev_desc_
void add_attr_(ZigbeeAttribute *attr, uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, T *value_p)
uint8_t * get_zcl_string(const char *str, uint8_t max_size, bool use_max_size)
ezb_zcl_attr_desc_t attr_desc
ezb_err_t esphome_zb_cluster_add_attr(uint16_t cluster_id, ezb_zcl_cluster_desc_t cluster_desc, uint16_t attr_id, void *value_p)