Well that’s how it works. A user sets a particular mode, and then my app adjusts the temperature settings based on the modes selected. The only thing is, I would like to be able to create an enum or a collection of some sort that I can add all available modes to and then subtract them after they are selected for an app setting – and have them be recognized as modes when they are used.
You can get the idea from this example although this example doesn’t work:
input “modes1”, title: “Modes”, type: “enum”, options: availableModes(), multiple: true
input “modes2”, title: “Modes”, type: “enum”, options: availableModes(), multiple: true
def availableModes()
{
def avaliableModesEnum = [ ]
location.modes.each {avaliableModesEnum << “$it”}
if (modes1) {
avaliableModesEnum = avaliableModesEnum.minus(modes1)
}
if (modes2) {
avaliableModesEnum = avaliableModesEnum.minus(modes2)
}
log.debug "availableModes(): avaliableModesEnum: ${avaliableModesEnum}"
return(avaliableModesEnum)
}
Here is the link to the thread containing my app, if that helps:
Thermostat Manager
Thermostat Manager is a SmartThings SmartApp that provides automated control over smart thermostats.
You can set temperature thresholds that define what mode you would like your thermostat to be in (heat/cool/etc.) for a specified temperature range. You use Energy Saver features to have your thermostat turn off temporarily if a contact sensor (such as a door or a window) stays open too long. Mode Based Temperature Enforcement allows you to set a specified temperature based on a SmartThings mode change (such as home or away mode). Emergency Heat Settings allow you to set emergency heat mode based on the temperature reading of an outdoor temperature sensor. You can also configure Notification Settings to give you a push notification or a text message when Thermostat Mana…
And GitHub:
/*
* Thermostat Manager
* Build 2021061601
*
* Copyright 2021 Jordan Markwell
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
* may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* ChangeLog:
*
* 20210616
* 01: Modifying conditions on the verifyAndEnforce() function's mode enforcement operations in order to allow for proper
* enforcement when exiting the Energy Saver pause state.
This file has been truncated. show original
But you really don’t need to go into that much detail. I just want to create a collection of modes from which each mode can only be selected once.