Setting Moods or Events

Is there any way to set a mood or event, like lets say turn mode to Party, and by doing that the lights that need to be on turn on and sonos can be played in certain rooms.
Or Movie night where lights are dimmed.

1 Like

This is exactly how I expected Modes to work and it caused me a lot of trouble when I first got ST.

Because this isn’t how Modes work. You and I thought Modes can trigger actions. But no. Actions can change modes. All Modes do is allow, or NOT allow, certain kinds of events to cause actions.

So, for example, let’s say you create Kitchen Motion and Kitchen Intruder Sensor apps:

In Home Mode, your Kitchen Motion App can turn on the kitchen lights. Your Kitchen Intruder Sensor App does nothing.
In Away Mode, the Kitchen Motion App does nothing. The Kitchen Intruder Sensor App texts you, starts a siren, flashes the lights.

Modes limit actions. In the above example it goes like this:

Motion in the kitchen --> Kitchen Motion App wakes up --> KMA checks the current mode --> Sees it set to Home --> turns on lights
OR
Motion in the kitchen --> Kitchen Motion App wakes up --> KMA checks the current mode --> Sees it set to AWAY --> DOES NOTHING.

Kitchen Intruder Sensor would work the other way around.

@differentcomputers,

I don’t think your assumption how modes work is entirely correct. Modes can trigger actions as well as respond to actions. You can change mode manually in the mobile app and all apps that subscribe to the mode change event will respond accordingly. In a way, “modes” are similar to “scenes” in other systems. Can someone confirm this?

Yeah, modes can make things happen with a smartapp. See the “Scenes” app written by Ryan Nathanson.

/**
 *  Scenes
 *
 *  Author: Ryan Nathanson
 */

preferences {
	section("When I Change To This Mode") {
	input "newMode", "mode", title: "Mode?"       
    }
	section("Dim These Lights") {
	input "MultilevelSwitch", "capability.switchLevel", multiple: true, required: false
	}   
    section("How Bright?"){
     input "number", "number", title: "Percentage, 0-99", required: false
    }
	section("Turn On These Switches"){
	input "switcheson", "capability.switch", multiple: true, required: false
	}
	section("Turn Off These Switches"){
	input "switchesoff", "capability.switch", multiple: true, required: false
	}
}

def installed() {
subscribe(location)
subscribe(app)
}

def updated() {
unsubscribe()
subscribe(location)
subscribe(app)
}

def uninstalled() {
unsubscribe()
}

def changedLocationMode(evt) {
    switcheson?.on()
    switchesoff?.off()
    settings.MultilevelSwitch?.setLevel(number)
}

def appTouch(evt) {
    switcheson?.on()
    switchesoff?.off()
    settings.MultilevelSwitch?.setLevel(number)
}
1 Like

@igocontrol:

Modes can trigger actions as well as respond to actions. You can change mode manually in the mobile app and all apps that subscribe to the mode change event will respond accordingly.

How does a Mode respond to an action, aside from an action that sets a mode? Your second line is describing exactly what I said:“all apps that subscribe to the mode change event will respond accordingly.” is the same as my “modes limit actions.”

Oh wait. do you mean the CHANGE of modes? Yes, that’s something I need better understanding of–HOW does an app subscribe to a mode CHANGE?

It still seems to me that Modes are “meta-actions” that limit what actions can do when, or conversely that enable actions only in certain modes. That’s the positive & negative spin on the same thing.

Oh wait. do you mean the CHANGE of modes? Yes, that’s something I need better understanding of–HOW does an app subscribe to a mode CHANGE?

I believe it is via
subscribe(location)

Checkout the smartapp above that I posted. Its also available in the shared smartapps in the IDE.

I have modes Home and Away set automatically by WiFi devices connected to my router. With the mode change, the “Scenes” app will turn on lights.