ESPHome 2025.12.0-dev
Loading...
Searching...
No Matches
esphome::climate::ClimateCall Class Reference

This class is used to encode all control actions on a climate device. More...

#include <climate.h>

Public Member Functions

 ClimateCall (Climate *parent)
 
ClimateCallset_mode (ClimateMode mode)
 Set the mode of the climate device.
 
ClimateCallset_mode (optional< ClimateMode > mode)
 Set the mode of the climate device.
 
ClimateCallset_mode (const std::string &mode)
 Set the mode of the climate device based on a string.
 
ClimateCallset_target_temperature (float target_temperature)
 Set the target temperature of the climate device.
 
ClimateCallset_target_temperature (optional< float > target_temperature)
 Set the target temperature of the climate device.
 
ClimateCallset_target_temperature_low (float target_temperature_low)
 Set the low point target temperature of the climate device.
 
ClimateCallset_target_temperature_low (optional< float > target_temperature_low)
 Set the low point target temperature of the climate device.
 
ClimateCallset_target_temperature_high (float target_temperature_high)
 Set the high point target temperature of the climate device.
 
ClimateCallset_target_temperature_high (optional< float > target_temperature_high)
 Set the high point target temperature of the climate device.
 
ClimateCallset_target_humidity (float target_humidity)
 Set the target humidity of the climate device.
 
ClimateCallset_target_humidity (optional< float > target_humidity)
 Set the target humidity of the climate device.
 
ClimateCallset_fan_mode (ClimateFanMode fan_mode)
 Set the fan mode of the climate device.
 
ClimateCallset_fan_mode (optional< ClimateFanMode > fan_mode)
 Set the fan mode of the climate device.
 
ClimateCallset_fan_mode (const std::string &fan_mode)
 Set the fan mode of the climate device based on a string.
 
ClimateCallset_fan_mode (optional< std::string > fan_mode)
 Set the fan mode of the climate device based on a string.
 
ClimateCallset_fan_mode (const char *custom_fan_mode)
 Set the custom fan mode of the climate device.
 
ClimateCallset_swing_mode (ClimateSwingMode swing_mode)
 Set the swing mode of the climate device.
 
ClimateCallset_swing_mode (optional< ClimateSwingMode > swing_mode)
 Set the swing mode of the climate device.
 
ClimateCallset_swing_mode (const std::string &swing_mode)
 Set the swing mode of the climate device based on a string.
 
ClimateCallset_preset (ClimatePreset preset)
 Set the preset of the climate device.
 
ClimateCallset_preset (optional< ClimatePreset > preset)
 Set the preset of the climate device.
 
ClimateCallset_preset (const std::string &preset)
 Set the preset of the climate device based on a string.
 
ClimateCallset_preset (optional< std::string > preset)
 Set the preset of the climate device based on a string.
 
ClimateCallset_preset (const char *custom_preset)
 Set the custom preset of the climate device.
 
void perform ()
 
const optional< float > & get_target_temperature () const
 
const optional< float > & get_target_temperature_low () const
 
const optional< float > & get_target_temperature_high () const
 
const optional< float > & get_target_humidity () const
 
const optional< ClimateMode > & get_mode () const
 
const optional< ClimateFanMode > & get_fan_mode () const
 
const optional< ClimateSwingMode > & get_swing_mode () const
 
const optional< ClimatePreset > & get_preset () const
 
const char * get_custom_fan_mode () const
 
const char * get_custom_preset () const
 
bool has_custom_fan_mode () const
 
bool has_custom_preset () const
 

Protected Member Functions

void validate_ ()
 

Protected Attributes

Climate *const parent_
 
optional< float > target_temperature_
 
optional< float > target_temperature_low_
 
optional< float > target_temperature_high_
 
optional< float > target_humidity_
 
optional< ClimateModemode_
 
optional< ClimateFanModefan_mode_
 
optional< ClimateSwingModeswing_mode_
 
optional< ClimatePresetpreset_
 

Detailed Description

This class is used to encode all control actions on a climate device.

It is supposed to be used by all code that wishes to control a climate device (mqtt, api, lambda etc). Create an instance of this class by calling id(climate_device).make_call();. Then set all attributes with the set_x methods. Finally, to apply the changes call .perform();.

The integration that implements the climate device receives this instance with the control method. It should check all the properties it implements and apply them as needed. It should do so by getting all properties it controls with the getter methods in this class. If the optional value is set (check with .has_value()) that means the user wants to control this property. Get the value of the optional with the star operator (*call.get_mode()) and apply it.

