@@ -534,12 +534,12 @@ class MhiAcCtrl : public climate::Climate,
534534 }
535535 }
536536
537- if (call.get_custom_fan_mode (). has_value ()) {
538- auto fan_mode = * call.get_custom_fan_mode ();
539- if (fan_mode == custom_fan_ultra_low ) {
537+ if (call.has_custom_fan_mode ()) {
538+ const char * fan_mode = call.get_custom_fan_mode ();
539+ if (std::strcmp ( fan_mode, custom_fan_ultra_low) == 0 ) {
540540 mhi_ac::spi_state.fan_set (mhi_ac::ACFan::speed_1);
541541 } else {
542- ESP_LOGW (TAG, " Unsupported custom fan mode: %s" , fan_mode. c_str () );
542+ ESP_LOGW (TAG, " Unsupported custom fan mode: %s" , fan_mode);
543543 }
544544 } else if (call.get_fan_mode ().has_value ()) {
545545 auto fan_mode = *call.get_fan_mode ();
@@ -566,15 +566,14 @@ class MhiAcCtrl : public climate::Climate,
566566 climate::ClimateTraits traits () override
567567 {
568568 auto traits = climate::ClimateTraits ();
569- traits.set_supports_current_temperature ( true );
569+ traits.add_feature_flags (ClimateFeature::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE );
570570 traits.set_supported_modes ({ CLIMATE_MODE_OFF, CLIMATE_MODE_HEAT_COOL, CLIMATE_MODE_COOL, CLIMATE_MODE_HEAT, CLIMATE_MODE_DRY, CLIMATE_MODE_FAN_ONLY });
571- traits.set_supports_action (true );
572- traits.set_supports_two_point_target_temperature (false );
571+ traits.add_feature_flags (ClimateFeature::CLIMATE_SUPPORTS_ACTION);
573572 traits.set_visual_min_temperature (this ->minimum_temperature_ );
574573 traits.set_visual_max_temperature (this ->maximum_temperature_ );
575574 traits.set_visual_temperature_step (this ->temperature_step_ );
576575 traits.set_visual_current_temperature_step (0.25 );
577- traits.add_supported_custom_fan_mode ( custom_fan_ultra_low);
576+ traits.set_supported_custom_fan_modes ({ custom_fan_ultra_low } );
578577 traits.set_supported_fan_modes ({ CLIMATE_FAN_LOW, CLIMATE_FAN_MEDIUM, CLIMATE_FAN_HIGH, CLIMATE_FAN_AUTO });
579578 // traits.set_supported_swing_modes({ CLIMATE_SWING_VERTICAL });
580579 return traits;
@@ -588,7 +587,7 @@ class MhiAcCtrl : public climate::Climate,
588587 // But not all: https://github.com/hberntsen/mhi-ac-ctrl-esp32-c3/issues/14#issue-2828862442, so you an override it
589588 // if needed in the esphome yaml
590589 const float temperature_step_ { 1 .0f };
591- const std::string custom_fan_ultra_low = std::string( " Ultra Low" ) ;
590+ const char * custom_fan_ultra_low = " Ultra Low" ;
592591
593592 SUB_SENSOR (climate_current_temperature)
594593
0 commit comments