Use routines to automatically change the mode value
You use one routine to set the mode based on whatever conditions you want to use.
Then you use a different routine which runs based on which mode is currently set.
So now you have two routines. Once those are both created, the second routine will run automatically when the mode changes to the one which activates it.
Back to my original example.
I have one routine which changes the mode to “night” based on the time being 30 minutes before sunset.
I have a second completely separate routine which says if the mode is “night” and the bedroom motion sensor is triggered, then turn on the overhead light.
Two separate routines.
So, it’s a new day. We had the time of 30 minutes before sunset. This fires routine which does nothing but change the mode to “night.”
So far, that’s all that happens.
Say at 10:14 I walk into my bedroom. This causes the motion sensor to register activity. Now routine B fires because it’s conditions are met: the mode is light and the motion sensor detected activity. The ceiling light comes on.
Now I add a third, totally separate routine. This one does nothing except change the mode to “asleep.”
Another day goes by. At sunset -30 minutes, routine a fires. The mode gets changed to “night.”
Some time goes by, at 8 PM, I walk into my bedroom and the motion sensor detects activity. Routine B fires because the mode is night and the motion sensor detected activity. The ceiling light comes on. All good.
I go back in the living room, I watch TV for a while. At midnight, I go back in the bedroom. Routine B fires again because all its conditions are met. The ceiling light comes on.
I get into bed and I manually run routine C. That changes the mode to “asleep.” So 20 minutes later when my dog leaves the bedroom and goes in the kitchen to drink some water, even though the motion sensor detects activity, routine B does not run because the mode is not “night” anymore. The mode is still “asleep” which means the conditions for routine B are not met. So the ceiling light doesn’t come on just because the dog goes in and out of the room after I’ve gone to bed.
If you were asking specifically about the mode value “away”. most people set that using a presence sensor. You can do it just with Geo location from your phone, or you can get a separate physical device to do it. If that’s what you’re asking there’s a whole bunch of forum topics on that specific use case
From a programming standpoint: value vs variable
See if this helps. There is really only one mode variable for the system. All of the things that we name as “modes” are just the values that that variable can take. So the mode variable is either set to “house” or set to “away” or set to “night” or in my case set to “asleep” which is a value that I have added to the list of possible mode values.
The mode variable stay set at the current value until something changes it to a different value from the list
When you set the variable to a particular mode value, it keeps that mode value until you change it to something else. So if it’s “home” it stays "home"until something changes it to away or night or whatever.
One of the ways in which the platform has been broken for the last week is that mode values have been randomly changing all on their own in some cases even to values that don’t belong to that account. That’s a database corruption issue.
But when everything is working the way it’s supposed to, there is one mode variable for your account. It gets set to one of the values on your list of modes. (New accounts start with it set to “home.”) it stays set to that value until a routine or SmartApp changes it to a different value from your list.
Using the mode to trigger actions
Changing the mode value doesn’t do anything in and of itself. However, you can set up routines or smart apps with conditionals so that they will be triggered when the mode variable is changed to a specific value.
So the mode variable is a conditional that can be used to trigger routines and smartapps.
Routines and smart apps can also change the value that the mode variable is set to. And that change can then trigger other routines and smart apps which are triggered by the new value.
It’s common in the forums to say you can only have one mode set at a time. But really what we’re saying is that the mode variable can only have one value at a time.
I think when you’re saying “configure the mode” what you mean is “change the value of the mode variable.” If that’s what you’re asking, you change it in a routine using the field that is there for that purpose which is labeled “change the mode” or using a similar field in one of the various smart apps like real machine.
And the reason why we keep saying you can’t “configure a mode” is because we are talking about the mode Values which are basically just names on a list. You can change the name but that’s it. You could change “asleep” to “sleeping” or “do not disturb” but that’s the only change you could make to a mode. Because the mode is just a value which is added to the list of values available to the mode variable.
And as I write that sentence I realize that this is yet another place where SmartThings has used the same word for two different things. Because the label does say “change the mode” when it really means “change the mode variable to a new value” and it also says “add a new mode” when it really means “add a new value To the list used by the mode variable.” That is, the SmartThings documentation does not distinguish between the values that the mode variable can take and the mode variable itself. Trust me, this is not the only time you will find this issue with SmartThings terminology.
So I think you’ve just looked one level deeper into things, as many programmers will, and then you’ve been tripped up by the fact that the word “mode” is used to describe both the mode variable and the values it can take.
Did that help any? Or did I just confuse things further?