diff --git a/components/samsung_ac/__init__.py b/components/samsung_ac/__init__.py index 0affde4f..8e553182 100644 --- a/components/samsung_ac/__init__.py +++ b/components/samsung_ac/__init__.py @@ -85,6 +85,7 @@ CONF_CAPABILITIES = "capabilities" CONF_CAPABILITIES_HORIZONTAL_SWING = "horizontal_swing" CONF_CAPABILITIES_VERTICAL_SWING = "vertical_swing" +CONF_CAPABILITIES_TURBO_MODE = "turbo_mode" CONF_PRESETS = "presets" CONF_PRESET_NAME = "name" @@ -121,6 +122,7 @@ def preset_entry(name: str, value: int, displayName: str): { cv.Optional(CONF_CAPABILITIES_HORIZONTAL_SWING, default=False): cv.boolean, cv.Optional(CONF_CAPABILITIES_VERTICAL_SWING, default=False): cv.boolean, + cv.Optional(CONF_CAPABILITIES_TURBO_MODE, default=False): cv.boolean, cv.Optional(CONF_PRESETS): cv.Schema( dict( [ @@ -370,6 +372,13 @@ async def to_code(config): ) ) + if CONF_CAPABILITIES_TURBO_MODE in capabilities: + cg.add( + var_dev.set_supports_turbo_mode( + capabilities[CONF_CAPABILITIES_TURBO_MODE] + ) + ) + none_added = False presets = capabilities.get(CONF_PRESETS, {}) diff --git a/components/samsung_ac/samsung_ac_device.cpp b/components/samsung_ac/samsung_ac_device.cpp index 99b713f4..20aed85b 100644 --- a/components/samsung_ac/samsung_ac_device.cpp +++ b/components/samsung_ac/samsung_ac_device.cpp @@ -46,9 +46,13 @@ namespace esphome traits.set_supported_fan_modes(fan); - std::set customFan; - customFan.insert("Turbo"); - traits.set_supported_custom_fan_modes(customFan); + bool t = device->supports_turbo_mode(); + if (t) + { + std::set customFan; + customFan.insert("Turbo"); + traits.set_supported_custom_fan_modes(customFan); + } auto supported = device->get_supported_alt_modes(); if (!supported->empty()) diff --git a/components/samsung_ac/samsung_ac_device.h b/components/samsung_ac/samsung_ac_device.h index eec979cf..a3988e8c 100644 --- a/components/samsung_ac/samsung_ac_device.h +++ b/components/samsung_ac/samsung_ac_device.h @@ -459,6 +459,11 @@ namespace esphome return supports_vertical_swing_; } + bool supports_turbo_mode() + { + return supports_turbo_mode_; + } + void set_supports_horizontal_swing(bool value) { supports_horizontal_swing_ = value; @@ -469,6 +474,11 @@ namespace esphome supports_vertical_swing_ = value; } + void set_supports_turbo_mode(bool value) + { + supports_turbo_mode_ = value; + } + void add_alt_mode(const AltModeName &name, AltMode value) { AltModeDesc desc; @@ -498,6 +508,7 @@ namespace esphome protected: bool supports_horizontal_swing_{false}; bool supports_vertical_swing_{false}; + bool supports_turbo_mode_{false}; std::vector alt_modes; Protocol *protocol{nullptr}; diff --git a/example.yaml b/example.yaml index a6945d03..24aac3b1 100644 --- a/example.yaml +++ b/example.yaml @@ -68,6 +68,7 @@ samsung_ac: capabilities: vertical_swing: true horizontal_swing: true + turbo_mode: true # Presets define special AC modes like Windfree, Eco, and so on. # The following modes are available: sleep, quiet, fast, longreach, windfree, eco. presets: