From b7ddd1daa2f88c6bed7a4085788e09014852a47d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Oct 2026 08:03:20 -0500 Subject: [PATCH] [climate] Cover custom mode reads and runtime sets in the component test (#20208) --- tests/components/template/common-base.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/components/template/common-base.yaml b/tests/components/template/common-base.yaml index ccef9ded05..f87a4e0320 100644 --- a/tests/components/template/common-base.yaml +++ b/tests/components/template/common-base.yaml @@ -275,6 +275,28 @@ button: name: "Template Button" on_press: - logger.log: Button Pressed + - platform: template + name: "Climate Custom Modes Lambdas" + on_press: + - lambda: |- + // How external components and configs read and set climate custom modes + auto traits = id(template_climate_custom_modes).get_traits(); + const auto &fan_modes = traits.get_supported_custom_fan_modes(); + for (const auto *mode : fan_modes) + ESP_LOGD("test", "%s", mode); + for (const auto &preset : traits.get_supported_custom_presets()) + ESP_LOGD("test", "%s", preset); + for (const char *mode : traits.get_supported_custom_fan_modes()) + ESP_LOGD("test", "%s", mode); + std::vector presets{"eco_plus", "max"}; + id(template_climate_custom_modes).set_supported_custom_presets(presets); + id(template_climate_custom_modes).set_supported_custom_presets({"eco_plus"}); + id(template_climate_custom_modes).set_supported_custom_fan_modes({}); + std::vector new_fan_modes{"turbo", "silent"}; + id(template_climate_custom_modes).set_supported_custom_fan_modes(new_fan_modes); + static const char *const MODES[] = {"turbo", "silent"}; + id(template_climate_custom_modes).set_supported_custom_fan_modes(MODES); + id(template_climate_custom_modes).set_supported_custom_presets(MODES); cover: - platform: template