Turn on lights with Motion and also send SMS not working anymore


#1

1) Give a description of the problem
I’ve had a simple but not very elegant motion triggers lights when in night mode, and also send me a SMS working for a while. Basically I used my door bell motion sensor. I expect one motion event each night from the paper delivery, so if I only get one message each night around 4-4:30, then it was a normal night, and I don’t waste my time looking at the video. If I have other events, I’ll go check them out at my convenience. Anyway, as I’ve gotten a little smarter using web core, I thought I’d fix a couple of the things that were mildly annoying about my solution. But now it does not work at all, and I’m having trouble understanding why.

2) What is the expected behavior?
With Motion in night mode, I want my two indoor kitchen lights to turn on to 100% and stay on for 3 minutes. I also wanted to capture the level of the lights before they turned on and then set them back to that level after they turn off. Lastly I wanted to have a counter for the number of motion events and send me a summary SMS in the morning telling me how many motion events there were.

3) What is happening/not happening?
The lights are not turning on and the SMS is not being sent, but I can see the count down timer for the piston to reset counting down, so that part is running, but odd there was no SMS, even if the variable was 0.

4) Post a Green Snapshot of the pistonimage


#2

Your notification will only send at 08:30 only if your house location mode is still in “Night” or “Late night”

How long does your doorbell motion sensor stay active for? Is it long enough for the first “if” conditions to be fulfilled before it goes inactive and then starts the “else” conditions. ?
Can you please remove the top restriction
Then Test this piston and turn on “trace” and then do another green screen shot. After you have tested it.


#3

Thanks so much, that was one of the things I changed and did not even thing about that. For the screen shot I also changed the Motion sensor from IS Active to Changes to Active.

Here is a copy of the logs
+4ms ╔Received event [Beach House].test = 1507555709817 with a delay of 11ms
+165ms ║RunTime Analysis CS > 32ms > PS > 52ms > PE > 86ms > CE
+186ms ║Runtime (40134 bytes) successfully initialized in 52ms (v0.2.0ec.20170927) (179ms)
+190ms ║╔Execution stage started
+267ms ║║Condition #8 evaluated false (40ms)
+269ms ║║Condition group #1 evaluated false (state did not change) (45ms)
+280ms ║║Cancelling statement #2’s schedules…
+304ms ║║Executed virtual command [Kitchen Counter Light, Kitchen Island Light].wait (4ms)
+308ms ║║Requesting a wake up for Mon, Oct 9 2017 @ 9:31:30 AM EDT (in 180.0s)
+336ms ║╚Execution stage complete. (149ms)
+350ms ║Setting up scheduled job for Mon, Oct 9 2017 @ 9:31:30 AM EDT (in 179.966s), with 1 more job pending
+377ms ╚Event processed successfully (380ms)


#4

You are still going to need the restrictions or it will do the lights thing every time there is motion.

You just don’t want it at the very beginning before the “If” or it will only run the piston when the location is true.
Try something along these lines instead.


#5

“Changes to active” is only a very quick thing.
Once “changes to” has happened it will go straight to the “else” action.

Best to select “never cancel” for the actions so it will perform them all regardless of how quick the motion was.

Or try importing the piston I just did for you. :grinning:


#6

Understood, just took the totally out for the screen capture. Since I had not been able to get it to run (because of my restriction, haha) I was not able to verify that my other logic worked. Can you tell me if it looks like it will work. For setting the light levels, and also the counter? I have not done those before. Also if there is a smarter or better way to do what I was looking to do


#7

Depending on the method of control/Light/dth. Some turn them selves on automatically if they receive a “set level” command. So you may not need the “turn on” / “turn off” commands in there.


#8

Good call, I just checked and sure enough the level does turn the light on.


#9

Here’s a slightly cleaner version.

I added a Boolean so the piston will not run more than once during its cycle which will stop your light level variables getting all messed up.


#10

Thank you so much. Much cleaner. I did have to add a Turn off command for each light, but otherwise, it worked flawlessly. I also Added a little logic to the alerts, so that I did not get a text if there were no motion activities, and even set it up so the SMS report will come later on the weekends. Here it is for future reference. The only thing that might not be needed is the 1 minute pause between sending the SMS and resetting the count. I just wanted to make sure the variable did not get reset before the SMS went out.


#11

Please don’t forget to mark the solution so others can find with ease :grinning: Thank You


#12

I had some weird behavior yesterday with this piston. I ended up pausing it and coming back to it today. So two weird and unexpected things.

  1. It was running and the mode was definitely not Night.
  2. The lights would come on for a few seconds and the turn back off.
  3. Also if I turned them on myself using smartthings, they would turn right back off.

Any suggestions as to why


#13

that current piston would still run when the location is not what it should be it just shouldn’t execute any actions. But it does look like it could be better with the restriction else where.

I’ve modified it slightly for you, see if this helps.

Regards the light going on then off. Are you sure it was this piston causing that to happen? The only way I could see that happening from this piston is if the variable InProgress was incorrect and there was motion at the doorbell at the time? Maybe I’m wrong but it doesn’t look like it could cause the lights to go off as soon as you turn them on from st.

I’ve changed this one slightly because I think the problem you were having was the 3 minute wait was probably not in the most optimal position especially if the motion timed out during the countdown then it would not have finished off the remainder of the piston causing the InProgress variable to not reset and the lights to not correct them selves.

I’m no expert but I think this one should work better.

If anyone else can see why he is having the problems please whey in. :grinning:


#14

I’ll test again this evening. But to me it was as if when motion stopped being detected, the lights would turn off. I’m about 90% sure it was this piston. But, I agree, it does not seem like that should have happened. I did turn the lights on manually, and then they turned off which is what caused me to even notice the piston was acting up. Then I triggered the piston by creating motion, and it went on and quickly off, but again, maybe it was a combination of me turning them on, or maybe the value was wrong. Thanks for the help