Turn off Specific Codes for Door Locks

I will give it a shot.

Check that post.

1 Like

That is exactly what I am looking for. Rule machine seems to be pretty convoluted, I'm not exactly sure how to work it. I use the Basic Rule function all the time. However, this Rule Machine has me going in circles.

It looks more complicated than it is...the hardest parts are finding the custom commands you need. :slight_smile:

Rule Machine example screenshots

Start a new rule. First thing you do is create the trigger, in your case, based on time (and maybe date):

2024-05-30 18_22_58-C8, C7, & Misc Hubs

2024-05-30 18_23_32-C8, C7, & Misc Hubs

2024-05-30 18_23_44-C8, C7, & Misc Hubs

2024-05-30 18_24_03-C8, C7, & Misc Hubs

2024-05-30 18_24_15-C8, C7, & Misc Hubs

2024-05-30 18_24_34-C8, C7, & Misc Hubs

2024-05-30 18_24_46-C8, C7, & Misc Hubs

2024-05-30 18_25_56-C8, C7, & Misc Hubs

2024-05-30 18_26_27-C8, C7, & Misc Hubs

Now you have the first two actions...
2024-05-30 18_27_10-C8, C7, & Misc Hubs

Next you need to add another action (again a "Run Custom Action" to delete the code after the desired time:
2024-05-30 18_27_18-C8, C7, & Misc Hubs

...and so on...

Create one rule for each lock code you want to set/remove at specific times.

Dive in... :slight_smile:

1 Like

ya thats dead simple.. lol

i forget the guys name but i really missing the old lock manager app that was 3rd party on smarthings.

there definately is room to spruce up the lock manager functionality in my meager opinion.. i basically just manually add and delete codes in the locks directly myself.. the locks themselves are Shite and everytime you fetch or change a code it has to go through all 30m codes.. stupid.

1 Like

Yeah, I used that as well, just an amazing app...

1 Like

100% this. AFAIK, z-wave locks don't have an enable/disable code function.

2 Likes

Yes, the code is either set on the lock or it isn't. There is no way to "disable" a code and have the code stay on the lock. The only way to disable it is to delete it.

2 Likes

My lock codes are now entirely managed with my Google Calendar. I use Rule Machine, in combination with GCalSearch to automate lock codes. I created a calendar called "Lock Codes" and have GCalSearch check my calendar every night at midnight and enable/disable codes based on specific trigger events.

I have calendar events set up as triggers using the GCalSearch app. For example, I have one trigger that searches for an event called "House Cleaning" on my Google Calendar. I typically set the event to start 1 hour before the cleaner is supposed to arrive and ends 1 hour after they are typically gone. At the beginning of the calendar event, Hubitat is triggered to enable (add) the housekeeper's lock code to a particular slot, and then when the calendar event ends, the code is disabled (deleted) on the lock again.

2 Likes

I'd prefer to stay away from any cloud calendar programs. This is why I went with Hubitat. I want everything self contained on the app or on prem, nothing in the cloud. I guess rule machine is the only way to do it or write my own app (which I am not a coder). So it's rule machine or Hubitat making an update to LCM. I guess it will be trial and error and a lot of this and that.

Here is a rule that would do what you gave in your orignal example. The number 20 you see in there is the code slot, just be sure to use a unique higher number slot for each person you will be adding/removing on a schedule so they do not conflict with each other, or other permanent codes.

image

After the rule added the code:
image

setCode and delectCode are addded using "Run Custom Action" in RM and look like:

Custom Action info in docs:

6 Likes

Thanks I'll give it a try! :grinning:

That's actually pretty slick :slight_smile:

Well, tried both rules from above. After trying both this is what is in my logs from the last solution given:

[dev:206]2024-06-06 15:11:50.678[error]groovy.lang.MissingMethodException: No signature of method: genericZigbeeLock.setCode() is applicable for argument types: (java.lang.String) values: [20,'1111','Lock Restrictions']
Possible solutions: setCode(java.lang.Object, java.lang.Object), getCodes(), setCode(java.lang.Object, java.lang.Object, java.lang.Object), hashCode(), deleteCode(java.lang.Object), getAt(java.lang.String) (method setCode)

[dev:205]2024-06-06 15:11:50.667[error]groovy.lang.MissingMethodException: No signature of method: genericZigbeeLock.setCode() is applicable for argument types: (java.lang.String) values: [20,'1111','Lock Restrictions']
Possible solutions: setCode(java.lang.Object, java.lang.Object), getCodes(), setCode(java.lang.Object, java.lang.Object, java.lang.Object), hashCode(), deleteCode(java.lang.Object), getAt(java.lang.String) (method setCode)

By the way I have two Kwikset 916 locks these are zigbee locks

Any help please.

Looks like you are trying to send the parameters to setCode as one single string? You have to define each parameter in the action by using "Add Another Parameter" button, the first one is a number, the other two are strings. You can see what the command is expecting by looking at the device page.

image

1 Like

I did do the actions like your above step in Select Actions to run. I even tried just doing a lock code by itself. That did not work either. I did a straight String for parameter type that looks like this,
Trigger event was "Mode Day", then did "Actions to Run", "New Action", "Set Variable, Mode or File, Run Custom Action", then "Run Custom Action", Selected "Lock" for Capability of action device", Selected the appropriate lock "Kwikset Lock 1", and "Kwikset Lock 2", Selected custom command "setCode", then parameter type was set to "string", the string value was "10,'1111','Test User'"

I then created the Wait in a separate Action and the deleteCode in another separate action.

But I get the error I mentioned above. I looked at the codes in the device and they were never put in from the Rule that I created.

Here is another related question: If you look at my string above, I added single quotes to both the lock code and the name of the code, but not to the slot. But when it shows after I created it, it shows '10,'1111','Test User''
that is single quote 10 comma, single quote 1111 single quote comma, single quote Test user single quote single quote.

Did I input the string wrong somewhere?

Thanks

Yes, that is wrong, you have to add the first as a number, then a second parameter as a string, then the last string. Each one is a separate parameter.

chrome_IUDkfpDOqR

2 Likes

Ok, let me try that.

Absolutely awesome! It works just as needed. I did a shortened test for deleting the code and all is great!

Thanks A LOT!

1 Like