ESPHome  2022.6.3
mopeka_pro_check.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #ifdef USE_ESP32
8 
9 namespace esphome {
10 namespace mopeka_pro_check {
11 
12 enum SensorType {
17  // all other values are reserved
18 };
19 
20 // Sensor read quality. If sensor is poorly placed or tank level
21 // gets too low the read quality will show and the distanace
22 // measurement may be inaccurate.
24 
26  public:
27  void set_address(uint64_t address) { address_ = address; };
28 
29  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
30  void dump_config() override;
31  float get_setup_priority() const override { return setup_priority::DATA; }
32 
33  void set_level(sensor::Sensor *level) { level_ = level; };
36  void set_distance(sensor::Sensor *distance) { distance_ = distance; };
37  void set_tank_full(float full) { full_mm_ = full; };
38  void set_tank_empty(float empty) { empty_mm_ = empty; };
39 
40  protected:
41  uint64_t address_;
46 
47  uint32_t full_mm_;
48  uint32_t empty_mm_;
49 
50  uint8_t parse_battery_level_(const std::vector<uint8_t> &message);
51  uint32_t parse_distance_(const std::vector<uint8_t> &message);
52  uint8_t parse_temperature_(const std::vector<uint8_t> &message);
53  SensorReadQuality parse_read_quality_(const std::vector<uint8_t> &message);
54 };
55 
56 } // namespace mopeka_pro_check
57 } // namespace esphome
58 
59 #endif
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
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)
float temperature
Definition: qmp6988.h:71
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)
uint8_t parse_temperature_(const std::vector< uint8_t > &message)
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:47