13static constexpr uint32_t STARTUP_DELAY_MS = 1000;
23 ESP_LOGCONFIG(TAG,
"MR24HPC1:");
25 LOG_TEXT_SENSOR(
" ",
"Heartbeat Text Sensor", this->heartbeat_state_text_sensor_);
26 LOG_TEXT_SENSOR(
" ",
"Product Model Text Sensor", this->product_model_text_sensor_);
27 LOG_TEXT_SENSOR(
" ",
"Product ID Text Sensor", this->product_id_text_sensor_);
28 LOG_TEXT_SENSOR(
" ",
"Hardware Model Text Sensor", this->hardware_model_text_sensor_);
29 LOG_TEXT_SENSOR(
" ",
"Firware Verison Text Sensor", this->firware_version_text_sensor_);
30 LOG_TEXT_SENSOR(
" ",
"Keep Away Text Sensor", this->keep_away_text_sensor_);
31 LOG_TEXT_SENSOR(
" ",
"Motion Status Text Sensor", this->motion_status_text_sensor_);
32 LOG_TEXT_SENSOR(
" ",
"Custom Mode End Text Sensor", this->custom_mode_end_text_sensor_);
34#ifdef USE_BINARY_SENSOR
35 LOG_BINARY_SENSOR(
" ",
"Has Target Binary Sensor", this->has_target_binary_sensor_);
38 LOG_SENSOR(
" ",
"Custom Presence Of Detection Sensor", this->custom_presence_of_detection_sensor_);
39 LOG_SENSOR(
" ",
"Movement Signs Sensor", this->movement_signs_sensor_);
40 LOG_SENSOR(
" ",
"Custom Motion Distance Sensor", this->custom_motion_distance_sensor_);
41 LOG_SENSOR(
" ",
"Custom Spatial Static Sensor", this->custom_spatial_static_value_sensor_);
42 LOG_SENSOR(
" ",
"Custom Spatial Motion Sensor", this->custom_spatial_motion_value_sensor_);
43 LOG_SENSOR(
" ",
"Custom Motion Speed Sensor", this->custom_motion_speed_sensor_);
44 LOG_SENSOR(
" ",
"Custom Mode Num Sensor", this->custom_mode_num_sensor_);
47 LOG_SWITCH(
" ",
"Underly Open Function Switch", this->underlying_open_function_switch_);
50 LOG_BUTTON(
" ",
"Restart Button", this->restart_button_);
51 LOG_BUTTON(
" ",
"Custom Set End Button", this->custom_set_end_button_);
54 LOG_SELECT(
" ",
"Scene Mode Select", this->scene_mode_select_);
55 LOG_SELECT(
" ",
"Unman Time Select", this->unman_time_select_);
56 LOG_SELECT(
" ",
"Existence Boundary Select", this->existence_boundary_select_);
57 LOG_SELECT(
" ",
"Motion Boundary Select", this->motion_boundary_select_);
60 LOG_NUMBER(
" ",
"Sensitivity Number", this->sensitivity_number_);
61 LOG_NUMBER(
" ",
"Custom Mode Number", this->custom_mode_number_);
62 LOG_NUMBER(
" ",
"Existence Threshold Number", this->existence_threshold_number_);
63 LOG_NUMBER(
" ",
"Motion Threshold Number", this->motion_threshold_number_);
64 LOG_NUMBER(
" ",
"Motion Trigger Time Number", this->motion_trigger_number_);
65 LOG_NUMBER(
" ",
"Motion To Rest Time Number", this->motion_to_rest_number_);
66 LOG_NUMBER(
" ",
"Custom Unman Time Number", this->custom_unman_time_number_);
74 PUBLISH_STATE(this->custom_mode_number_, 0);
77 PUBLISH_STATE(this->custom_mode_num_sensor_, 0);
80 PUBLISH_STATE(this->custom_mode_end_text_sensor_,
"Not in custom mode");
82 this->poll_time_base_func_check_ =
false;
83 this->check_dev_inf_sign_ =
true;
85 this->sg_data_len_ = 0;
86 this->sg_frame_len_ = 0;
90 memset(this->c_product_mode_, 0, PRODUCT_BUF_MAX_SIZE);
91 memset(this->c_product_id_, 0, PRODUCT_BUF_MAX_SIZE);
92 memset(this->c_firmware_version_, 0, PRODUCT_BUF_MAX_SIZE);
93 memset(this->c_hardware_model_, 0, PRODUCT_BUF_MAX_SIZE);
94 memset(this->sg_frame_prase_buf_, 0, FRAME_BUF_MAX_SIZE);
95 memset(this->sg_frame_buf_, 0, FRAME_BUF_MAX_SIZE);
99 this->module_ready_ =
true;
101 this->poll_time_base_func_check_ =
true;
102 this->
set_interval(8000, [
this]() { this->update_(); });
107void MR24HPC1Component::update_() {
109 this->poll_time_base_func_check_ =
true;
114 this->
read_available([
this](uint8_t b) { this->r24_split_data_frame_(b); });
128 if (this->poll_time_base_func_check_) {
129 switch (this->sg_start_query_data_) {
132 this->sg_start_query_data_++;
136 this->sg_start_query_data_++;
142 this->sg_start_query_data_++;
148 this->sg_start_query_data_++;
149 this->check_dev_inf_sign_ =
false;
153 this->sg_start_query_data_++;
157 this->sg_start_query_data_++;
161 this->sg_start_query_data_++;
165 this->sg_start_query_data_++;
169 this->sg_start_query_data_++;
173 this->sg_start_query_data_++;
177 this->sg_start_query_data_++;
181 this->sg_start_query_data_++;
185 this->sg_start_query_data_++;
189 this->sg_start_query_data_++;
193 this->sg_start_query_data_++;
197 this->sg_start_query_data_++;
201 this->sg_start_query_data_++;
205 this->sg_start_query_data_++;
209 this->sg_start_query_data_++;
213 this->sg_start_query_data_++;
215 this->poll_time_base_func_check_ =
false;
220 this->sg_start_query_data_++;
224 this->sg_start_query_data_++;
228 this->sg_start_query_data_++;
232 this->sg_start_query_data_++;
236 this->sg_start_query_data_++;
240 this->sg_start_query_data_++;
241 this->poll_time_base_func_check_ =
false;
250static uint8_t get_frame_crc_sum(
const uint8_t *data,
size_t len) {
return sum_bytes(data,
len - 3); }
253static int get_frame_check_status(
const uint8_t *data,
size_t len) {
254 uint8_t crc_sum = get_frame_crc_sum(data,
len);
255 uint8_t verified = data[
len - 3];
256 return (verified == crc_sum) ? 1 : 0;
260void MR24HPC1Component::r24_split_data_frame_(uint8_t
value) {
261 switch (this->sg_recv_data_state_) {
263 if (FRAME_HEADER1_VALUE ==
value) {
268 if (FRAME_HEADER2_VALUE ==
value) {
269 this->sg_frame_buf_[0] = FRAME_HEADER1_VALUE;
270 this->sg_frame_buf_[1] = FRAME_HEADER2_VALUE;
274 ESP_LOGD(TAG,
"FRAME_IDLE ERROR value:%x",
value);
278 this->sg_frame_buf_[2] =
value;
282 this->sg_frame_buf_[3] =
value;
287 this->sg_frame_buf_[4] =
value;
291 ESP_LOGD(TAG,
"FRAME_DATA_LEN_H ERROR value:%x",
value);
295 this->sg_data_len_ =
value;
296 if (this->sg_data_len_ == 0 || this->sg_data_len_ > 32) {
297 ESP_LOGD(TAG,
"len=%d, FRAME_DATA_LEN_L ERROR value:%x", this->sg_data_len_,
value);
298 this->sg_data_len_ = 0;
301 this->sg_frame_buf_[5] =
value;
302 this->sg_frame_len_ = 6;
307 this->sg_frame_buf_[this->sg_frame_len_++] =
value;
308 if (--this->sg_data_len_ == 0) {
313 this->sg_frame_buf_[this->sg_frame_len_++] =
value;
317 if (FRAME_TAIL1_VALUE ==
value) {
321 this->sg_frame_len_ = 0;
322 this->sg_data_len_ = 0;
323 ESP_LOGD(TAG,
"FRAME_TAIL1 ERROR value:%x",
value);
327 if (FRAME_TAIL2_VALUE ==
value) {
328 this->sg_frame_buf_[this->sg_frame_len_++] = FRAME_TAIL1_VALUE;
329 this->sg_frame_buf_[this->sg_frame_len_++] = FRAME_TAIL2_VALUE;
330 memcpy(this->sg_frame_prase_buf_, this->sg_frame_buf_, this->sg_frame_len_);
331 if (get_frame_check_status(this->sg_frame_prase_buf_, this->sg_frame_len_)) {
332 this->r24_parse_data_frame_(this->sg_frame_prase_buf_, this->sg_frame_len_);
334 ESP_LOGD(TAG,
"frame check failer!");
337 ESP_LOGD(TAG,
"FRAME_TAIL2 ERROR value:%x",
value);
339 memset(this->sg_frame_prase_buf_, 0, FRAME_BUF_MAX_SIZE);
340 memset(this->sg_frame_buf_, 0, FRAME_BUF_MAX_SIZE);
341 this->sg_frame_len_ = 0;
342 this->sg_data_len_ = 0;
351void MR24HPC1Component::r24_frame_parse_product_information_(uint8_t *data) {
352#ifdef USE_TEXT_SENSOR
353 uint16_t product_len =
encode_uint16(data[FRAME_COMMAND_WORD_INDEX + 1], data[FRAME_COMMAND_WORD_INDEX + 2]);
354 if (data[FRAME_COMMAND_WORD_INDEX] == COMMAND_PRODUCT_MODE) {
355 if ((this->product_model_text_sensor_ !=
nullptr) && (product_len < PRODUCT_BUF_MAX_SIZE)) {
356 memset(this->c_product_mode_, 0, PRODUCT_BUF_MAX_SIZE);
357 memcpy(this->c_product_mode_, &data[FRAME_DATA_INDEX], product_len);
358 this->product_model_text_sensor_->publish_state(this->c_product_mode_);
360 ESP_LOGD(TAG,
"Reply: get product_mode error!");
362 }
else if (data[FRAME_COMMAND_WORD_INDEX] == COMMAND_PRODUCT_ID) {
363 if ((this->product_id_text_sensor_ !=
nullptr) && (product_len < PRODUCT_BUF_MAX_SIZE)) {
364 memset(this->c_product_id_, 0, PRODUCT_BUF_MAX_SIZE);
365 memcpy(this->c_product_id_, &data[FRAME_DATA_INDEX], product_len);
366 this->product_id_text_sensor_->publish_state(this->c_product_id_);
368 ESP_LOGD(TAG,
"Reply: get productId error!");
370 }
else if (data[FRAME_COMMAND_WORD_INDEX] == COMMAND_HARDWARE_MODEL) {
371 if ((this->hardware_model_text_sensor_ !=
nullptr) && (product_len < PRODUCT_BUF_MAX_SIZE)) {
372 memset(this->c_hardware_model_, 0, PRODUCT_BUF_MAX_SIZE);
373 memcpy(this->c_hardware_model_, &data[FRAME_DATA_INDEX], product_len);
374 this->hardware_model_text_sensor_->publish_state(this->c_hardware_model_);
375 ESP_LOGD(TAG,
"Reply: get hardware_model :%s", this->c_hardware_model_);
377 ESP_LOGD(TAG,
"Reply: get hardwareModel error!");
379 }
else if (data[FRAME_COMMAND_WORD_INDEX] == COMMAND_FIRMWARE_VERSION) {
380 if ((this->firware_version_text_sensor_ !=
nullptr) && (product_len < PRODUCT_BUF_MAX_SIZE)) {
381 memset(this->c_firmware_version_, 0, PRODUCT_BUF_MAX_SIZE);
382 memcpy(this->c_firmware_version_, &data[FRAME_DATA_INDEX], product_len);
383 this->firware_version_text_sensor_->publish_state(this->c_firmware_version_);
385 ESP_LOGD(TAG,
"Reply: get firmwareVersion error!");
392void MR24HPC1Component::r24_frame_parse_open_underlying_information_(uint8_t *data) {
393 switch (data[FRAME_COMMAND_WORD_INDEX]) {
397 PUBLISH_STATE(this->underlying_open_function_switch_, data[FRAME_DATA_INDEX]);
403 PUBLISH_STATE(this->custom_spatial_static_value_sensor_, data[FRAME_DATA_INDEX]);
404 PUBLISH_STATE(this->custom_presence_of_detection_sensor_, data[FRAME_DATA_INDEX + 1] * 0.5f);
405 PUBLISH_STATE(this->custom_spatial_motion_value_sensor_, data[FRAME_DATA_INDEX + 2]);
406 PUBLISH_STATE(this->custom_motion_distance_sensor_, data[FRAME_DATA_INDEX + 3] * 0.5f);
407 PUBLISH_STATE(this->custom_motion_speed_sensor_, (data[FRAME_DATA_INDEX + 4] - 10) * 0.5f);
411 PUBLISH_STATE(this->movement_signs_sensor_, data[FRAME_DATA_INDEX]);
414 PUBLISH_STATE(this->custom_spatial_static_value_sensor_, data[FRAME_DATA_INDEX]);
417 PUBLISH_STATE(this->custom_spatial_motion_value_sensor_, data[FRAME_DATA_INDEX]);
421 if (this->custom_presence_of_detection_sensor_ !=
nullptr && data[FRAME_DATA_INDEX] <= 6) {
422 this->custom_presence_of_detection_sensor_->publish_state(data[FRAME_DATA_INDEX] * 0.5f);
426 PUBLISH_STATE(this->custom_motion_distance_sensor_, data[FRAME_DATA_INDEX] * 0.5f);
429 PUBLISH_STATE(this->custom_motion_speed_sensor_, (data[FRAME_DATA_INDEX] - 10) * 0.5f);
432#ifdef USE_TEXT_SENSOR
436 if ((this->keep_away_text_sensor_ !=
nullptr) && (data[FRAME_DATA_INDEX] < KeepAwayStrings::COUNT)) {
437 this->keep_away_text_sensor_->publish_state(
438 KeepAwayStrings::get_progmem_str(data[FRAME_DATA_INDEX], KeepAwayStrings::LAST_INDEX));
445 PUBLISH_STATE(this->existence_threshold_number_, data[FRAME_DATA_INDEX]);
449 PUBLISH_STATE(this->motion_threshold_number_, data[FRAME_DATA_INDEX]);
461 PUBLISH_STATE(this->custom_unman_time_number_,
encode_value<uint32_t>(&data[FRAME_DATA_INDEX]) / 1000.0f);
467 if (this->existence_boundary_select_ !=
nullptr) {
468 if (this->existence_boundary_select_->has_index(data[FRAME_DATA_INDEX] - 1)) {
469 this->existence_boundary_select_->publish_state(data[FRAME_DATA_INDEX] - 1);
475 if (this->motion_boundary_select_ !=
nullptr) {
476 if (this->motion_boundary_select_->has_index(data[FRAME_DATA_INDEX] - 1)) {
477 this->motion_boundary_select_->publish_state(data[FRAME_DATA_INDEX] - 1);
485void MR24HPC1Component::r24_parse_data_frame_(uint8_t *data, uint8_t
len) {
486 switch (data[FRAME_CONTROL_WORD_INDEX]) {
488 if (data[FRAME_COMMAND_WORD_INDEX] == 0x02) {
489 ESP_LOGD(TAG,
"Reply: query restart packet");
492#ifdef USE_TEXT_SENSOR
493 PUBLISH_STATE(this->heartbeat_state_text_sensor_,
494 data[FRAME_COMMAND_WORD_INDEX] == 0x01 ?
"Equipment Normal" :
"Equipment Abnormal");
498 this->r24_frame_parse_product_information_(data);
501 this->r24_frame_parse_work_status_(data);
504 this->r24_frame_parse_open_underlying_information_(data);
507 this->r24_frame_parse_human_information_(data);
510 ESP_LOGD(TAG,
"control word:0x%02X not found", data[FRAME_CONTROL_WORD_INDEX]);
515void MR24HPC1Component::r24_frame_parse_work_status_(uint8_t *data) {
516 switch (data[FRAME_COMMAND_WORD_INDEX]) {
519 ESP_LOGD(TAG,
"Reply: get radar init status 0x%02X", data[FRAME_DATA_INDEX]);
523 PUBLISH_STATE(this->custom_mode_num_sensor_, data[FRAME_DATA_INDEX]);
526 PUBLISH_STATE(this->custom_mode_number_, 0);
528#ifdef USE_TEXT_SENSOR
529 PUBLISH_STATE(this->custom_mode_end_text_sensor_,
"Setup in progress");
534 PUBLISH_STATE(this->custom_mode_num_sensor_, data[FRAME_DATA_INDEX]);
536 if (data[FRAME_DATA_INDEX] == 0) {
537#ifdef USE_TEXT_SENSOR
538 PUBLISH_STATE(this->custom_mode_end_text_sensor_,
"Not in custom mode");
541 PUBLISH_STATE(this->custom_mode_number_, 0);
548 if ((this->scene_mode_select_ !=
nullptr) && (this->scene_mode_select_->has_index(data[FRAME_DATA_INDEX]))) {
549 this->scene_mode_select_->publish_state(data[FRAME_DATA_INDEX]);
551 ESP_LOGD(TAG,
"Select has index offset %d Error", data[FRAME_DATA_INDEX]);
558 PUBLISH_STATE(this->sensitivity_number_, data[FRAME_DATA_INDEX]);
561#ifdef USE_TEXT_SENSOR
563 PUBLISH_STATE(this->custom_mode_end_text_sensor_,
"Set Success!");
567 ESP_LOGD(TAG,
"[%s] No found COMMAND_WORD(%02X) in Frame", __FUNCTION__, data[FRAME_COMMAND_WORD_INDEX]);
572void MR24HPC1Component::r24_frame_parse_human_information_(uint8_t *data) {
573 switch (data[FRAME_COMMAND_WORD_INDEX]) {
574#ifdef USE_BINARY_SENSOR
577 if (this->has_target_binary_sensor_ !=
nullptr && data[FRAME_DATA_INDEX] <= 1) {
578 this->has_target_binary_sensor_->publish_state(data[FRAME_DATA_INDEX] == 1);
585 PUBLISH_STATE(this->movement_signs_sensor_, data[FRAME_DATA_INDEX]);
588#ifdef USE_TEXT_SENSOR
591 if ((this->motion_status_text_sensor_ !=
nullptr) && (data[FRAME_DATA_INDEX] < MotionStatusStrings::COUNT)) {
592 this->motion_status_text_sensor_->publish_state(
593 MotionStatusStrings::get_progmem_str(data[FRAME_DATA_INDEX], MotionStatusStrings::LAST_INDEX));
599 if ((this->keep_away_text_sensor_ !=
nullptr) && (data[FRAME_DATA_INDEX] < KeepAwayStrings::COUNT)) {
600 this->keep_away_text_sensor_->publish_state(
601 KeepAwayStrings::get_progmem_str(data[FRAME_DATA_INDEX], KeepAwayStrings::LAST_INDEX));
609 if ((this->unman_time_select_ !=
nullptr) && (data[FRAME_DATA_INDEX] < 9)) {
610 this->unman_time_select_->publish_state(data[FRAME_DATA_INDEX]);
615 ESP_LOGD(TAG,
"[%s] No found COMMAND_WORD(%02X) in Frame", __FUNCTION__, data[FRAME_COMMAND_WORD_INDEX]);
621void MR24HPC1Component::send_query_(
const uint8_t *query,
size_t string_length) {
622 if (!this->module_ready_)
632 this->send_query_(GET_RADAR_OUTPUT_INFORMATION_SWITCH,
sizeof(GET_RADAR_OUTPUT_INFORMATION_SWITCH));
646 this->send_query_(GET_FIRMWARE_VERSION,
sizeof(GET_FIRMWARE_VERSION));
652 this->send_query_(GET_HUMAN_MOTION_INFORMATION,
sizeof(GET_HUMAN_MOTION_INFORMATION));
656 this->send_query_(GET_BODY_MOTION_PARAMETERS,
sizeof(GET_BODY_MOTION_PARAMETERS));
670 this->send_query_(GET_EXISTENCE_BOUNDARY,
sizeof(GET_EXISTENCE_BOUNDARY));
676 this->send_query_(GET_SPATIAL_STATIC_VALUE,
sizeof(GET_SPATIAL_STATIC_VALUE));
680 this->send_query_(GET_SPATIAL_MOTION_VALUE,
sizeof(GET_SPATIAL_MOTION_VALUE));
684 this->send_query_(GET_DISTANCE_OF_STATIC_OBJECT,
sizeof(GET_DISTANCE_OF_STATIC_OBJECT));
688 this->send_query_(GET_DISTANCE_OF_MOVING_OBJECT,
sizeof(GET_DISTANCE_OF_MOVING_OBJECT));
692 this->send_query_(GET_TARGET_MOVEMENT_SPEED,
sizeof(GET_TARGET_MOVEMENT_SPEED));
696 this->send_query_(GET_EXISTENCE_THRESHOLD,
sizeof(GET_EXISTENCE_THRESHOLD));
700 this->send_query_(GET_MOTION_THRESHOLD,
sizeof(GET_MOTION_THRESHOLD));
704 this->send_query_(GET_MOTION_TRIGGER_TIME,
sizeof(GET_MOTION_TRIGGER_TIME));
708 this->send_query_(GET_MOTION_TO_REST_TIME,
sizeof(GET_MOTION_TO_REST_TIME));
712 this->send_query_(GET_CUSTOM_UNMAN_TIME,
sizeof(GET_CUSTOM_UNMAN_TIME));
719 this->send_query_(UNDERLYING_SWITCH_ON,
sizeof(UNDERLYING_SWITCH_ON));
721 this->send_query_(UNDERLYING_SWITCH_OFF,
sizeof(UNDERLYING_SWITCH_OFF));
723#ifdef USE_TEXT_SENSOR
724 PUBLISH_STATE(this->keep_away_text_sensor_,
"");
725 PUBLISH_STATE(this->motion_status_text_sensor_,
"");
728 PUBLISH_STATE(this->custom_spatial_static_value_sensor_, NAN);
729 PUBLISH_STATE(this->custom_spatial_motion_value_sensor_, NAN);
730 PUBLISH_STATE(this->custom_motion_distance_sensor_, NAN);
731 PUBLISH_STATE(this->custom_presence_of_detection_sensor_, NAN);
732 PUBLISH_STATE(this->custom_motion_speed_sensor_, NAN);
737 uint8_t send_data_len = 10;
738 uint8_t send_data[10] = {0x53, 0x59, 0x05, 0x07, 0x00, 0x01,
value, 0x00, 0x54, 0x43};
739 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
740 this->send_query_(send_data, send_data_len);
742 PUBLISH_STATE(this->custom_mode_number_, 0);
745 PUBLISH_STATE(this->custom_mode_num_sensor_, 0);
762 uint8_t send_data_len = 10;
763 uint8_t send_data[10] = {0x53, 0x59, 0x05, 0x08, 0x00, 0x01,
value, 0x00, 0x54, 0x43};
764 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
765 this->send_query_(send_data, send_data_len);
771 this->send_query_(SET_RESTART,
sizeof(SET_RESTART));
772 this->check_dev_inf_sign_ =
true;
776 uint8_t send_data_len = 10;
777 uint8_t send_data[10] = {0x53, 0x59, 0x80, 0x0a, 0x00, 0x01,
value, 0x00, 0x54, 0x43};
778 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
779 this->send_query_(send_data, send_data_len);
787 PUBLISH_STATE(this->custom_mode_number_, 0);
791 uint8_t send_data_len = 10;
792 uint8_t send_data[10] = {0x53, 0x59, 0x05, 0x09, 0x00, 0x01,
mode, 0x00, 0x54, 0x43};
793 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
794 this->send_query_(send_data, send_data_len);
808 uint8_t send_data_len = 10;
809 uint8_t send_data[10] = {0x53, 0x59, 0x05, 0x0a, 0x00, 0x01, 0x0F, 0xCB, 0x54, 0x43};
810 this->send_query_(send_data, send_data_len);
813 PUBLISH_STATE(this->custom_mode_number_, 0);
829 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
832 uint8_t send_data_len = 10;
833 uint8_t send_data[10] = {0x53, 0x59, 0x08, 0x0A, 0x00, 0x01, (uint8_t) (
value + 1), 0x00, 0x54, 0x43};
834 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
835 this->send_query_(send_data, send_data_len);
841 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
844 uint8_t send_data_len = 10;
845 uint8_t send_data[10] = {0x53, 0x59, 0x08, 0x0B, 0x00, 0x01, (uint8_t) (
value + 1), 0x00, 0x54, 0x43};
846 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
847 this->send_query_(send_data, send_data_len);
853 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
856 uint8_t send_data_len = 10;
857 uint8_t send_data[10] = {0x53, 0x59, 0x08, 0x08, 0x00, 0x01,
value, 0x00, 0x54, 0x43};
858 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
859 this->send_query_(send_data, send_data_len);
865 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
868 uint8_t send_data_len = 10;
869 uint8_t send_data[10] = {0x53, 0x59, 0x08, 0x09, 0x00, 0x01,
value, 0x00, 0x54, 0x43};
870 send_data[7] = get_frame_crc_sum(send_data, send_data_len);
871 this->send_query_(send_data, send_data_len);
877 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
880 uint8_t send_data_len = 13;
881 uint8_t send_data[13] = {0x53, 0x59, 0x08, 0x0C, 0x00, 0x04, 0x00, 0x00, 0x00,
value, 0x00, 0x54, 0x43};
882 send_data[10] = get_frame_crc_sum(send_data, send_data_len);
883 this->send_query_(send_data, send_data_len);
889 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
892 uint8_t h8_num = (
value >> 8) & 0xff;
893 uint8_t l8_num =
value & 0xff;
894 uint8_t send_data_len = 13;
895 uint8_t send_data[13] = {0x53, 0x59, 0x08, 0x0D, 0x00, 0x04, 0x00, 0x00, h8_num, l8_num, 0x00, 0x54, 0x43};
896 send_data[10] = get_frame_crc_sum(send_data, send_data_len);
897 this->send_query_(send_data, send_data_len);
903 if ((this->custom_mode_num_sensor_ !=
nullptr) && (this->custom_mode_num_sensor_->state == 0))
907 uint8_t h24_num = (value_ms >> 24) & 0xff;
908 uint8_t h16_num = (value_ms >> 16) & 0xff;
909 uint8_t h8_num = (value_ms >> 8) & 0xff;
910 uint8_t l8_num = value_ms & 0xff;
911 uint8_t send_data_len = 13;
912 uint8_t send_data[13] = {0x53, 0x59, 0x08, 0x0E, 0x00, 0x04, h24_num, h16_num, h8_num, l8_num, 0x00, 0x54, 0x43};
913 send_data[10] = get_frame_crc_sum(send_data, send_data_len);
914 this->send_query_(send_data, send_data_len);