mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2025-02-22 02:42:19 +01:00
Esphome climate add action (#2)
Esphome climate fix Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
commit
41fa3609d7
@ -644,6 +644,12 @@ enum ClimateMode {
|
||||
CLIMATE_MODE_COOL = 2;
|
||||
CLIMATE_MODE_HEAT = 3;
|
||||
}
|
||||
enum ClimateAction {
|
||||
CLIMATE_ACTION_OFF = 0;
|
||||
// values same as mode for readability
|
||||
CLIMATE_ACTION_COOLING = 2;
|
||||
CLIMATE_ACTION_HEATING = 3;
|
||||
}
|
||||
message ListEntitiesClimateResponse {
|
||||
option (id) = 46;
|
||||
option (source) = SOURCE_SERVER;
|
||||
@ -661,6 +667,7 @@ message ListEntitiesClimateResponse {
|
||||
float visual_max_temperature = 9;
|
||||
float visual_temperature_step = 10;
|
||||
bool supports_away = 11;
|
||||
bool supports_action = 12;
|
||||
}
|
||||
message ClimateStateResponse {
|
||||
option (id) = 47;
|
||||
@ -675,6 +682,7 @@ message ClimateStateResponse {
|
||||
float target_temperature_low = 5;
|
||||
float target_temperature_high = 6;
|
||||
bool away = 7;
|
||||
ClimateAction action = 8;
|
||||
}
|
||||
message ClimateCommandRequest {
|
||||
option (id) = 48;
|
||||
|
File diff suppressed because one or more lines are too long
@ -184,6 +184,12 @@ class ClimateMode(enum.IntEnum):
|
||||
HEAT = 3
|
||||
|
||||
|
||||
class ClimateAction(enum.IntEnum):
|
||||
OFF = 0
|
||||
COOLING = 2
|
||||
HEATING = 3
|
||||
|
||||
|
||||
def _convert_climate_modes(value):
|
||||
return [ClimateMode(val) for val in value]
|
||||
|
||||
@ -197,11 +203,13 @@ class ClimateInfo(EntityInfo):
|
||||
visual_max_temperature = attr.ib(type=float)
|
||||
visual_temperature_step = attr.ib(type=float)
|
||||
supports_away = attr.ib(type=bool)
|
||||
supports_action = attr.ib(type=bool)
|
||||
|
||||
|
||||
@attr.s
|
||||
class ClimateState(EntityState):
|
||||
mode = attr.ib(type=ClimateMode, converter=ClimateMode)
|
||||
action = attr.ib(type=ClimateAction, converter=ClimateAction)
|
||||
current_temperature = attr.ib(type=float)
|
||||
target_temperature = attr.ib(type=float)
|
||||
target_temperature_low = attr.ib(type=float)
|
||||
|
Loading…
Reference in New Issue
Block a user