ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
anova.h
Go to the documentation of this file.
1#pragma once
2
7#include "anova_base.h"
8
9#ifdef USE_ESP32
10
11#include <esp_gattc_api.h>
12
13namespace esphome::anova {
14
16
17static const uint16_t ANOVA_SERVICE_UUID = 0xFFE0;
18static const uint16_t ANOVA_CHARACTERISTIC_UUID = 0xFFE1;
19
21 public:
22 void setup() override;
23 void loop() override;
24 void update() override;
25 void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
26 esp_ble_gattc_cb_param_t *param) override;
27 void dump_config() override;
37 void set_unit_of_measurement(const char *unit);
38
39 protected:
40 // A poll cycle re-asserts the configured unit, then reads device state.
41 // Re-asserting every cycle prevents the cooker from silently reverting to
42 // its default (Celsius); previously the unit was only set once on
43 // connection, so a drift persisted (and corrupted the F/C interpretation of
44 // subsequent readings) until the BLE link was re-established.
45 enum class PollStep : uint8_t { SET_UNIT, STATUS, TARGET, CURRENT, IDLE };
46
47 void write_request_(AnovaPacket *pkt);
48
49 std::unique_ptr<AnovaCodec> codec_;
50 void control(const climate::ClimateCall &call) override;
51 uint16_t char_handle_;
52 bool want_fahrenheit_{true}; // configured target unit; never overwritten by device replies
54};
55
56} // namespace esphome::anova
57
58#endif
This class simplifies creating components that periodically check a state.
Definition component.h:510
void dump_config() override
Definition anova.cpp:12
void update() override
Definition anova.cpp:137
void setup() override
Definition anova.cpp:14
climate::ClimateTraits traits() override
Definition anova.h:28
void loop() override
Definition anova.cpp:19
PollStep poll_step_
Definition anova.h:53
std::unique_ptr< AnovaCodec > codec_
Definition anova.h:49
uint16_t char_handle_
Definition anova.h:51
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 anova.cpp:58
void control(const climate::ClimateCall &call) override
Definition anova.cpp:34
void write_request_(AnovaPacket *pkt)
Definition anova.cpp:25
void set_unit_of_measurement(const char *unit)
Definition anova.cpp:135
This class is used to encode all control actions on a climate device.
Definition climate.h:34
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:187
void set_visual_max_temperature(float visual_max_temperature)
void add_feature_flags(uint32_t feature_flags)
void set_visual_temperature_step(float temperature_step)
void set_visual_min_temperature(float visual_min_temperature)
void set_supported_modes(ClimateModeMask modes)
@ CLIMATE_SUPPORTS_CURRENT_TEMPERATURE
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.