Definition at line 33 of file climate.h.

Constructor & Destructor Documentation

◆ ClimateCall()

esphome::climate::ClimateCall::ClimateCall ( Climate * parent)
inlineexplicit

Definition at line 35 of file climate.h.

Member Function Documentation

◆ get_custom_fan_mode()

const char * esphome::climate::ClimateCall::get_custom_fan_mode ( ) const
inline

Definition at line 110 of file climate.h.

◆ get_custom_preset()

const char * esphome::climate::ClimateCall::get_custom_preset ( ) const
inline

Definition at line 111 of file climate.h.

◆ get_fan_mode()

const optional< ClimateFanMode > & esphome::climate::ClimateCall::get_fan_mode ( ) const

Definition at line 293 of file climate.cpp.

◆ get_mode()

const optional< ClimateMode > & esphome::climate::ClimateCall::get_mode ( ) const

Definition at line 292 of file climate.cpp.

◆ get_preset()

const optional< ClimatePreset > & esphome::climate::ClimateCall::get_preset ( ) const

Definition at line 295 of file climate.cpp.

◆ get_swing_mode()

const optional< ClimateSwingMode > & esphome::climate::ClimateCall::get_swing_mode ( ) const

Definition at line 294 of file climate.cpp.

◆ get_target_humidity()

const optional< float > & esphome::climate::ClimateCall::get_target_humidity ( ) const

Definition at line 290 of file climate.cpp.

◆ get_target_temperature()

const optional< float > & esphome::climate::ClimateCall::get_target_temperature ( ) const

Definition at line 287 of file climate.cpp.

◆ get_target_temperature_high()

const optional< float > & esphome::climate::ClimateCall::get_target_temperature_high ( ) const

Definition at line 289 of file climate.cpp.

◆ get_target_temperature_low()

const optional< float > & esphome::climate::ClimateCall::get_target_temperature_low ( ) const

Definition at line 288 of file climate.cpp.

◆ has_custom_fan_mode()

bool esphome::climate::ClimateCall::has_custom_fan_mode ( ) const
inline

Definition at line 112 of file climate.h.

◆ has_custom_preset()

bool esphome::climate::ClimateCall::has_custom_preset ( ) const
inline

Definition at line 113 of file climate.h.

◆ perform()

void esphome::climate::ClimateCall::perform ( )

Definition at line 47 of file climate.cpp.

◆ set_fan_mode() [1/5]

ClimateCall & esphome::climate::ClimateCall::set_fan_mode ( ClimateFanMode fan_mode)

Set the fan mode of the climate device.

Definition at line 187 of file climate.cpp.

◆ set_fan_mode() [2/5]

ClimateCall & esphome::climate::ClimateCall::set_fan_mode ( const char * custom_fan_mode)

Set the custom fan mode of the climate device.

Definition at line 193 of file climate.cpp.

◆ set_fan_mode() [3/5]

ClimateCall & esphome::climate::ClimateCall::set_fan_mode ( const std::string & fan_mode)

Set the fan mode of the climate device based on a string.

Definition at line 210 of file climate.cpp.

◆ set_fan_mode() [4/5]

ClimateCall & esphome::climate::ClimateCall::set_fan_mode ( optional< ClimateFanMode > fan_mode)

Set the fan mode of the climate device.

Definition at line 322 of file climate.cpp.

◆ set_fan_mode() [5/5]

ClimateCall & esphome::climate::ClimateCall::set_fan_mode ( optional< std::string > fan_mode)

Set the fan mode of the climate device based on a string.

Definition at line 212 of file climate.cpp.

◆ set_mode() [1/3]

ClimateCall & esphome::climate::ClimateCall::set_mode ( ClimateMode mode)

Set the mode of the climate device.

Definition at line 171 of file climate.cpp.

◆ set_mode() [2/3]

ClimateCall & esphome::climate::ClimateCall::set_mode ( const std::string & mode)

Set the mode of the climate device based on a string.

Definition at line 176 of file climate.cpp.

◆ set_mode() [3/3]

ClimateCall & esphome::climate::ClimateCall::set_mode ( optional< ClimateMode > mode)

Set the mode of the climate device.

Definition at line 317 of file climate.cpp.

◆ set_preset() [1/5]

ClimateCall & esphome::climate::ClimateCall::set_preset ( ClimatePreset preset)

Set the preset of the climate device.

Definition at line 219 of file climate.cpp.

◆ set_preset() [2/5]

ClimateCall & esphome::climate::ClimateCall::set_preset ( const char * custom_preset)

Set the custom preset of the climate device.

