Changes to Inactive Not Working if I Don't First Activate Motion


#1

1) Give a description of the problem
I would like aswitch to turn off if there is no motion for x minutes regardless of how that light switch is turned on. This works great in the most common example of me walking in the room, tripping motion sensor A, and the lights turn on. Then after motion sensor A changes to inactive, the lights turn off.

The problem arises if I never enter that room and activate motion sensor A. I have a motion sensor B in the hallway that turns on the kid bathroom light at night. If the kids never go into the bathroom, and decide to pester me at all hours of the night, motion sensor A never changes state and the lights remain on.

2) What is the expected behavior?
I want the switch to turn off if there is no motion for x minutes regardless of how the switch is turned on.

3) What is happening/not happening?
If I turn on the switch via another method, the status change to inactive never happens

**4) Post a Green Snapshot of the piston!

5) Attach any logs (From ST IDE and by turning logging level to Full)

No logs


#2

Make the elseif a separate IF.