ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
am43_sensor.h
Go to the documentation of this file.
1#pragma once
2
8
9#ifdef USE_ESP32
10
11#include <esp_gattc_api.h>
12
13namespace esphome::am43 {
14
16
18 SUB_SENSOR(battery)
19 SUB_SENSOR(illuminance)
20
21 public:
22 void update() override;
23 void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
24 esp_ble_gattc_cb_param_t *param) override;
25 void dump_config() override;
26
27 protected:
29 void write_packet_(const Am43Packet &packet);
30 // The AM43 often gets into a state where it spams loads of battery update
31 // notifications. Here we will limit to no more than every 10s.
33 uint16_t char_handle_{0};
34 uint8_t current_sensor_{0};
35};
36
37} // namespace esphome::am43
38
39#endif
This class simplifies creating components that periodically check a state.
Definition component.h:532
virtual void update()=0
uint32_t last_battery_update_
Definition am43_sensor.h:32
void write_packet_(const Am43Packet &packet)
Writes a request to the control characteristic; logs on failure.
static void uint32_t