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() \
29 .radio_mode = ESP_ZIGBEE_RADIO_MODE_NATIVE, \
32uint8_t *
get_zcl_string(
const char *str, uint8_t max_size,
bool use_max_size =
false);
36 virtual void on_value(ezb_zcl_attribute_t attribute) = 0;
42 void setup()
override;
53 void add_cluster(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role);
59 uint16_t attr_id, uint8_t max_size, uint8_t attr_type, uint8_t attr_access, T
value);
62 void add_attr(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t max_size,
63 uint8_t attr_type, uint8_t attr_access, T
value);
96 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_END_DEVICE;
98 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_ROUTER;
106 uint16_t attr_id, uint8_t attr_type, uint8_t attr_access, T *value_p);
107 void handle_attribute_(ezb_zcl_message_info_t info, ezb_zcl_attribute_t attribute);
112 ezb_af_device_desc_t
dev_desc_ = ezb_af_create_device_desc();
139 uint8_t max_size, uint8_t attr_type, uint8_t attr_access, T
value) {
140 this->
add_attr<T>(
nullptr, endpoint_id, cluster_id, role, attr_id, max_size, attr_type, attr_access,
value);
145 uint16_t attr_id, uint8_t max_size, uint8_t attr_type, uint8_t attr_access, T
value) {
148 if constexpr (std::is_same<T, std::string>::value) {
150 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, attr_type, attr_access, zcl_str);
152 }
else if constexpr (std::is_convertible<T, const char *>::value) {
154 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, attr_type, attr_access, zcl_str);
157 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, attr_type, attr_access, &
value);
163 uint16_t attr_id, uint8_t attr_type, uint8_t attr_access, T *value_p) {
164 ezb_af_ep_desc_t ep_desc = ezb_af_device_get_endpoint_desc(this->
dev_desc_, endpoint_id);
165 if (ep_desc == NULL) {
168 ezb_zcl_cluster_desc_t cluster_desc = ezb_af_endpoint_get_cluster_desc(ep_desc, cluster_id, role);
169 if (cluster_desc == NULL) {
174 if (attr !=
nullptr) {
175 this->
attributes_[{endpoint_id, cluster_id, role, attr_id}] = attr;
BedjetMode mode
BedJet operating mode.
virtual void on_value(ezb_zcl_attribute_t attribute)=0
float get_setup_priority() const override
void add_attr_(ZigbeeAttributeInterface *attr, uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t attr_type, uint8_t attr_access, T *value_p)
CallbackManager< void(bool)> join_cb_
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_
void update_basic_cluster_(ezb_af_ep_desc_t ep_desc)
struct esphome::zigbee::ZigbeeComponent::@207 basic_cluster_data_
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_
void on_parent_link_failure_()
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_
uint32_t last_link_failure_ms_
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
void add_attr(ZigbeeAttributeInterface *attr, uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t max_size, uint8_t attr_type, uint8_t attr_access, T value)
std::map< std::tuple< uint8_t, uint16_t, uint8_t, uint16_t >, ZigbeeAttributeInterface * > attributes_
uint32_t first_link_failure_ms_
void end_parent_link_failures_(uint8_t seq)
esphome::EventPool< ZBEvent, MAX_ZB_QUEUE_SIZE - 1 > zb_event_pool_
void set_sleepy(bool sleepy)
uint8_t link_failure_seq_
ezb_af_device_desc_t dev_desc_
void reset_parent_link_failures_()
uint32_t saved_keep_alive_
uint8_t * get_zcl_string(const char *str, uint8_t max_size, bool use_max_size)
ezb_err_t esphome_zb_cluster_add_or_update_attr(uint16_t cluster_id, ezb_zcl_cluster_desc_t cluster_desc, uint16_t attr_id, uint8_t attr_type, uint8_t attr_access, void *value_p)