ESPHome  2022.8.0
atc_mithermometer.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #ifdef USE_ESP32
8 
9 namespace esphome {
10 namespace atc_mithermometer {
11 
12 struct ParseResult {
18 };
19 
21  public:
22  void set_address(uint64_t address) { address_ = address; };
23 
24  bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
25  void dump_config() override;
26  float get_setup_priority() const override { return setup_priority::DATA; }
28  void set_humidity(sensor::Sensor *humidity) { humidity_ = humidity; }
31  void set_signal_strength(sensor::Sensor *signal_strength) { signal_strength_ = signal_strength; }
32 
33  protected:
34  uint64_t address_;
35  sensor::Sensor *temperature_{nullptr};
36  sensor::Sensor *humidity_{nullptr};
37  sensor::Sensor *battery_level_{nullptr};
38  sensor::Sensor *battery_voltage_{nullptr};
39  sensor::Sensor *signal_strength_{nullptr};
40 
41  optional<ParseResult> parse_header_(const esp32_ble_tracker::ServiceData &service_data);
42  bool parse_message_(const std::vector<uint8_t> &message, ParseResult &result);
43  bool report_results_(const optional<ParseResult> &result, const std::string &address);
44 };
45 
46 } // namespace atc_mithermometer
47 } // namespace esphome
48 
49 #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:18
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)
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:48