ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
bedjet_climate.h
Go to the documentation of this file.
1#pragma once
2
5#include "esphome/core/hal.h"
10
11#ifdef USE_ESP32
12
13namespace esphome {
14namespace bedjet {
15
17 public:
18 void setup() override;
19 void loop() override;
20 void update() override;
21 void dump_config() override;
22 float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
23
24 /* BedJetClient status update */
25 void on_status(const BedjetStatusPacket *data) override;
26 void on_bedjet_state(bool is_ready) override;
27 std::string describe() override;
28
33
40 // climate::CLIMATE_MODE_TURBO // Not supported by Climate: see presets instead
43 });
44
45 // It would be better if we had a slider for the fan modes.
46 traits.set_supported_custom_fan_modes(BEDJET_FAN_STEP_NAMES);
48 // If we support NONE, then have to decide what happens if the user switches to it (turn off?)
49 // climate::CLIMATE_PRESET_NONE,
50 // Climate doesn't have a "TURBO" mode, but we can use the BOOST preset instead.
52 });
53 // String literals are stored in rodata and valid for program lifetime
55 this->heating_mode_ == HEAT_MODE_EXTENDED ? "LTD HT" : "EXT HT",
56 "M1",
57 "M2",
58 "M3",
59 });
63 return traits;
64 }
65
66 protected:
67 void control(const climate::ClimateCall &call) override;
68
71
72 void reset_state_();
73 bool update_status_();
74
75 bool is_valid_() {
76 // FIXME: find a better way to check this?
77 return !std::isnan(this->current_temperature) && !std::isnan(this->target_temperature) &&
78 this->current_temperature > 1 && this->target_temperature > 1;
79 }
80};
81
82} // namespace bedjet
83} // namespace esphome
84
85#endif
bool is_ready() const
This class simplifies creating components that periodically check a state.
Definition component.h:437
bool update_status_()
Attempts to update the climate device from the last received BedjetStatusPacket.
BedjetTemperatureSource temperature_source_
climate::ClimateTraits traits() override
void on_bedjet_state(bool is_ready) override
void reset_state_()
Resets states to defaults.
void set_temperature_source(BedjetTemperatureSource source)
Sets the temperature source to use for the climate entity's current temperature.
void control(const climate::ClimateCall &call) override
void set_heating_mode(BedjetHeatMode mode)
Sets the default strategy to use for climate::CLIMATE_MODE_HEAT.
float get_setup_priority() const override
std::string describe() override
void on_status(const BedjetStatusPacket *data) override
This class is used to encode all control actions on a climate device.
Definition climate.h:33
ClimateDevice - This is the base class for all climate integrations.
Definition climate.h:178
ClimateMode mode
The active mode of the climate device.
Definition climate.h:256
float target_temperature
The target temperature of the climate device.
Definition climate.h:237
float current_temperature
The current temperature of the climate device, as reported from the integration.
Definition climate.h:230
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_supported_presets(ClimatePresetMask presets)
void set_visual_min_temperature(float visual_min_temperature)
void set_supported_modes(ClimateModeMask modes)
void set_supported_custom_fan_modes(std::initializer_list< const char * > modes)
void set_supported_custom_presets(std::initializer_list< const char * > presets)
BedjetHeatMode
Optional heating strategies to use for climate::CLIMATE_MODE_HEAT.
@ HEAT_MODE_EXTENDED
HVACMode.HEAT is handled using BTN_EXTHT.
@ HEAT_MODE_HEAT
HVACMode.HEAT is handled using BTN_HEAT (default)
@ CLIMATE_SUPPORTS_CURRENT_TEMPERATURE
@ CLIMATE_PRESET_BOOST
Device is in boost preset.
@ CLIMATE_MODE_DRY
The climate device is set to dry/humidity mode.
@ CLIMATE_MODE_FAN_ONLY
The climate device only has the fan enabled, no heating or cooling is taking place.
@ CLIMATE_MODE_HEAT
The climate device is set to heat to reach the target temperature.
@ CLIMATE_MODE_OFF
The climate device is off.
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.cpp:66
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
The format of a BedJet V3 status packet.