Does runin complete even if mode changes and app not set to run in that mode?

@slagle and @jody.albritton - support suggested I contact you two about my question:

… if I have a smart app that only runs inside certain modes (let’s call them home and sunset). If a runin command is sent to turn lights off in 1 hour while in home mode, then mode changes to sleeping (and the app is not set to run in sleeping mode) will the lights still turn off when the runin timer hits 1 hour even though the app is only set to run in home mode?

Also, what happens to the states (eg state = lightison set as true). Do they sit with the app only and die when a new mode is set for which the app isn’t schedule to run?

I ask because I have created an app which I run in different modes to adjust the brightness of my dimmers.

Many thanks in advance.

1 Like

I changed category to developers writing smartapps.

Unfortunately my thoughts on what happens are would be pure guesses so i’ll leave it up to one of these guys to answer.

Depends, are you using the built in mode restriction or building your own mode restriction into the app with dynamic pages?

1 Like

@slagle … using the built in mode restriction. I have multiple instances of the app automating for different modes (e.g., so dimmer intensity is different during the day as opposed to night).

Then no :frowning:

You could build your own mode restriction by changing your app to dynamic pages and then you could build some logic into the mode restriction to allow runIns to run.

1 Like

@slagle thanks. Might be able to workaround this a different way.

When the mode changes, do the apps all set to the new mode all initialize? Respond to modechange?

You can subscribe to a mode change:

subscribe(location, "mode", eventHandler)

@slagle doing that. So if I’m using the built in mode restriction, the dormant app in the current mode (let’s call it home) if subscribed to the mode change will run as soon as the mode is activated where it is selected to run, correct?

If that’s the case I can engineer a workaround for my case.

yep :slight_smile:

@slagle thanks for your help!

1 Like