ESPHome  2024.10.2
mopeka_pro_check.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cinttypes>
4 #include <vector>
5 
9 
10 #ifdef USE_ESP32
11 
12 namespace esphome {
13 namespace mopeka_pro_check {
14 
15 enum SensorType {
21  PRO_UNIVERSAL = 0xC // Pro Check Universal
22 
23  // all other values are reserved
24 };
25 
26 // Sensor read quality. If sensor is poorly placed or tank level
27 // gets too low the read quality will show and the distanace
28 // measurement may be inaccurate.
30 
32  public:
33  void set_address(uint64_t address) { address_ = address; };
34 
35  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
36  void dump_config() override;
37  float get_setup_priority() const override { return setup_priority::DATA; }
38 
39  void set_level(sensor::Sensor *level) { level_ = level; };
42  void set_distance(sensor::Sensor *distance) { distance_ = distance; };
43  void set_tank_full(float full) { full_mm_ = full; };
44  void set_tank_empty(float empty) { empty_mm_ = empty; };
45 
46  protected:
47  uint64_t address_;
52 
53  uint32_t full_mm_;
54  uint32_t empty_mm_;
55 
56  uint8_t parse_battery_level_(const std::vector<uint8_t> &message);
57  uint32_t parse_distance_(const std::vector<uint8_t> &message);
58  uint8_t parse_temperature_(const std::vector<uint8_t> &message);
59  SensorReadQuality parse_read_quality_(const std::vector<uint8_t> &message);
60 };
61 
62 } // namespace mopeka_pro_check
63 } // namespace esphome
64 
65 #endif
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void set_level(sensor::Sensor *level)
void set_distance(sensor::Sensor *distance)
SensorReadQuality parse_read_quality_(const std::vector< uint8_t > &message)
uint32_t parse_distance_(const std::vector< uint8_t > &message)
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Main parse function that gets called for all ble advertisements.
void set_battery_level(sensor::Sensor *bat)
uint8_t parse_battery_level_(const std::vector< uint8_t > &message)
void set_temperature(sensor::Sensor *temperature)
uint16_t temperature
Definition: sun_gtil2.cpp:26
uint8_t parse_temperature_(const std::vector< uint8_t > &message)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
uint8_t address
Definition: bl0906.h:211
Base-class for all sensors.
Definition: sensor.h:57