mirror of
https://github.com/esphome/esphome.git
synced 2025-09-04 20:32:21 +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:
committed by
Otto Winter
parent
4f8f59f705
commit
1814e4a46b
@@ -1,3 +1,5 @@
|
||||
// This file was automatically generated with a tool.
|
||||
// See scripts/api_protobuf/api_protobuf.py
|
||||
#include "api_pb2.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
@@ -102,6 +104,48 @@ template<> const char *proto_enum_to_string<enums::ClimateMode>(enums::ClimateMo
|
||||
return "CLIMATE_MODE_COOL";
|
||||
case enums::CLIMATE_MODE_HEAT:
|
||||
return "CLIMATE_MODE_HEAT";
|
||||
case enums::CLIMATE_MODE_FAN_ONLY:
|
||||
return "CLIMATE_MODE_FAN_ONLY";
|
||||
case enums::CLIMATE_MODE_DRY:
|
||||
return "CLIMATE_MODE_DRY";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::ClimateFanMode>(enums::ClimateFanMode value) {
|
||||
switch (value) {
|
||||
case enums::CLIMATE_FAN_ON:
|
||||
return "CLIMATE_FAN_ON";
|
||||
case enums::CLIMATE_FAN_OFF:
|
||||
return "CLIMATE_FAN_OFF";
|
||||
case enums::CLIMATE_FAN_AUTO:
|
||||
return "CLIMATE_FAN_AUTO";
|
||||
case enums::CLIMATE_FAN_LOW:
|
||||
return "CLIMATE_FAN_LOW";
|
||||
case enums::CLIMATE_FAN_MEDIUM:
|
||||
return "CLIMATE_FAN_MEDIUM";
|
||||
case enums::CLIMATE_FAN_HIGH:
|
||||
return "CLIMATE_FAN_HIGH";
|
||||
case enums::CLIMATE_FAN_MIDDLE:
|
||||
return "CLIMATE_FAN_MIDDLE";
|
||||
case enums::CLIMATE_FAN_FOCUS:
|
||||
return "CLIMATE_FAN_FOCUS";
|
||||
case enums::CLIMATE_FAN_DIFFUSE:
|
||||
return "CLIMATE_FAN_DIFFUSE";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
template<> const char *proto_enum_to_string<enums::ClimateSwingMode>(enums::ClimateSwingMode value) {
|
||||
switch (value) {
|
||||
case enums::CLIMATE_SWING_OFF:
|
||||
return "CLIMATE_SWING_OFF";
|
||||
case enums::CLIMATE_SWING_BOTH:
|
||||
return "CLIMATE_SWING_BOTH";
|
||||
case enums::CLIMATE_SWING_VERTICAL:
|
||||
return "CLIMATE_SWING_VERTICAL";
|
||||
case enums::CLIMATE_SWINT_HORIZONTAL:
|
||||
return "CLIMATE_SWINT_HORIZONTAL";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
@@ -2458,6 +2502,14 @@ bool ListEntitiesClimateResponse::decode_varint(uint32_t field_id, ProtoVarInt v
|
||||
this->supports_action = value.as_bool();
|
||||
return true;
|
||||
}
|
||||
case 13: {
|
||||
this->supported_fan_modes.push_back(value.as_enum<enums::ClimateFanMode>());
|
||||
return true;
|
||||
}
|
||||
case 14: {
|
||||
this->supported_swing_modes.push_back(value.as_enum<enums::ClimateSwingMode>());
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -2517,6 +2569,12 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(10, this->visual_temperature_step);
|
||||
buffer.encode_bool(11, this->supports_away);
|
||||
buffer.encode_bool(12, this->supports_action);
|
||||
for (auto &it : this->supported_fan_modes) {
|
||||
buffer.encode_enum<enums::ClimateFanMode>(13, it, true);
|
||||
}
|
||||
for (auto &it : this->supported_swing_modes) {
|
||||
buffer.encode_enum<enums::ClimateSwingMode>(14, it, true);
|
||||
}
|
||||
}
|
||||
void ListEntitiesClimateResponse::dump_to(std::string &out) const {
|
||||
char buffer[64];
|
||||
@@ -2574,6 +2632,18 @@ void ListEntitiesClimateResponse::dump_to(std::string &out) const {
|
||||
out.append(" supports_action: ");
|
||||
out.append(YESNO(this->supports_action));
|
||||
out.append("\n");
|
||||
|
||||
for (const auto &it : this->supported_fan_modes) {
|
||||
out.append(" supported_fan_modes: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateFanMode>(it));
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
for (const auto &it : this->supported_swing_modes) {
|
||||
out.append(" supported_swing_modes: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateSwingMode>(it));
|
||||
out.append("\n");
|
||||
}
|
||||
out.append("}");
|
||||
}
|
||||
bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
@@ -2590,6 +2660,14 @@ bool ClimateStateResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
this->action = value.as_enum<enums::ClimateAction>();
|
||||
return true;
|
||||
}
|
||||
case 9: {
|
||||
this->fan_mode = value.as_enum<enums::ClimateFanMode>();
|
||||
return true;
|
||||
}
|
||||
case 10: {
|
||||
this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -2629,6 +2707,8 @@ void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(6, this->target_temperature_high);
|
||||
buffer.encode_bool(7, this->away);
|
||||
buffer.encode_enum<enums::ClimateAction>(8, this->action);
|
||||
buffer.encode_enum<enums::ClimateFanMode>(9, this->fan_mode);
|
||||
buffer.encode_enum<enums::ClimateSwingMode>(10, this->swing_mode);
|
||||
}
|
||||
void ClimateStateResponse::dump_to(std::string &out) const {
|
||||
char buffer[64];
|
||||
@@ -2669,6 +2749,14 @@ void ClimateStateResponse::dump_to(std::string &out) const {
|
||||
out.append(" action: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateAction>(this->action));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" fan_mode: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" swing_mode: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
@@ -2701,6 +2789,22 @@ bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value)
|
||||
this->away = value.as_bool();
|
||||
return true;
|
||||
}
|
||||
case 12: {
|
||||
this->has_fan_mode = value.as_bool();
|
||||
return true;
|
||||
}
|
||||
case 13: {
|
||||
this->fan_mode = value.as_enum<enums::ClimateFanMode>();
|
||||
return true;
|
||||
}
|
||||
case 14: {
|
||||
this->has_swing_mode = value.as_bool();
|
||||
return true;
|
||||
}
|
||||
case 15: {
|
||||
this->swing_mode = value.as_enum<enums::ClimateSwingMode>();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -2739,6 +2843,10 @@ void ClimateCommandRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_float(9, this->target_temperature_high);
|
||||
buffer.encode_bool(10, this->has_away);
|
||||
buffer.encode_bool(11, this->away);
|
||||
buffer.encode_bool(12, this->has_fan_mode);
|
||||
buffer.encode_enum<enums::ClimateFanMode>(13, this->fan_mode);
|
||||
buffer.encode_bool(14, this->has_swing_mode);
|
||||
buffer.encode_enum<enums::ClimateSwingMode>(15, this->swing_mode);
|
||||
}
|
||||
void ClimateCommandRequest::dump_to(std::string &out) const {
|
||||
char buffer[64];
|
||||
@@ -2790,6 +2898,22 @@ void ClimateCommandRequest::dump_to(std::string &out) const {
|
||||
out.append(" away: ");
|
||||
out.append(YESNO(this->away));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_fan_mode: ");
|
||||
out.append(YESNO(this->has_fan_mode));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" fan_mode: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateFanMode>(this->fan_mode));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" has_swing_mode: ");
|
||||
out.append(YESNO(this->has_swing_mode));
|
||||
out.append("\n");
|
||||
|
||||
out.append(" swing_mode: ");
|
||||
out.append(proto_enum_to_string<enums::ClimateSwingMode>(this->swing_mode));
|
||||
out.append("\n");
|
||||
out.append("}");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user