11#include "esp_zigbee.h"
17#ifdef USE_BINARY_SENSOR
24static const uint16_t ED_KEEP_ALIVE = 3000;
25static const uint8_t MAX_CHILDREN = 10;
26static const uint32_t EZB_PRIMARY_CHANNEL_MASK = 0x07FFF800U;
28#define EZB_DEFAULT_RADIO_CONFIG() \
29 { .radio_mode = ESP_ZIGBEE_RADIO_MODE_NATIVE, }
31uint8_t *
get_zcl_string(
const char *str, uint8_t max_size,
bool use_max_size =
false);
35class ZigbeeComponent final :
public Component {
38 void setup()
override;
43 void add_cluster(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role);
48 void add_attr(ZigbeeAttribute *attr, uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id,
49 uint8_t max_size, T value);
52 void add_attr(uint8_t endpoint_id, uint16_t cluster_id, uint8_t role, uint16_t attr_id, uint8_t max_size, T value);
58 esp_zigbee_lock_acquire(portMAX_DELAY);
59 esp_zigbee_factory_reset();
60 esp_zigbee_lock_release();
81 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_END_DEVICE;
83 ezb_nwk_device_type_t
device_role_ = EZB_NWK_DEVICE_TYPE_ROUTER;
99 uint8_t max_size, T value) {
100 this->
add_attr<T>(
nullptr, endpoint_id, cluster_id, role, attr_id, max_size, value);
105 uint16_t attr_id, uint8_t max_size, T value) {
108 if constexpr (std::is_same<T, std::string>::value) {
110 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, zcl_str);
112 }
else if constexpr (std::is_convertible<T, const char *>::value) {
114 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, zcl_str);
117 add_attr_(attr, endpoint_id, cluster_id, role, attr_id, &value);
123 uint16_t attr_id, T *value_p) {
124 ezb_af_ep_desc_t ep_desc = ezb_af_device_get_endpoint_desc(this->
dev_desc_, endpoint_id);
125 if (ep_desc == NULL) {
128 ezb_zcl_cluster_desc_t cluster_desc = ezb_af_endpoint_get_cluster_desc(ep_desc, cluster_id, role);
129 if (cluster_desc == NULL) {
134 if (attr !=
nullptr) {
135 this->
attributes_[{endpoint_id, cluster_id, role, attr_id}] = attr;
BedjetMode mode
BedJet operating mode.
CallbackManager< void(bool)> join_cb_
bool is_battery_powered()
void create_default_cluster(uint8_t endpoint_id, uint16_t device_id)
struct esphome::zigbee::ZigbeeComponent::@200 basic_cluster_data_
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)
std::atomic< bool > joined
static void esp_zigbee_alarm_bdb_commissioning(ezb_bdb_comm_mode_mask_t mode)
static bool app_signal_handler(const ezb_app_signal_t *app_signal)
std::atomic< bool > factory_new
ezb_nwk_device_type_t device_role_
void add_on_join_callback(F &&cb)
void dump_config() override
void set_basic_cluster(const char *model, const char *manufacturer, uint8_t power_source)
std::atomic< bool > started
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_err_t esphome_zb_cluster_add_or_update_attr(uint16_t cluster_id, ezb_zcl_cluster_desc_t cluster_desc, uint16_t attr_id, void *value_p)