ESPHome  2025.2.0
seeed_mr60bha2.h
Go to the documentation of this file.
1 #pragma once
3 #include "esphome/core/defines.h"
4 #ifdef USE_BINARY_SENSOR
6 #endif
7 #ifdef USE_SENSOR
9 #endif
12 #include "esphome/core/helpers.h"
13 
14 #include <map>
15 
16 namespace esphome {
17 namespace seeed_mr60bha2 {
18 static const uint8_t FRAME_HEADER_BUFFER = 0x01;
19 static const uint16_t BREATH_RATE_TYPE_BUFFER = 0x0A14;
20 static const uint16_t PEOPLE_EXIST_TYPE_BUFFER = 0x0F09;
21 static const uint16_t HEART_RATE_TYPE_BUFFER = 0x0A15;
22 static const uint16_t DISTANCE_TYPE_BUFFER = 0x0A16;
23 static const uint16_t PRINT_CLOUD_BUFFER = 0x0A04;
24 
26  public uart::UARTDevice { // The class name must be the name defined by text_sensor.py
27 #ifdef USE_BINARY_SENSOR
28  SUB_BINARY_SENSOR(has_target);
29 #endif
30 #ifdef USE_SENSOR
31  SUB_SENSOR(breath_rate);
32  SUB_SENSOR(heart_rate);
33  SUB_SENSOR(distance);
34  SUB_SENSOR(num_targets);
35 #endif
36 
37  public:
38  float get_setup_priority() const override { return esphome::setup_priority::LATE; }
39  void dump_config() override;
40  void loop() override;
41 
42  protected:
43  bool validate_message_();
44  void process_frame_(uint16_t frame_id, uint16_t frame_type, const uint8_t *data, size_t length);
45 
46  std::vector<uint8_t> rx_message_;
47 };
48 
49 } // namespace seeed_mr60bha2
50 } // namespace esphome
void process_frame_(uint16_t frame_id, uint16_t frame_type, const uint8_t *data, size_t length)
const float LATE
For components that should be initialized at the very end of the setup process.
Definition: component.cpp:28
uint16_t length
Definition: tt21100.cpp:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7