ESPHome  1.14.3
Public Member Functions | Protected Member Functions | Protected Attributes
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. More...
 
ClimateCallset_mode (optional< ClimateMode > mode)
 Set the mode of the climate device. More...
 
ClimateCallset_mode (const std::string &mode)
 Set the mode of the climate device based on a string. More...
 
ClimateCallset_target_temperature (float target_temperature)
 Set the target temperature of the climate device. More...
 
ClimateCallset_target_temperature (optional< float > target_temperature)
 Set the target temperature of the climate device. More...
 
ClimateCallset_target_temperature_low (float target_temperature_low)
 Set the low point target temperature of the climate device. More...
 
ClimateCallset_target_temperature_low (optional< float > target_temperature_low)
 Set the low point target temperature of the climate device. More...
 
ClimateCallset_target_temperature_high (float target_temperature_high)
 Set the high point target temperature of the climate device. More...
 
ClimateCallset_target_temperature_high (optional< float > target_temperature_high)
 Set the high point target temperature of the climate device. More...
 
ClimateCallset_away (bool away)
 
ClimateCallset_away (optional< bool > away)
 
void perform ()
 
const optional< ClimateMode > & get_mode () const
 
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< bool > & get_away () const
 

Protected Member Functions

void validate_ ()
 

Protected Attributes

Climate *const parent_
 
optional< ClimateModemode_
 
optional< float > target_temperature_
 
optional< float > target_temperature_low_
 
optional< float > target_temperature_high_
 
optional< bool > away_
 

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 31 of file climate.h.

Constructor & Destructor Documentation

◆ ClimateCall()

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

Definition at line 33 of file climate.h.

Member Function Documentation

◆ get_away()

const optional< bool > & esphome::climate::ClimateCall::get_away ( ) const

Definition at line 115 of file climate.cpp.

◆ get_mode()

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

Definition at line 111 of file climate.cpp.

◆ get_target_temperature()

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

Definition at line 112 of file climate.cpp.

◆ get_target_temperature_high()

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

Definition at line 114 of file climate.cpp.

◆ get_target_temperature_low()

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

Definition at line 113 of file climate.cpp.

◆ perform()

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

Definition at line 9 of file climate.cpp.

◆ set_away() [1/2]

ClimateCall & esphome::climate::ClimateCall::set_away ( bool  away)

Definition at line 116 of file climate.cpp.

◆ set_away() [2/2]

ClimateCall & esphome::climate::ClimateCall::set_away ( optional< bool >  away)

Definition at line 120 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 81 of file climate.cpp.

◆ set_mode() [2/3]

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

Set the mode of the climate device.

Definition at line 136 of file climate.cpp.

◆ set_mode() [3/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 85 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 99 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 132 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 107 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 124 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 103 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 128 of file climate.cpp.

◆ validate_()

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

Definition at line 30 of file climate.cpp.

Field Documentation

◆ away_

optional<bool> esphome::climate::ClimateCall::away_
protected

Definition at line 84 of file climate.h.

◆ mode_

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

Definition at line 80 of file climate.h.

◆ parent_

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

Definition at line 79 of file climate.h.

◆ target_temperature_

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

Definition at line 81 of file climate.h.

◆ target_temperature_high_

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

Definition at line 83 of file climate.h.

◆ target_temperature_low_

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

Definition at line 82 of file climate.h.


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