ESPHome  2022.12.8
airthings_wave_mini.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ESP32
4 
5 #include <esp_gattc_api.h>
6 #include <algorithm>
7 #include <iterator>
11 #include "esphome/core/component.h"
12 #include "esphome/core/log.h"
13 
14 namespace esphome {
15 namespace airthings_wave_mini {
16 
17 static const char *const SERVICE_UUID = "b42e3882-ade7-11e4-89d3-123b93f75cba";
18 static const char *const CHARACTERISTIC_UUID = "b42e3b98-ade7-11e4-89d3-123b93f75cba";
19 
21  public:
23 
24  void dump_config() override;
25  void update() override;
26 
27  void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
28  esp_ble_gattc_cb_param_t *param) override;
29 
31  void set_humidity(sensor::Sensor *humidity) { humidity_sensor_ = humidity; }
33  void set_tvoc(sensor::Sensor *tvoc) { tvoc_sensor_ = tvoc; }
34 
35  protected:
36  bool is_valid_voc_value_(uint16_t voc);
37 
38  void read_sensors_(uint8_t *value, uint16_t value_len);
39  void request_read_values_();
40 
45 
46  uint16_t handle_;
49 
51  uint16_t unused01;
52  uint16_t temperature;
53  uint16_t pressure;
54  uint16_t humidity;
55  uint16_t voc;
56  uint16_t unused02;
57  uint32_t unused03;
58  uint32_t unused04;
59  };
60 };
61 
62 } // namespace airthings_wave_mini
63 } // namespace esphome
64 
65 #endif // USE_ESP32
float pressure
Definition: qmp6988.h:72
void read_sensors_(uint8_t *value, uint16_t value_len)
esp32_ble_tracker::ESPBTUUID sensors_data_characteristic_uuid_
float temperature
Definition: qmp6988.h:71
This class simplifies creating components that periodically check a state.
Definition: component.h:267
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Definition: a4988.cpp:4
void set_temperature(sensor::Sensor *temperature)
Base-class for all sensors.
Definition: sensor.h:50