ESPHome 2026.1.4
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 { \
15 ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID, ZB_ZCL_ATTR_TYPE_CHAR_STRING, ZB_ZCL_ATTR_ACCESS_READ_ONLY, \
16 (ZB_ZCL_NON_MANUFACTURER_SPECIFIC), (void *) (data_ptr) \
17 }
18
19// copy of ZB_ZCL_DECLARE_BINARY_INPUT_ATTRIB_LIST + description
20#define ESPHOME_ZB_ZCL_DECLARE_BINARY_INPUT_ATTRIB_LIST(attr_list, out_of_service, present_value, status_flag, \
21 description) \
22 ZB_ZCL_START_DECLARE_ATTRIB_LIST_CLUSTER_REVISION(attr_list, ZB_ZCL_BINARY_INPUT) \
23 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_OUT_OF_SERVICE_ID, (out_of_service)) \
24 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID, (present_value)) \
25 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_STATUS_FLAG_ID, (status_flag)) \
26 ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_BINARY_INPUT_DESCRIPTION_ID, (description)) \
27 ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST
28
29namespace esphome::zigbee {
30
32 public:
33 explicit ZigbeeBinarySensor(binary_sensor::BinarySensor *binary_sensor);
34 void set_cluster_attributes(BinaryAttrs &cluster_attributes) { this->cluster_attributes_ = &cluster_attributes; }
35
36 void setup() override;
37 void dump_config() override;
38
39 protected:
42};
43
44} // namespace esphome::zigbee
45#endif
Base class for all binary_sensor-type classes.
ZigbeeBinarySensor(binary_sensor::BinarySensor *binary_sensor)
void set_cluster_attributes(BinaryAttrs &cluster_attributes)