Help with basic unlock piston


#1

Looking for help. This piston isn’t unlocking the door like I want it to.


Thanks !

9/18/2019, 3:11:03 PM +959ms
+1ms ╔Received event [Sensor Motion Front Porch].motion = inactive with a delay of 260ms
+232ms ║RunTime Analysis CS > 41ms > PS > 163ms > PE > 29ms > CE
+235ms ║Runtime (42832 bytes) successfully initialized in 163ms (v0.3.10e.20190628) (233ms)
+236ms ║╔Execution stage started
+244ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+245ms ║║Condition #3 evaluated false (4ms)
+248ms ║╚Execution stage complete. (12ms)
+249ms ║Setting up scheduled job for Wed, Sep 18 2019 @ 3:16:18 PM EDT (in 314.436s)
+261ms ╚Event processed successfully (261ms)
9/18/2019, 3:10:18 PM +479ms
+1ms ╔Received event [Presence Eric’s iPhone].presence = present with a delay of 236ms
+144ms ║RunTime Analysis CS > 39ms > PS > 72ms > PE > 32ms > CE
+146ms ║Runtime (42821 bytes) successfully initialized in 72ms (v0.3.10e.20190628) (144ms)
+148ms ║╔Execution stage started
+157ms ║║Comparison (enum) present changes_to (string) present = true (0ms)
+158ms ║║Cancelling condition #2’s schedules…
+160ms ║║Condition #2 evaluated true (6ms)
+161ms ║║Cancelling statement #1’s schedules…
+163ms ║║Condition group #1 made progress up the ladder, currently at step 1 of 2
+169ms ║╚Execution stage complete. (21ms)
+170ms ║Setting up scheduled job for Wed, Sep 18 2019 @ 3:16:18 PM EDT (in 359.995s)
+179ms ╚Event processed successfully (179ms)


#2

@Eric182, I will help you here with this caveat…search recent discussions about presence sensors and webcore. Some have great results with their sensors. Others, like me, have terrible response times and therefore my presence sensor is nearly useless for time sensitive webcore pistons. I won’t even talk about the security issues with unlocking a door with your phone.

Now, first, you need to remove all of your “only when” statements. Your code should look like this (untested) :

IF Presence Eric's Phone presence changes to present followed in 6 minutes by
Sensor Motion Front Porch motion changes to active
   THEN
      With
         Front Door Lock
            DO
               Unlock
      END With
      Send PUSH notification "Door unlocked by WebCoRE piston" and store
END IF

#3

Thank you!


#4

EDIT:: isn’t that what I already have?


#5

The line: “followed within X minutes by” never seems to be reliable, so I have stopped using that logic entirely, and resort to using variables.


In regards to this specific block:

To confront the elephant in the room, it is important to keep this in mind:

  1. All presence sensors occasionally shift, meaning your presence may change briefly while you are asleep.
  2. Most (all?) outdoor motion sensors will trigger when a cat walks by. Some of the more sensitive ones, will trigger when the wind blows, or a cloud passes. (one of my motion sensors actually triggers each time a lizard walks nearby!)

With both of these facts in mind, it is VERY possible that your house may auto-unlock while you are asleep. :frowning_face:

Because of this, I am VERY cautious about ever using an auto-unlock command!


#6

Thanks. How do you suggest using a variable in this situation?


#7

I apologize. The amount of time involved with making a safe presence piston is beyond the scope of a public forum. I only do this for clients after fully understanding their house’s setup.

But essentially,

IF X happens, Then set variable
IF Y happens, Then check variable
IF Z happens, Then reset variable

#8

That’s the route I was thinking of in my head. Thanks.


#9

I agree with @WCmore, the followed by operator has never worked properly and I avoid it at all costs.

Rather than messing with variables though, and then needing to reset them without fail, I like to use the age() and previousAge() functions for this particular use case.

I wrote the following piston for my brother, it has a stack of safeguards as noted in the piston comments… we can’t afford to have the door unlock by accident as it’s designed to pop open as well (it’s a disabled access thing that I don’t fully agree with), thus cannot be re-locked remotely

I check door is actually closed, and has been closed for at least 5 minutes, in-case my he arrives too fast / piston has a delayed execution. He could open the door manually with his fingerprint, close it behind him and not notice it has re-opened behind him as he walks away.

I check he arrived within the past 2 minutes so as to be less than the 5 minute requirement on the door being closed (piston can therefore only fire once per arrival)

I check he has been away for at least 30 minutes, because the zigbee mesh is weak and the ST arrival sensors currently have a habit of dropping off the grid for 5-10 minutes at a time (soon to be improved with a stack more Hive plugs to act as repeaters).

A LOT of thought needs to go into a piston like this!!!

  • Motion sensor is a ring video doorbell
  • Contact sensor is the front door
  • The variable @automaticExternalLightsOn is just a global marker that I use across 20+ pistons for when it’s dark, linked to sunset / sunrise with offsets… just means I can change the offset once in a single place.
  • The Unlock Front Door routine triggers another piston, which has a stack more safeguards lol


#10

Thank you. The final piston has lots of safeguards in place. Multiple conditions and things like that. I have it working using variables but I will take this into consideration as well. Thanks everyone for the input.


#11

I wish I had a reliable presence sensor. I really want to try this sort of thing.


#12

I use Tasker on my phone to trigger an unlock command.


#13

iOS here