Announcement piston using Schalge Connect lock


#1

I have a piston that should announce a person when the enter the house. I have a Schlage Connect lock that is currently being controlled with the SmartLock app in ST. The lock is recognized in WebCoRE. In the piston, I reference the lock and the lock code. If it is equal, it should fire the other statements. I also found out there is an app by RBoy that I think is called Lock Management. It does a lot more then SmartLock app by ST.

The expected behavior should be to announce of the persons name that is entering the house. If the house is open and someone walks in, the it should say so and send a notification. It also flashes a light in the foyer

Nothing is happening. When I test the piston, the only thing that happens is the announcement.

6/12/2019, 10:18:16 PM +686ms
+1ms ╔Starting piston… (v0.3.10c.20190522)
+178ms ║╔Subscribing to devices…
+190ms ║║Subscribing to Front Door Lock.lockCodes…
+319ms ║║Subscribing to Echo - Basement…
+321ms ║║Subscribing to Echo - Jenna Bedroom…
+322ms ║║Subscribing to Echo - Katie…
+324ms ║║Subscribing to Echo - Kitchen…
+326ms ║║Subscribing to Echo - Master Bedroom…
+327ms ║║Subscribing to Echo - Michael Bedroom…
+329ms ║║Subscribing to Stairs…
+330ms â•‘â•šFinished subscribing (158ms)
+371ms ║Comparison (string) {“1”:“Don”,“2”:“Jenna”,“3”:“Michael”,“4”:“Katie”,“5”:“Nina”} is (string) Don = false (3ms)
+393ms â•šPiston successfully started (393ms)


#2

Which announcement? Line 23 or line 29?

Also, the log you posted does not help whatsoever. If you clear the log, and then test again, you will get an updated & helpful log… (it also helps to have TRACE turned on when posting a green snapshot. That adds numbers to the snapshot that matches up with the log)


#3

Remembering that for the next time I need it. Thanks.


#4

It looks as though it’s comparing the entire set of people instead of just the one who actually opened the lock.


#5

That log was captured at the moment he saved the piston. (Subscribing to devices, analyzing etc) The piston did not actually “run” or anything.


@seibertdr, I forgot to mention earlier that changing the “Logging Level” to anything other than “None” will preserve the Log between edits.


#6

Right. I should have noticed that.


#7

Wow, you guys are great. This would be so cool if I can get this working. I will turn on the log features and trace and repost. I have done some programming in the past (ColdFusion) but it has been awhile.


#8

Thank you WCmore. How do you turn on Trace?


#9

temp

Sometimes, you may have to press TEST first to get the option to appear.


#10

I don’t think lockCodes is the attribute you are looking for. I am in the same boat trying to figure out who unlocked the door, and it’s not quite easy, or I don’t see an easy way of doing it.
So far the best statement I found was

if lock’s lock #0 gets unlocked … where #0 I presume is the code used. However I am yet to test my theory :slight_smile: and also I am a bit confused since # of codes goes up to 32 and schlage only has 30 of them.


#11

Took me a little bit to figure it out. The number is the slot in the Schlage lock. So you would have to do an if statement for each slot. If you can do a variable, then you don’t have to do as many IF statements. Problem is that Schlage only stores the code in the slots. The app is the thing that associates the name with the slot number. The bigger problem is if any of the slots change or get deleted, that throws off you scheme. Try RBoy app for managing locks. He has a number of apps and device handlers for this sort of thing. I am still pursuing it but after driving my family nuts with it this weekend, I may have to put it on hold until I can write it better.


#12

I have changed my code since I posted this. I am using "if lock’s lock gets unlocked. #0 is the slot in the lock. In the SmartLock app. That number is associated with a user. The code itself is what goes into the lock with that slot number. If the slot is emtpy, it should return nothing.


#13

Well, I wish it worked for me that way. I have 4 codes programmed in, and they are in slots 4,5,9 and 11. But every time I enter any code of those 4 I get either lock #0 or #1


#14

Can you post your code?


#15

I am also getting the same results. All codes are triggering slot #1. Was this ever resolved?