SHM - Arm/Disarm based on presence and set times

shm
camera

#21

@allrak How could I add to this to have the SHM disarmed for 10 minutes of motion is detected… Say in the bedroom? I would like to turn the SHM off if we get up to let the dog out in the middle of the night.


#22

That’s a good question… I’m sure there’s a way to design it in the piston. I use Action Tiles and have a virtual switch to disarm everything. I tend to just use that for middle of the night scenarios.


#23

Gotcha I couldn’t decide if adding to this or making aseparate piston to pause this one would be best. Was hoping you already had something similar in your back pocket.


#24

@allrak I’m trying to use your occupancy and smh pistons above. What’s happening is that when one person leaves, it is turning on my cameras even though there are other people at home. What have I done wrong?



I have the dynamic variable @occupancy set to 0. Correct?


#25

What is @Occupancy showing when everything gets armed? At first glance, I’m not seeing anything wrong.


#26

By the way, I did modify my original just a bit. Here’s an updated snapshot of the piston. Not many changes, but you’ll notably see one at the beginning (@Occupancy stays equal to 0 for 30 seconds). The “arm cams” section is greyed out as I’m handling that by calling another piston (but that should have no bearing on your original problem.


#27

Currently @occupancy is showing 0 - which no one is home. I’ll try to remember to check it this evening when home.


#28

If you’re using the webcore presence sensor, you can force it to present or not present in the settings. This can help when you’re troubleshooting to see if @Occupancy is doing what its supposed to do.


#29

I’m getting closer to solving my problem - well, at least I’ve found out what’s happening. When I am present, it changes the Occupancy piston to 1. But when I leave (using webcore presence), it stays at 1. What am I missing to make this work right?


#30

Have you tried testing the arrival & departure by manually setting your webcore presence to present/not-present?
I would try using the smartthings app (you can force present/not-present in ST app -> things -> your presence sensor -> settings).
I would do this to see if @Occupancy is actually changing as expected.


#31

Yes, I am changing it by manually changing WC presence. If I make myself present, it changes the Occupancy piston to 1. But when I make myself not present (using WC presence), the Occupancy piston still shows 1. It’s like it gets stuck in presence (1).
Funny thing to add - my neighbor sent me a text asking if I knew my garage was going up and down with no one home! LOL


#32

Can you post a copy of the logs when you manually force it to ‘not present’ ?


#33

Below are several present/not present. The Piston state: occupancy is 0 never changed under quick facts.
9/26/2018, 11:51:02 AM +663ms
+0ms ╔Received event [Webcore - TLS].presence = not present with a delay of 79ms
+174ms ║RunTime Analysis CS > 13ms > PS > 117ms > PE > 44ms > CE
+177ms ║Runtime (42129 bytes) successfully initialized in 117ms (v0.3.107.20180806) (175ms)
+178ms ║╔Execution stage started
+192ms ║║Comparison (enum) not present changes = true (1ms)
+194ms ║║Condition #82 evaluated true (10ms)
+195ms ║║Condition group #81 evaluated true (state did not change) (12ms)
+199ms ║║Cancelling statement #61’s schedules…
+215ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+230ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+244ms ║║Calculating (string) Since + (string) 9/26 11:51 AM >> (string) Since 9/26 11:51 AM
+258ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+265ms ║║Executed virtual command setTile (2ms)
+279ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+293ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+298ms ║║Calculating (integer) 0 + (integer) 0 >> (integer) 0
+302ms ║║Executed virtual command setVariable (1ms)
+307ms ║║Cancelling statement #83’s schedules…
+314ms ║║Calculating (string) occupancy is + (string) 0 >> (string) occupancy is 0
+318ms ║║Executed virtual command setState (0ms)
+320ms ║╚Execution stage complete. (143ms)
+322ms ╚Event processed successfully (323ms)
9/26/2018, 11:49:51 AM +545ms
+2ms ╔Received event [Webcore - TLS].presence = present with a delay of 113ms
+229ms ║RunTime Analysis CS > 19ms > PS > 160ms > PE > 50ms > CE
+232ms ║Runtime (42123 bytes) successfully initialized in 160ms (v0.3.107.20180806) (229ms)
+233ms ║╔Execution stage started
+248ms ║║Comparison (enum) present changes = true (1ms)
+250ms ║║Condition #82 evaluated true (10ms)
+252ms ║║Condition group #81 evaluated true (state did not change) (12ms)
+255ms ║║Cancelling statement #61’s schedules…
+270ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+285ms ║║Calculating (enum) present == (enum) present >> (boolean) true
+298ms ║║Calculating (string) Since + (string) 9/26 11:49 AM >> (string) Since 9/26 11:49 AM
+311ms ║║Calculating (enum) present == (enum) present >> (boolean) true
+318ms ║║Executed virtual command setTile (1ms)
+332ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+346ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+351ms ║║Calculating (integer) 0 + (integer) 0 >> (integer) 0
+355ms ║║Executed virtual command setVariable (1ms)
+360ms ║║Cancelling statement #83’s schedules…
+367ms ║║Calculating (string) occupancy is + (string) 0 >> (string) occupancy is 0
+371ms ║║Executed virtual command setState (0ms)
+373ms ║╚Execution stage complete. (140ms)
+375ms ╚Event processed successfully (375ms)
9/26/2018, 11:48:02 AM +772ms
+1ms ╔Received event [Webcore - TLS].presence = not present with a delay of 68ms
+164ms ║RunTime Analysis CS > 13ms > PS > 108ms > PE > 43ms > CE
+166ms ║Runtime (42129 bytes) successfully initialized in 108ms (v0.3.107.20180806) (165ms)
+167ms ║╔Execution stage started
+181ms ║║Comparison (enum) not present changes = true (1ms)
+183ms ║║Condition #82 evaluated true (9ms)
+185ms ║║Condition group #81 evaluated true (state did not change) (11ms)
+188ms ║║Cancelling statement #61’s schedules…
+202ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+216ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+228ms ║║Calculating (string) Since + (string) 9/26 11:48 AM >> (string) Since 9/26 11:48 AM
+241ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+248ms ║║Executed virtual command setTile (1ms)
+262ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+276ms ║║Calculating (enum) not present == (enum) present >> (boolean) false
+282ms ║║Calculating (integer) 0 + (integer) 0 >> (integer) 0
+286ms ║║Executed virtual command setVariable (2ms)
+290ms ║║Cancelling statement #83’s schedules…
+297ms ║║Calculating (string) occupancy is + (string) 0 >> (string) occupancy is 0
+301ms ║║Executed virtual command setState (0ms)
+303ms ║╚Execution stage complete. (136ms)
+305ms ╚Event processed successfully (304ms)
9/26/2018, 11:46:48 AM +692ms
+2ms ╔Received event [Webcore - TLS].presence = present with a delay of 102ms
+213ms ║Runtime (41938 bytes) successfully initialized in 137ms (v0.3.107.20180806) (209ms)
+214ms ║╔Execution stage started
+482ms ║║Executed virtual command setTile (1ms)
+519ms ║║Executed virtual command setVariable (2ms)
+531ms ║║Executed virtual command setState (1ms)
+534ms ║╚Execution stage complete. (320ms)
+733ms ╚Event processed successfully (733ms)


#34

I’m not exactly sure why it’s not working… Couple things though:

  1. Post a screenshot of the expression box for the @Occupancy piston where you’re entering the text in to set the @Occupancy variable.
  2. Is @Occupancy defined as a “dynamic” global variable?

#35

image


#36

Can you post the other snapshot? Here’s what I’m looking for (grab a screen capture while in edit mode of the piston):


#37


#38

Looks right to me… I’m not sure what’s wrong.
I wouldn’t even worry about this piston right now. I would verify that the presence status is showing up (and changing from present/not present) properly in ST.