-
Notifications
You must be signed in to change notification settings - Fork 7.6k
/
Copy pathZigbeeCarbonDioxideSensor.h
61 lines (49 loc) · 2.57 KB
/
ZigbeeCarbonDioxideSensor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Class of Zigbee Pressure sensor endpoint inherited from common EP class */
#pragma once
#include "soc/soc_caps.h"
#include "sdkconfig.h"
#if CONFIG_ZB_ENABLED
#include "ZigbeeEP.h"
#include "ha/esp_zigbee_ha_standard.h"
// clang-format off
#define ZIGBEE_DEFAULT_CARBON_DIOXIDE_SENSOR_CONFIG() \
{ \
.basic_cfg = \
{ \
.zcl_version = ESP_ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE, \
.power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE, \
}, \
.identify_cfg = \
{ \
.identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE, \
}, \
.carbon_dioxide_meas_cfg = \
{ \
.measured_value = 0.0, \
.min_measured_value = 0.0, \
.max_measured_value = 1.0, \
}, \
}
// clang-format on
typedef struct zigbee_carbon_dioxide_sensor_cfg_s {
esp_zb_basic_cluster_cfg_t basic_cfg;
esp_zb_identify_cluster_cfg_t identify_cfg;
esp_zb_carbon_dioxide_measurement_cluster_cfg_t carbon_dioxide_meas_cfg;
} zigbee_carbon_dioxide_sensor_cfg_t;
class ZigbeeCarbonDioxideSensor : public ZigbeeEP {
public:
ZigbeeCarbonDioxideSensor(uint8_t endpoint);
~ZigbeeCarbonDioxideSensor() {}
// Set the carbon dioxide value in ppm
void setCarbonDioxide(float carbon_dioxide);
// Set the min and max value for the carbon dioxide sensor in ppm
void setMinMaxValue(float min, float max);
// Set the tolerance value for the carbon dioxide sensor in ppm
void setTolerance(float tolerance);
// Set the reporting interval for carbon dioxide measurement in seconds and delta (carbon dioxide change in ppm)
// NOTE: Delta reporting is currently not supported by the carbon dioxide sensor
void setReporting(uint16_t min_interval, uint16_t max_interval, uint16_t delta);
// Report the carbon dioxide value
void report();
};
#endif // CONFIG_ZB_ENABLED