Problem with setCode in RM

I have a really simple rule that sets the lock code on Tuesdays for a Kwikset 912 TLR, It used to work before one of the 2.2.8 updates (I'm currently at Here's the rule (i've added all the days while testing):

If I click on the "Run Actions" button in the Rule Machine it runs fine and sets the lock code. But if runs from the schedule, it does everything but set the lock code. Here's the log for "Run Actions":

And here's the log from the Rule Machine:

The rule log:

And finally, the device events log:

Note that there are no entries in the device events log for the 8:30 scheduled time. Any ideas on to further debug this. After the rule runs, the device pages shows the code for Tereza, but it wasn't installed (per the device log) and doesn't work

What device type are you using for your locks? I also have kwikset z-wave locks installed using the generic z-wave lock device

It appears that the custom device actions may have changed recently, now they are string, number and decimal.

Here's what my custom device actions look like:

setCode('Test', 25, 1234.0) on Back Door

I tested the custom actions, the SET CODE actions don't work with this device, the following error is reported:

dev:92021-09-26 01:04:36.294 pm errororg.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.size() is applicable for argument types: () values: []

Delete code using just the number works fine. This may be an issue within the device code rather than the RM code.

I'm also running lock code manager to manage my lock codes. Unfortunately, the lock code manager only lets you set enable/disable lock codes by date, not repeating enables/disables by days of week, otherwise you could manage the codes within that app.

I'm running

Device type is "Generic Z-Wave Lock". On the device page the "Set Code" (setCode) command still says NUMBER, STRING, STRING for postion, code, and name. Everything I've read here so far still says that's correct. The odd thing is that the rule works and sets the code if I click on the "Run Actions" button. But it doesn't set the code if I just let it run from the schedule. Don't know what to try next to debug it. As I said, it ran fine before one of the 2.2.8 updates.

Agree - running same device here.

Aside - under the latest driver versions, my Kwikset lock identified as a SCHLAGE, worked fine but SCHLAGE doesn't allow you to read the codes from the lock. Changed it back to generic z-wave.

I corrected my errors in adding the parameters as detailed below.

I see that I can add any number of parameters to the SET CODE command of any of the types listed. I also presume that order is important, so I added the position (NUMBER) 1st, the code (STRING) 2nd, and the name (STRING) third (as you already have above). This resulted in a properly formatted command. Previously it appeared like I could only add one of each parameter, I wasn't looking at the parameters correctly.

RUN ACTIONS works from the app, going to test the trigger method now.

Appears to be working ok - here's the code. Code is set whether triggered or run from within the app. My test code is triggered by a virtual switch (TEST SWITCH) - CHANGED, that with simple conditionals ADDs the code when the switch is on, and deletes the code when the switch is off. SET CODE is number string string as above. DELETE CODE is just the position (NUMBER).

I also checked to see if it could cause an error if the code position already existed. The device simply changes the code (vice add) so it shouldn't matter.

You may want to try downloading the latest update .156 and see if that changes anything, but from what I see it should be working.

You may want to try this method using a virtual switch (HOUSEKEEPER), then use the trigger events in a separate rule as you have above to just turn on or off the virtual switch. It would also provide a benefit that you could put the switch on a dashboard to manually set the code for the housekeeper if she comes at a different time.

Not sure why your method stopped working, but it may be something that was inadvertently broken then corrected in .156.

So, I updated to this morning before the setCode rule ran. Surprise! It worked and the log shows all of the commands that it should. I'll let it go for several days in a row to test before setting the rule back to Tuesdays only.

You may be correct that a change somewhere else inadvertently broke setCode in the RM. Hope it's fixed for good now.

1 Like