ESPHome 2025.5.0
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
41 // climate::CLIMATE_MODE_TURBO // Not supported by Climate: see presets instead
44 });
45
46 // It would be better if we had a slider for the fan modes.
47 traits.set_supported_custom_fan_modes(BEDJET_FAN_STEP_NAMES_SET);
49 // If we support NONE, then have to decide what happens if the user switches to it (turn off?)
50 // climate::CLIMATE_PRESET_NONE,
51 // Climate doesn't have a "TURBO" mode, but we can use the BOOST preset instead.
53 });
55 // We could fetch biodata from bedjet and set these names that way.
56 // But then we have to invert the lookup in order to send the right preset.
57 // For now, we can leave them as M1-3 to match the remote buttons.
58 // EXT HT added to match remote button.
59 "EXT HT",
60 "M1",
61 "M2",
62 "M3",
63 });
64 if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
66 } else {
68 }
72 return traits;
73 }
74
75 protected:
76 void control(const climate::ClimateCall &call) override;
77
80
81 void reset_state_();
82 bool update_status_();
83
84 bool is_valid_() {
85 // FIXME: find a better way to check this?
86 return !std::isnan(this->current_temperature) && !std::isnan(this->target_temperature) &&
87 this->current_temperature > 1 && this->target_temperature > 1;
88 }
89};
90
91} // namespace bedjet
92} // namespace esphome
93
94#endif
bool is_ready() const
This class simplifies creating components that periodically check a state.
Definition component.h:301
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:168
ClimateMode mode
The active mode of the climate device.
Definition climate.h:173
float target_temperature
The target temperature of the climate device.
Definition climate.h:186
float current_temperature
The current temperature of the climate device, as reported from the integration.
Definition climate.h:179
This class contains all static data for climate devices.
void set_visual_max_temperature(float visual_max_temperature)
void set_supported_modes(std::set< ClimateMode > modes)
void set_supported_custom_fan_modes(std::set< std::string > supported_custom_fan_modes)
void set_supports_action(bool supports_action)
void set_supported_custom_presets(std::set< std::string > supported_custom_presets)
void add_supported_custom_preset(const std::string &preset)
void set_visual_temperature_step(float temperature_step)
void set_visual_min_temperature(float visual_min_temperature)
void set_supported_presets(std::set< ClimatePreset > presets)
void set_supports_current_temperature(bool supports_current_temperature)
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_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:26
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
The format of a BedJet V3 status packet.