ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
seeed_mr24hpc1.h
Go to the documentation of this file.
1#pragma once
4#ifdef USE_BINARY_SENSOR
6#endif
7#ifdef USE_SENSOR
9#endif
10#ifdef USE_NUMBER
12#endif
13#ifdef USE_SWITCH
15#endif
16#ifdef USE_BUTTON
18#endif
19#ifdef USE_SELECT
21#endif
22#ifdef USE_TEXT_SENSOR
24#endif
28
30
31#include <map>
32
34
47
78
84
85class MR24HPC1Component final : public Component,
86 public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
87#ifdef USE_TEXT_SENSOR
88 SUB_TEXT_SENSOR(heartbeat_state)
89 SUB_TEXT_SENSOR(product_model)
90 SUB_TEXT_SENSOR(product_id)
91 SUB_TEXT_SENSOR(hardware_model)
92 SUB_TEXT_SENSOR(firware_version)
93 SUB_TEXT_SENSOR(keep_away)
94 SUB_TEXT_SENSOR(motion_status)
95 SUB_TEXT_SENSOR(custom_mode_end)
96#endif
97#ifdef USE_BINARY_SENSOR
98 SUB_BINARY_SENSOR(has_target)
99#endif
100#ifdef USE_SENSOR
101 SUB_SENSOR(custom_presence_of_detection)
102 SUB_SENSOR(movement_signs)
103 SUB_SENSOR(custom_motion_distance)
104 SUB_SENSOR(custom_spatial_static_value)
105 SUB_SENSOR(custom_spatial_motion_value)
106 SUB_SENSOR(custom_motion_speed)
107 SUB_SENSOR(custom_mode_num)
108#endif
109#ifdef USE_SWITCH
110 SUB_SWITCH(underlying_open_function)
111#endif
112#ifdef USE_BUTTON
113 SUB_BUTTON(restart)
114 SUB_BUTTON(custom_set_end)
115#endif
116#ifdef USE_SELECT
117 SUB_SELECT(scene_mode)
118 SUB_SELECT(unman_time)
119 SUB_SELECT(existence_boundary)
120 SUB_SELECT(motion_boundary)
121#endif
122#ifdef USE_NUMBER
123 SUB_NUMBER(sensitivity)
124 SUB_NUMBER(custom_mode)
125 SUB_NUMBER(existence_threshold)
126 SUB_NUMBER(motion_threshold)
127 SUB_NUMBER(motion_trigger)
128 SUB_NUMBER(motion_to_rest)
129 SUB_NUMBER(custom_unman_time)
130#endif
131
132 protected:
133 char c_product_mode_[PRODUCT_BUF_MAX_SIZE + 1];
134 char c_product_id_[PRODUCT_BUF_MAX_SIZE + 1];
135 char c_hardware_model_[PRODUCT_BUF_MAX_SIZE + 1];
136 char c_firmware_version_[PRODUCT_BUF_MAX_SIZE + 1];
137 uint8_t s_output_info_switch_flag_;
138 uint8_t sg_recv_data_state_;
139 uint8_t sg_frame_len_;
140 uint8_t sg_data_len_;
141 uint8_t sg_frame_buf_[FRAME_BUF_MAX_SIZE];
142 uint8_t sg_frame_prase_buf_[FRAME_BUF_MAX_SIZE];
143 int sg_start_query_data_;
144 bool check_dev_inf_sign_;
145 bool poll_time_base_func_check_;
146 bool module_ready_{false};
147
148 void update_();
149 void r24_split_data_frame_(uint8_t value);
150 void r24_parse_data_frame_(uint8_t *data, uint8_t len);
151 void r24_frame_parse_open_underlying_information_(uint8_t *data);
152 void r24_frame_parse_work_status_(uint8_t *data);
153 void r24_frame_parse_product_information_(uint8_t *data);
154 void r24_frame_parse_human_information_(uint8_t *data);
155 void send_query_(const uint8_t *query, size_t string_length);
156
157 public:
158 float get_setup_priority() const override { return esphome::setup_priority::LATE; }
159 void setup() override;
160 void dump_config() override;
161 void loop() override;
162
165 void get_product_mode();
166 void get_product_id();
167 void get_hardware_model();
169 void get_human_status();
172 void get_keep_away();
173 void get_scene_mode();
174 void get_sensitivity();
175 void get_unmanned_time();
176 void get_custom_mode();
178 void get_motion_boundary();
189
190 void set_scene_mode(uint8_t value);
191 void set_underlying_open_function(bool enable);
192 void set_sensitivity(uint8_t value);
193 void set_restart();
194 void set_unman_time(uint8_t value);
195 void set_custom_mode(uint8_t mode);
196 void set_custom_end_mode();
197 void set_existence_boundary(uint8_t value);
198 void set_motion_boundary(uint8_t value);
199 void set_existence_threshold(uint8_t value);
200 void set_motion_threshold(uint8_t value);
201 void set_motion_trigger_time(uint8_t value);
202 void set_motion_to_rest_time(uint16_t value);
203 void set_custom_unman_time(uint16_t value);
204};
205
206} // namespace esphome::seeed_mr24hpc1
BedjetMode mode
BedJet operating mode.
constexpr float LATE
For components that should be initialized at the very end of the setup process.
Definition component.h:59
uint32_t value
Definition hal.cpp:41
const void size_t len
Definition hal.h:68