1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-25 13:13:48 +01:00

Add climate dry fan (#845)

* add climate dry fan

* clang-format

* updates, add swing mode, add back compat with old ha

* revert client-config add swing

* sort const.py

* fix missing retur
This commit is contained in:
Guillermo Ruffino
2019-11-16 12:34:11 -03:00
committed by Otto Winter
parent 4f8f59f705
commit 1814e4a46b
21 changed files with 824 additions and 85 deletions

View File

@@ -64,6 +64,18 @@ class ClimateCall {
ClimateCall &set_target_temperature_high(optional<float> target_temperature_high);
ClimateCall &set_away(bool away);
ClimateCall &set_away(optional<bool> away);
/// Set the fan mode of the climate device.
ClimateCall &set_fan_mode(ClimateFanMode fan_mode);
/// Set the fan mode of the climate device.
ClimateCall &set_fan_mode(optional<ClimateFanMode> fan_mode);
/// Set the fan mode of the climate device based on a string.
ClimateCall &set_fan_mode(const std::string &fan_mode);
/// Set the swing mode of the climate device.
ClimateCall &set_swing_mode(ClimateSwingMode swing_mode);
/// Set the swing mode of the climate device.
ClimateCall &set_swing_mode(optional<ClimateSwingMode> swing_mode);
/// Set the swing mode of the climate device based on a string.
ClimateCall &set_swing_mode(const std::string &swing_mode);
void perform();
@@ -72,6 +84,8 @@ class ClimateCall {
const optional<float> &get_target_temperature_low() const;
const optional<float> &get_target_temperature_high() const;
const optional<bool> &get_away() const;
const optional<ClimateFanMode> &get_fan_mode() const;
const optional<ClimateSwingMode> &get_swing_mode() const;
protected:
void validate_();
@@ -82,12 +96,16 @@ class ClimateCall {
optional<float> target_temperature_low_;
optional<float> target_temperature_high_;
optional<bool> away_;
optional<ClimateFanMode> fan_mode_;
optional<ClimateSwingMode> swing_mode_;
};
/// Struct used to save the state of the climate device in restore memory.
struct ClimateDeviceRestoreState {
ClimateMode mode;
bool away;
ClimateFanMode fan_mode;
ClimateSwingMode swing_mode;
union {
float target_temperature;
struct {
@@ -149,6 +167,12 @@ class Climate : public Nameable {
*/
bool away{false};
/// The active fan mode of the climate device.
ClimateFanMode fan_mode;
/// The active swing mode of the climate device.
ClimateSwingMode swing_mode;
/** Add a callback for the climate device state, each time the state of the climate device is updated
* (using publish_state), this callback will be called.
*