ESPHome  2024.7.0
atc_mithermometer.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <vector>
8 
9 #ifdef USE_ESP32
10 
11 namespace esphome {
12 namespace atc_mithermometer {
13 
14 struct ParseResult {
20 };
21 
23  public:
24  void set_address(uint64_t address) { address_ = address; };
25 
26  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
27  void dump_config() override;
28  float get_setup_priority() const override { return setup_priority::DATA; }
30  void set_humidity(sensor::Sensor *humidity) { humidity_ = humidity; }
33  void set_signal_strength(sensor::Sensor *signal_strength) { signal_strength_ = signal_strength; }
34 
35  protected:
36  uint64_t address_;
37  sensor::Sensor *temperature_{nullptr};
38  sensor::Sensor *humidity_{nullptr};
39  sensor::Sensor *battery_level_{nullptr};
40  sensor::Sensor *battery_voltage_{nullptr};
41  sensor::Sensor *signal_strength_{nullptr};
42 
43  optional<ParseResult> parse_header_(const esp32_ble_tracker::ServiceData &service_data);
44  bool parse_message_(const std::vector<uint8_t> &message, ParseResult &result);
45  bool report_results_(const optional<ParseResult> &result, const std::string &address);
46 };
47 
48 } // namespace atc_mithermometer
49 } // namespace esphome
50 
51 #endif
void set_battery_level(sensor::Sensor *battery_level)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void set_temperature(sensor::Sensor *temperature)
void set_battery_voltage(sensor::Sensor *battery_voltage)
void set_humidity(sensor::Sensor *humidity)
void set_signal_strength(sensor::Sensor *signal_strength)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57