Lights on when Motion and then a mode change - they still turned off?

(Brian Smith) #1

I have a group of lights (under Lights and Switches) that is set to turn on when motion is detected when in away mode…and go off after X minutes. So, today something odd happened…

The cats were accidentally left out. Since they have not been assigned presence sensors (they would just lose them as they have no pockets), the house was in away mode. About a minute before I got home, they tripped the motion again and the lights came on. The house then executed a Hello Home action and set the house to Home when I arrived. After I was in the house for a few minutes, the lights that are set to go on when motion is detected while in away mode shut off.

Meaning, they ignored that the mode changed and was no longer away, so they shouldn’t execute their change to off after X minutes.


( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

I think we don’t have access to the source code for the Dashboard / “Solution” SmartApps, so how do we debug this?

I can imagine that it was just coded wrong: i.e., the check for Mode is donr before turning the lights on, but not done again before turning them off. Easy mistake.

My guess is the code looks something like this pseudo …

if ( motion && ( preference.mode = null || preference.mode == location.mode ) {
    if ( preference."minutes till off" != NULL ) {
        runIn( "minutes till off" * 60, )

i.e., At the time that the scheduled “” job runs, the programmer probably forgot to check if mode has changed.

(I’m just guessing that this is the bug / mistake) You can verify this behavior by testing a couple scenarios, of course.


If this was Wednesday, I had several plain vanilla hello home actions involving motion sensors give unexpected results, I think because of horrendous lag in the ST Cloud so some stuff timed out. It was just a flaky day today. (I speed tested my WiFi, it was fine, but the ST mobile app took several minutes to load, and actions were odd.)

I put in a support ticket, but based on community reports, it wasn’t just me.

(Brian Smith) #4

That programmer would be SmartThings, since this is the native functionality in the app for Lights on when Motion. :smile:

(Eric) #5

The problem is those damn cats.