13 static void set_sensor(Sensor *
sensor,
float value) {
14 if (sensor !=
nullptr && (!sensor->has_state() || sensor->get_raw_state() != value))
15 sensor->publish_state(value);
18 template<
typename T>
void update_property(T &property,
const T &value,
bool &flag) {
19 if (property != value) {
26 bool need_publish =
false;
57 dudanov::midea::ac::Control ctrl{};
74 this->
base_.control(ctrl);
93 if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_OK)
109 #ifdef USE_REMOTE_TRANSMITTER 112 if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_OK) {
113 this->
base_.getCapabilities().dump();
114 }
else if (this->
base_.getAutoconfStatus() == dudanov::midea::AUTOCONF_ERROR) {
116 "Failed to get 0xB5 capabilities report. Suggest to disable it in config and manually set your " 117 "appliance options.");
125 #ifdef USE_REMOTE_TRANSMITTER 127 if (!std::isfinite(temperature)) {
128 ESP_LOGW(
Constants::TAG,
"Follow me action requires a finite temperature, got: %f", temperature);
134 static_cast<uint8_t
>(std::max(0L, std::min(static_cast<long>(UINT8_MAX), std::lroundf(temperature))));
136 ESP_LOGD(
Constants::TAG,
"Follow me action called with temperature: %f °C, rounded to: %u °C", temperature,
143 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
148 #ifdef USE_REMOTE_TRANSMITTER 152 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
157 if (this->
base_.getCapabilities().supportLightControl()) {
158 this->
base_.displayToggle();
160 #ifdef USE_REMOTE_TRANSMITTER 164 ESP_LOGW(
Constants::TAG,
"Action needs remote_transmitter component");
173 #endif // USE_ARDUINO This class is used to encode all control actions on a climate device.
value_type const & value() const
ClimateSwingMode swing_mode
The active swing mode of the climate device.
static ClimateFanMode to_climate_fan_mode(MideaFanMode fan_mode)
static const char *const TAG
void set_supported_custom_presets(std::set< std::string > supported_custom_presets)
void set_visual_temperature_step(float temperature_step)
void on_status_change() override
std::set< std::string > supported_custom_presets_
const std::set< ClimateSwingMode > & get_supported_swing_modes() const
float target_temperature
The target temperature of the climate device.
static const std::string & to_custom_climate_fan_mode(MideaFanMode fan_mode)
dudanov::midea::ac::AirConditioner base_
const optional< ClimateMode > & get_mode() const
This class contains all static data for climate devices.
static bool is_custom_midea_fan_mode(MideaFanMode fan_mode)
void set_visual_min_temperature(float visual_min_temperature)
void do_follow_me(float temperature, bool beeper=false)
ClimateMode mode
The active mode of the climate device.
static void to_climate_traits(ClimateTraits &traits, const dudanov::midea::ac::Capabilities &capabilities)
float current_temperature
The current temperature of the climate device, as reported from the integration.
void set_supported_presets(std::set< ClimatePreset > presets)
std::set< ClimateSwingMode > supported_swing_modes_
void add_supported_preset(ClimatePreset preset)
static MideaPreset to_midea_preset(ClimatePreset preset)
std::set< ClimatePreset > supported_presets_
void add_supported_swing_mode(ClimateSwingMode mode)
void transmit(IrData &data)
const optional< std::string > & get_custom_preset() const
const optional< ClimatePreset > & get_preset() const
optional< ClimatePreset > preset
The active preset of the climate device.
static const std::string & to_custom_climate_preset(MideaPreset preset)
const std::set< ClimateMode > & get_supported_modes() const
const std::set< climate::ClimatePreset > & get_supported_presets() const
void set_supported_modes(std::set< ClimateMode > modes)
void control(const ClimateCall &call) override
std::set< std::string > supported_custom_fan_modes_
static bool is_custom_midea_preset(MideaPreset preset)
void set_visual_max_temperature(float visual_max_temperature)
const optional< std::string > & get_custom_fan_mode() const
void add_supported_fan_mode(ClimateFanMode mode)
const optional< float > & get_target_temperature() const
void publish_state()
Publish the state of the climate device, to be called from integrations.
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.
static ClimatePreset to_climate_preset(MideaPreset preset)
static ClimateSwingMode to_climate_swing_mode(MideaSwingMode mode)
std::set< ClimateMode > supported_modes_
static MideaSwingMode to_midea_swing_mode(ClimateSwingMode mode)
optional< ClimateFanMode > fan_mode
The active fan mode of the climate device.
const optional< ClimateFanMode > & get_fan_mode() const
bool set_custom_preset_(const std::string &preset)
Set custom preset. Reset primary preset. Return true if preset has been changed.
ClimateTraits traits() override
void update_property(T &property, const T &value, bool &flag)
static MideaMode to_midea_mode(ClimateMode mode)
const optional< ClimateSwingMode > & get_swing_mode() const
void dump_config() override
Implementation of SPI Controller mode.
void set_supported_swing_modes(std::set< ClimateSwingMode > modes)
void dump_traits_(const char *tag)
static ClimateMode to_climate_mode(MideaMode mode)
void set_supports_current_temperature(bool supports_current_temperature)
void set_supported_custom_fan_modes(std::set< std::string > supported_custom_fan_modes)
bool set_preset_(ClimatePreset preset)
Set preset. Reset custom preset. Return true if preset has been changed.
void add_supported_mode(ClimateMode mode)
esphome::sensor::Sensor * sensor
bool set_fan_mode_(ClimateFanMode mode)
Set fan mode. Reset custom fan mode. Return true if fan mode has been changed.
Sensor * humidity_sensor_
IrTransmitter transmitter_
static MideaFanMode to_midea_fan_mode(ClimateFanMode fan_mode)