Definition at line 225 of file climate.cpp.

◆ set_preset() [3/5]

ClimateCall & esphome::climate::ClimateCall::set_preset ( const std::string & preset)

Set the preset of the climate device based on a string.

Definition at line 242 of file climate.cpp.

◆ set_preset() [4/5]

ClimateCall & esphome::climate::ClimateCall::set_preset ( optional< ClimatePreset > preset)

Set the preset of the climate device.

Definition at line 328 of file climate.cpp.

◆ set_preset() [5/5]

ClimateCall & esphome::climate::ClimateCall::set_preset ( optional< std::string > preset)

Set the preset of the climate device based on a string.

Definition at line 244 of file climate.cpp.

◆ set_swing_mode() [1/3]

ClimateCall & esphome::climate::ClimateCall::set_swing_mode ( ClimateSwingMode swing_mode)

Set the swing mode of the climate device.

Definition at line 251 of file climate.cpp.

◆ set_swing_mode() [2/3]

ClimateCall & esphome::climate::ClimateCall::set_swing_mode ( const std::string & swing_mode)

Set the swing mode of the climate device based on a string.

Definition at line 256 of file climate.cpp.

◆ set_swing_mode() [3/3]

ClimateCall & esphome::climate::ClimateCall::set_swing_mode ( optional< ClimateSwingMode > swing_mode)

Set the swing mode of the climate device.

Definition at line 334 of file climate.cpp.

◆ set_target_humidity() [1/2]

ClimateCall & esphome::climate::ClimateCall::set_target_humidity ( float target_humidity)

Set the target humidity of the climate device.

Definition at line 282 of file climate.cpp.

◆ set_target_humidity() [2/2]

ClimateCall & esphome::climate::ClimateCall::set_target_humidity ( optional< float > target_humidity)

Set the target humidity of the climate device.

Definition at line 312 of file climate.cpp.

◆ set_target_temperature() [1/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature ( float target_temperature)

Set the target temperature of the climate device.

Definition at line 267 of file climate.cpp.

◆ set_target_temperature() [2/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature ( optional< float > target_temperature)

Set the target temperature of the climate device.

Definition at line 307 of file climate.cpp.

◆ set_target_temperature_high() [1/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature_high ( float target_temperature_high)

Set the high point target temperature of the climate device.

For climate devices with two point target temperature control

Definition at line 277 of file climate.cpp.

◆ set_target_temperature_high() [2/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature_high ( optional< float > target_temperature_high)

Set the high point target temperature of the climate device.

For climate devices with two point target temperature control

Definition at line 297 of file climate.cpp.

◆ set_target_temperature_low() [1/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature_low ( float target_temperature_low)

Set the low point target temperature of the climate device.

For climate devices with two point target temperature control

Definition at line 272 of file climate.cpp.

◆ set_target_temperature_low() [2/2]

ClimateCall & esphome::climate::ClimateCall::set_target_temperature_low ( optional< float > target_temperature_low)

Set the low point target temperature of the climate device.

For climate devices with two point target temperature control

Definition at line 302 of file climate.cpp.

◆ validate_()

void esphome::climate::ClimateCall::validate_ ( )
protected

Definition at line 92 of file climate.cpp.

Field Documentation

◆ fan_mode_

optional<ClimateFanMode> esphome::climate::ClimateCall::fan_mode_
protected

Definition at line 124 of file climate.h.

◆ mode_

optional<ClimateMode> esphome::climate::ClimateCall::mode_
protected

Definition at line 123 of file climate.h.

◆ parent_

Climate* const esphome::climate::ClimateCall::parent_
protected

Definition at line 118 of file climate.h.

◆ preset_

optional<ClimatePreset> esphome::climate::ClimateCall::preset_
protected

Definition at line 126 of file climate.h.

◆ swing_mode_

optional<ClimateSwingMode> esphome::climate::ClimateCall::swing_mode_
protected

Definition at line 125 of file climate.h.

◆ target_humidity_

optional<float> esphome::climate::ClimateCall::target_humidity_
protected

Definition at line 122 of file climate.h.

◆ target_temperature_

optional<float> esphome::climate::ClimateCall::target_temperature_
protected

Definition at line 119 of file climate.h.

◆ target_temperature_high_

optional<float> esphome::climate::ClimateCall::target_temperature_high_
protected

Definition at line 121 of file climate.h.

◆ target_temperature_low_

optional<float> esphome::climate::ClimateCall::target_temperature_low_
protected

Definition at line 120 of file climate.h.


The documentation for this class was generated from the following files: