Light will not turn off


#1

1) Give a description of the problem
Just trying to turn off light 30 seconds after being turned on by moton
It a realy simple piston I dont understand y the light goes on but will not go off

2) What is the expected behavior?
(PUT YOUR INFO HERE)

3) What is happening/not happening?
(PUT YOUR INFO HERE)

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Try changing it from “is active” to “changes to” active.


#3

Nope didnt make a difference. The light turns on but will not turn off after the 30 seconds
Thanks


#4

I would try this:

IF Time is NOT between 7AM and 12PM
and
Motion changes to active
then with Light
    do Turn On
END WITH
END IF

IF Motion remains inactive for 30 seconds
then with Light
    do Turn Off
END WITH
END IF

(Notice the negative approach towards the time since your original code spanned midnight)


#5

Just curious… what is your motion sensor? For example, turning lights on/off sets off the motion sensor on a ring doorbell.


#6

You sure your motion sensor has changed to inactive? Some motion sensor change in a few seconds, from active to inactive. Others can be minutes.

If it changes active and is still active it may keep restarting the 30 second timer until the motion sensor actually reports back inactive.

I may be wrong, I’ve been in the sun all day, laying pavers :sunglasses:


#7

It does on a zoom 4 in 1 sensor too


#8

Hmmm interesting, never tried that approach. Nice work


#9

Thanks WCmore
I tried your suggestion it works
I just wanted to turn a light on for 5 min when motion sensor was active (using 30 seconds to test) Maybe my original would have worked set to 5 min
I have a Zoom 4 in 1
In the Smartthings app it will go from active to inactive in seconds


#10

I have a question not about webcore but about the Zoom motion sensor. I used WCmore suggestion only I elected to just turn off light if sensor was inactive. I noticed that even though I kept walking around in front of the sensor it would still go inactive before going active again. Is that a bug in firmware. Should the sensor not stay active as long as there is motion in front of it
Thanks


#11

I have never used the Zoom motion sensor before, but generally each company (device) has a different time out period. I have seen it as short as 3 seconds, and as long as 3 minutes. From your last post, it sounds like your sensor has a very short time out period. In other words, if the timeout is really short, it may be hard coded to only accept active commands when the device is inactive (and visa versa). Using the code I suggested (with at least a short wait period) should resolve that.

Maybe this will help you visualize:
Your original code will keep the piston in a limbo state during the waiting period, and the piston I suggested will only run AFTER the waiting period has expired. Which means, each time you walk in front of it, the countdown timer is reset.


#12

Ok thanks every thing is good with that light
I have another problem with my garage door
If the garage door sensor is not closed then turn on the garage door switch
It will not work. If I substitute the garage door switch for another light switch then it works
The garage door switch is a momentary switch does that have something to do with it
p.s. i have noticed that if I change sunset to a time and let it run it works ok


#13

It is probably a good thing that that code did not run. The way it is currently worded, there would be the possibility of the piston running 14 million times a day!

I would shoot for something like:

IF
    Garage Door Sensor's contact is OPENED
    and
    Time is after $sunset
THEN
    WITH Garage Door = Turn On
    WITH Kitchen sink Light = Turn ON
END IF

This will only send commands late in the day whenever the contact is opened


#14

I dont get it thats basicly what i have. Run after sunset and if the contacts are not closed.


#15

Hmmm, how can I describe this… Your original code is too ambiguous… The way it is written:

"If Contact is Not Closed" means the statement could be true 1000 times a second.
"If Contact is Opened" only happens ONCE per door open.
(Most home networks can not handle 1000 commands per second)

Also note I changed the kitchen from “Toggle” to “Turn On”.
Otherwise, it may unintentionally turn OFF your light.


#16

ST and hence wC is a event driven architecture. so any piston that evaluates a device attribute only does so when an event is generated from that device and that only happens when that device attribute changes. in this case that would mean the door is either opened or closed.

so the number of times the piston would run because of that if statement is once every time the door is opened or closed.


#17

OK so if I have the statement after sunset as the first line then the piston will only read that line and go no further until it is true then it will read the second line if the contact is open then if this is true then go on and execute the rest of the piston
If that is true then
it should read the first line after sunset then when this statement is true
it should go to the second statement if sensor is not closed if this is true then execute the rest of the piston
(I did change it Ill see if it works tonight)
I left the Kitchen light to toggle because when i see the light flash (either on then off or off then on)I will know the garage door is closing or at least the piston is executing


#18

Hey @bangali, are you saying that:
"If Contact is Not Closed"
is the same as:
"If Contact Changes"
???

I have never experienced this


#19

the conditions are off course not the same. but the number of times each of those statement will be evaluated is exactly the same. they will be evaluated once for every time the contact attribute changes from open to close or close to open.


#20

Learn something new every day…
Thanks for clarifying!!