diff options
-rw-r--r-- | control/zone.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index 0278de8..6efbe73 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -643,7 +643,17 @@ std::string Zone::current(std::string value) auto current = ThermalObject::current(); std::transform(value.begin(), value.end(), value.begin(), toupper); - if (value != current) + auto supported = ThermalObject::supported(); + auto isSupported = std::any_of( + supported.begin(), + supported.end(), + [&value](auto& s) + { + std::transform(s.begin(), s.end(), s.begin(), toupper); + return value == s; + }); + + if (value != current && isSupported) { current = ThermalObject::current(value); saveCurrentMode(); |