Help with my lock rule


#1

I need some help with a rule in 4.0. I have it set up to announce lock status. Locked/unlocked. it works fine. Since the new driver is out for the schlage, I would like to also include who unlocked it, but i'm not sure how to retrieve that information. Can someone help me with this?


#2

That will vary greatly on how you are announcing the lock's status. Are you doing this when the lock is locked or unlocked? Or are you storing that and then announcing it by asking the google home the status of the lock through some other work-around. Need a lot more info.

In the broad strokes though, the lock only knows the person who unlocked it based on their lock code. So, if it unlocked via software or a dashboard or something, it won't know. What would have to do is set up a rule with a triggger using Keypad Codes as the capability.
image

Then, in the rule itself, you would have to have a conditional action where you store the name of the person who unlocked it. Something like this:

image

One for each lock code entered in the lock.


#3

Way too complicated and OP is not using a keypad. %value% is already available for use and if a code is assigned a name, using %value% in a rule will announce the name assigned to the code used to unlock the lock.

Use a RM 3.0 rule to keep things simple. You can use 4.0, but as long as 3.0 is still available the rule is easier to create (at least in my opinion). The variables are exactly the same for either version.

In your rule, create a trigger with the following triggered event:

Lock code entered on (select your lock(s)): **Any Lock Code**

Then as your action, announce the following on whatever TTS device you are using:

%value% unlocked %device%

If you want to add the time:

%value% unlocked %device% at %time%

With this rule, when any lock code is used to unlock your lock(s), it will announce (as an example):

John unlocked Front Door Lock

or

John unlocked Front Door Lock at 09:30pm


#4

I thought that %value% would return the actual code used, not the name. But I just tried it to confirm, it does return the name assigned to the code.


#5

Like the above, I was using Trigger in Rule 3.0 to do this--I had it send me a push notification any time a code is used and have it announced on the speakers if I'm home, but you could greatly simplify that logic and just use whichever of the actions (or both) you want:

image

For fun, I decided to re-do it in Rule 4.0. It's almost exactly the same as a Trigger was in Rule 3.0, so unless you have a strong preference, I'd probably just go with 4.0 instead--you never know what new features they might add later. :slight_smile:

That being said, you don't really need Rule Machine for this at all. If you're trying to learn, it's certainly do-able and not too hard (the short answer to your question is that you're looking for the %value% variable :slight_smile: ). I'm using RM because I want a couple different things depending on some conditions and have multiple locks for triggers and want the same actions for each (so it's less repetitive on my part). But otherwise, you should be able to use the built-in Notifications app to get the same with less effort than either of the above:

I say "should" because I tried this once and despite being told to operate only on selected lock codes, it performed the actions for any lock code. I think a couple other people have noticed this as well. I believe this is a bug, and I haven't tried it lately to see if it was fixed.


#6

thank you for all of the replies. I had something come up that took me away from everything for two days. I'm back in front of my desk again and I will definitely explore all of this. I'll finish with what I ended up doing. As always, this group is the tops when one needs help. I don't regret hopping to hubitat.


#7

I got my rules built. Thanks so much for the input. I have no idea who to credit this with solved. I created two rules. One that shows announces the person that unlocked the lock and one that states the lock status. So if someone enters a code, we get two notifications, lock was opened by user and front door lock is unlocked. Then it announces when the lock auto locks. It's perfect. Thank you all for the input.