ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
zigbee_binary_sensor_zephyr.h
Go to the documentation of this file.
1#pragma once
3#if defined(USE_ZIGBEE) && defined(USE_NRF52) && defined(USE_BINARY_SENSOR)
7extern "C" {
8#include <zboss_api.h>
9#include <zboss_api_addons.h>
10}
11
12// it should have been defined inside of sdk. It is missing though
13#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID(data_ptr) \
14 {ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID, ZB_ZCL_ATTR_TYPE_CHAR_STRING, ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
15 (ZB_ZCL_NON_MANUFACTURER_SPECIFIC), (void *) (data_ptr)}
16
17// copy of ZB_ZCL_DECLARE_BINARY_INPUT_ATTRIB_LIST + description
18#define ESPHOME_ZB_ZCL_DECLARE_BINARY_INPUT_ATTRIB_LIST(attr_list, out_of_service, present_value, status_flag, \
19 description) \
20 ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_BINARY_INPUT) \
21 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, (out_of_service)) \
22 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID, (present_value)) \
23 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, (status_flag)) \
24 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID, (description)) \
25 ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
26
27namespace esphome::zigbee {
28
29class ZigbeeBinarySensor final : public ZigbeeEntity, public Component {
30 public:
31 explicit ZigbeeBinarySensor(binary_sensor::BinarySensor *binary_sensor);
32 void set_cluster_attributes(BinaryAttrs &cluster_attributes) { this->cluster_attributes_ = &cluster_attributes; }
33
34 void setup() override;
35 void dump_config() override;
36
37 protected:
40};
41
42} // namespace esphome::zigbee
43#endif
Base class for all binary_sensor-type classes.
ZigbeeBinarySensor(binary_sensor::BinarySensor *binary_sensor)
void set_cluster_attributes(BinaryAttrs &cluster_attributes)