14static void set_sensor(Sensor *sensor,
float value) {
15 if (sensor !=
nullptr && (!sensor->has_state() || sensor->get_raw_state() != value))
16 sensor->publish_state(value);
19template<
typename T>
void update_property(T &property,
const T &value,
bool &flag) {
20 if (property != value) {
27 bool need_publish =
false;
58 dudanov::midea::ac::Control ctrl{};
59 if (
call.get_target_temperature().has_value())
60 ctrl.targetTemp =
call.get_target_temperature().value();
61 if (
call.get_swing_mode().has_value())
63 if (
call.get_mode().has_value())
65 if (
call.get_preset().has_value()) {
67 }
else if (
call.get_custom_preset().has_value()) {
70 if (
call.get_fan_mode().has_value()) {
72 }
else if (
call.get_custom_fan_mode().has_value()) {
75 this->
base_.control(ctrl);
94 if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_OK)
110#ifdef USE_REMOTE_TRANSMITTER
113 if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_OK) {
114 this->
base_.getCapabilities().dump();
115 }
else if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_ERROR) {
117 "Failed to get 0xB5 capabilities report. Suggest to disable it in config and manually set your "
118 "appliance options.");
126#ifdef USE_REMOTE_TRANSMITTER
137 char temp_symbol = use_fahrenheit ?
'F' :
'C';
139 temp_symbol, temp_uint8, temp_symbol);
145 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
150#ifdef USE_REMOTE_TRANSMITTER
154 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
159 if (this->
base_.getCapabilities().supportLightControl()) {
160 this->
base_.displayToggle();
162#ifdef USE_REMOTE_TRANSMITTER
166 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
This class is used to encode all control actions on a climate device.
ClimateMode mode
The active mode of the climate device.
bool set_custom_fan_mode_(const std::string &mode)
Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed.
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
bool set_custom_preset_(const std::string &preset)
Set custom preset. Reset primary preset. Return true if preset has been changed.
float target_temperature
The target temperature of the climate device.
void dump_traits_(const char *tag)
ClimateSwingMode swing_mode
The active swing mode of the climate device.
bool set_preset_(ClimatePreset preset)
Set preset. Reset custom preset. Return true if preset has been changed.
bool set_fan_mode_(ClimateFanMode mode)
Set fan mode. Reset custom fan mode. Return true if fan mode has been changed.
float current_temperature
The current temperature of the climate device, as reported from the integration.
void publish_state()
Publish the state of the climate device, to be called from integrations.
optional< ClimatePreset > preset
The active preset of the climate device.
This class contains all static data for climate devices.
void set_visual_max_temperature(float visual_max_temperature)
void set_supported_modes(std::set< ClimateMode > modes)
const std::set< climate::ClimatePreset > & get_supported_presets() const
void set_supported_custom_fan_modes(std::set< std::string > supported_custom_fan_modes)
void add_supported_fan_mode(ClimateFanMode mode)
void set_supported_custom_presets(std::set< std::string > supported_custom_presets)
void set_visual_temperature_step(float temperature_step)
void add_supported_preset(ClimatePreset preset)
void set_visual_min_temperature(float visual_min_temperature)
void set_supported_swing_modes(std::set< ClimateSwingMode > modes)
void set_supported_presets(std::set< ClimatePreset > presets)
void add_supported_mode(ClimateMode mode)
void set_supports_current_temperature(bool supports_current_temperature)
void add_supported_swing_mode(ClimateSwingMode mode)
const std::set< ClimateMode > & get_supported_modes() const
const std::set< ClimateSwingMode > & get_supported_swing_modes() const
dudanov::midea::ac::AirConditioner base_
IrTransmitter transmitter_
void transmit(IrData &data)
std::set< ClimateMode > supported_modes_
void on_status_change() override
std::set< ClimateSwingMode > supported_swing_modes_
std::set< ClimatePreset > supported_presets_
ClimateTraits traits() override
std::set< std::string > supported_custom_presets_
void do_follow_me(float temperature, bool use_fahrenheit, bool beeper=false)
void dump_config() override
std::set< std::string > supported_custom_fan_modes_
Sensor * humidity_sensor_
void control(const ClimateCall &call) override
static const char *const TAG
static ClimateFanMode to_climate_fan_mode(MideaFanMode fan_mode)
static ClimateSwingMode to_climate_swing_mode(MideaSwingMode mode)
static const std::string & to_custom_climate_fan_mode(MideaFanMode fan_mode)
static MideaSwingMode to_midea_swing_mode(ClimateSwingMode mode)
static MideaPreset to_midea_preset(ClimatePreset preset)
static ClimateMode to_climate_mode(MideaMode mode)
static MideaFanMode to_midea_fan_mode(ClimateFanMode fan_mode)
static const std::string & to_custom_climate_preset(MideaPreset preset)
static ClimatePreset to_climate_preset(MideaPreset preset)
static bool is_custom_midea_fan_mode(MideaFanMode fan_mode)
static bool is_custom_midea_preset(MideaPreset preset)
static MideaMode to_midea_mode(ClimateMode mode)
static void to_climate_traits(ClimateTraits &traits, const dudanov::midea::ac::Capabilities &capabilities)
@ CLIMATE_PRESET_NONE
No preset is active.
@ CLIMATE_SWING_OFF
The swing mode is set to Off.
@ CLIMATE_MODE_OFF
The climate device is off.
@ CLIMATE_FAN_MEDIUM
The fan mode is set to Medium.
@ CLIMATE_FAN_AUTO
The fan mode is set to Auto.
@ CLIMATE_FAN_LOW
The fan mode is set to Low.
@ CLIMATE_FAN_HIGH
The fan mode is set to High.
void update_property(T &property, const T &value, bool &flag)
Providing packet encoding functions for exchanging data with a remote host.
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)