1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-22 21:08:16 +00:00
esphome/esphome/components/climate/climate_mode.cpp
Marcel van der Veldt 72d6471ab8 add support for climate action (#720)
* add support for climate action:

Following hass implementation of climate, action represents the current action the climate device is perfoming, e.g. cooling or heating

fix bang_bang climate:

make sure that the thresholds are always respected.
fixes the issue where the component would just keep on heating, regardless of the temperature range

* Updates

- Use dedicated enum for action (otherwise it gets confusing because "auto" is not a valid action)
- Add field to tell HA that action is supported
- Revert semantic changes in bang_bang

* Conditional print


Co-authored-by: Otto Winter <otto@otto-winter.com>
2019-10-18 10:39:14 +02:00

35 lines
714 B
C++

#include "climate_mode.h"
namespace esphome {
namespace climate {
const char *climate_mode_to_string(ClimateMode mode) {
switch (mode) {
case CLIMATE_MODE_OFF:
return "OFF";
case CLIMATE_MODE_AUTO:
return "AUTO";
case CLIMATE_MODE_COOL:
return "COOL";
case CLIMATE_MODE_HEAT:
return "HEAT";
default:
return "UNKNOWN";
}
}
const char *climate_action_to_string(ClimateAction action) {
switch (action) {
case CLIMATE_ACTION_OFF:
return "OFF";
case CLIMATE_ACTION_COOLING:
return "COOLING";
case CLIMATE_ACTION_HEATING:
return "HEATING";
default:
return "UNKNOWN";
}
}
} // namespace climate
} // namespace esphome