Problems Setting Autolock with Z-Wave Lock PH Edge Driver

This is the decoded error when you send a refresh command to driver.

[string "st/dispatcher.lua"]:235: Error encountered while processing event for <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)>:
    arg1: table: 0x26cb900
"[string "schlage-lock/schlage-custom/init.lua"]:158: attempt to call a nil value (field 'get_refresh_commands')"

The code line 158 is a call to function in default library st.zwave.defaults.lockCodes.lua

 if device.preferences.refreshCodes then
    LockCodesDefaults.get_refresh_commands(self,device,'main',0)
  end

The function get_refresh_commands was deleted from lua libraries in version firmware 48.x and return error 158: attempt to call a nil value (field 'get_refresh_commands')"

Try disabling preference.refreshCodes in your device settings menu

1 Like

I’m away from my computer so won’t be able to run CLI, but can answer some of this based upon prior tests.

The AutoLock state in both the AWA and the Mobile App seems to update more consistently when issuing the Refresh Command from the AWA (i.e. The Mobile Apps seems to error out more with the popup "A network or server error occurred. Try again later.” )

I did try that back on Oct 17th 2023 but no joy in getting the “1 of 8” locks to resolve the AutoLock field. I do understand this is a slightly different issue, but can’t help but to think it’s related.

And as well to be clear, I think my other 7 locks are having the same/similar problem to @Puzzling.

Do you mean under Settings for the lock in the ST app? I see “Query lock codes on refresh”. If I try to uncheck it, it does appear to change, but there is no activity in the log. And when I come back to the screen, it’s on again.

Update: And in AWA, preference.refreshCodes is still true. I don’t see a way to change it there.

Hmmm… so this is interesting!

In my 1 of 8 that does NOT activate the AutoLock field…
Android App > Foyer Lock > Menu > Settings: “Query lock codes on refresh” is ENABLED.

All of my other 7 locks it is DISABLED.

But in the Foyer Lock, I Toggle it Off, Exit the card, Come back to it: It is still ENABLED?

Is there a Command Button in the AWA that relates to that setting as well?

Odd that it won’t save the position of that toggle.

I refer to the preference with this title:

 - title: "Query lock codes on refresh"

When this preference has true value then attempt to refresh the codes and get an error and function crash and exit.
If the value is false then driver not perform the refresh codes and try to get the device paremeters values, that is the follow to execute:

local function refresh_handler(self, device, args)
  device:send(DoorLock:OperationGet({}))
  if device.preferences.refreshCodes then
    LockCodesDefaults.get_refresh_commands(self,device,'main',0)
  end
  for param, map in pairs(paramMap) do
    if device:supports_capability_by_id(map.cap,map.comp) then
      device:send(Configuration:Get({parameter_number = param}))
    end
  end
end

I don’t see a way to change that preference in the AWA or the CLI. And if the app isn’t changing it… but at least we might have something in common now! :slight_smile:

I wonder if that setting is the cause, or just another symptom.

Did they add it back in a later version? I just looked in the v9 library for version 52.x and it’s still there.

local function get_refresh_commands(driver, device, component, endpoint)
  if device:supports_capability_by_id(capabilities.lock.ID, component) and device:is_cc_supported(cc.DOOR_LOCK, endpoint) then
    return {DoorLock:OperationGet({}, {dst_channels = {endpoint}})}
  end   
end     

If you’ve never set the Length of user code then you likely need to fill that in for the other setting to work. Use the same number that you’re currently using and your lock codes should be preserved.

1 Like

Okay, I went back to the preference screen and changed query lock code to off (false) and I also set my code length to 4. This time the preferences stuck.

Now a refresh of parameters is actually doing something!

2024-03-11T18:11:28.933872414+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:11:28.939436414+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"interiorButton","capability_id":"platinummassive43262.schlageInteriorButton","component_id":"settings","state":{"value":"enable"}}
2024-03-11T18:11:28.945720080+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:11:29.341819747+00:00 TRACE Z-Wave Lock PH  Z-Wave command(5f0ea41f) transmit status: TRANSMIT_COMPLETE_FAIL
2024-03-11T18:11:29.439066081+00:00 TRACE Z-Wave Lock PH  Received event with handler unnamed
2024-03-11T18:11:29.520195414+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received Z-Wave command: {args={configuration_value=0, parameter_number=15, size=1}, cmd_class="CONFIGURATION", cmd_id="REPORT", dst_channels={}, encap="S2_ACCESS_CONTROL", payload="\x0F\x01\x00", src_channel=0, version=1}
2024-03-11T18:11:29.533151747+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:11:29.537833414+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"autoLock","capability_id":"platinummassive43262.autoLock","component_id":"settings","state":{"value":"off"}}
2024-03-11T18:11:29.544397081+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:11:33.132711416+00:00 TRACE Z-Wave Lock PH  Received event with handler capability
2024-03-11T18:11:33.173990749+00:00 TRACE Z-Wave Lock PH  Z-Wave command(0286965f) queued for radio transmission: CC:Configuration, CID:0x04
2024-03-11T18:11:33.176706416+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received command: {"args":{},"capability":"platinummassive43262.autoLock","command":"autolock","component":"settings","positional_args":{}}
2024-03-11T18:11:33.225557082+00:00 TRACE Z-Wave Lock PH  Found CapabilityCommandDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:11:33.235770416+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> sending Z-Wave command: {args={configuration_value=-1, default=false, parameter_number=15, size=1}, cmd_class="CONFIGURATION", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\x0F\x01\xFF", src_channel=0, version=1}
2024-03-11T18:11:33.243335749+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:11:34.558904750+00:00 TRACE Z-Wave Lock PH  Z-Wave command(0286965f) transmit status: TRANSMIT_COMPLETE_OK
2024-03-11T18:12:06.129127431+00:00 TRACE Z-Wave Lock PH  Received event with handler unnamed
2024-03-11T18:12:06.145409098+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received Z-Wave command: {args={alarm_level=1, alarm_type=27, event="AUTO_LOCK_LOCKED_OPERATION", event_parameter="", notification_status="ON", notification_type="ACCESS_CONTROL", v1_alarm_level=1, v1_alarm_type=27, z_wave_alarm_event=9, z_wave_alarm_status="ON", z_wave_alarm_type="ACCESS_CONTROL", zensor_net_source_node_id=0}, cmd_class="NOTIFICATION", cmd_id="REPORT", dst_channels={}, encap="S2_ACCESS_CONTROL", payload="\x1B\x01\x00\xFF\x06\x09\x00", src_channel=0, version=3}
2024-03-11T18:12:06.168082765+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:12:06.173310765+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"lock","capability_id":"lock","component_id":"main","state":{"data":{"method":"auto"},"value":"locked"}}
2024-03-11T18:12:06.178890765+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"unlockCodeName","capability_id":"platinummassive43262.unlockCodeName","component_id":"main","state":{"value":"Locked"}}
2024-03-11T18:12:06.184048765+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:12:10.823736434+00:00 TRACE Z-Wave Lock PH  Received event with handler unnamed
2024-03-11T18:12:10.836959767+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received Z-Wave command: {args={door_condition=0, door_lock_mode="DOOR_SECURED", inside_door_handles_mode=0, lock_timeout_minutes=254, lock_timeout_seconds=254, outside_door_handles_mode=0}, cmd_class="DOOR_LOCK", cmd_id="OPERATION_REPORT", dst_channels={}, encap="S2_ACCESS_CONTROL", payload="\xFF\x00\x00\xFE\xFE", src_channel=0, version=1}
2024-03-11T18:12:10.848347100+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock
2024-03-11T18:12:10.855094100+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"lock","capability_id":"lock","component_id":"main","state":{"value":"locked"}}
2024-03-11T18:12:10.860281767+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:12:16.065013769+00:00 TRACE Z-Wave Lock PH  Received event with handler capability
2024-03-11T18:12:16.090037436+00:00 TRACE Z-Wave Lock PH  Z-Wave command(88491573) queued for radio transmission: CC:Configuration, CID:0x04
2024-03-11T18:12:16.125113436+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received command: {"args":{},"capability":"platinummassive43262.autoLock","command":"off","component":"settings","positional_args":{}}
2024-03-11T18:12:16.130370436+00:00 TRACE Z-Wave Lock PH  Found CapabilityCommandDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:12:16.139686770+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> sending Z-Wave command: {args={configuration_value=0, default=false, parameter_number=15, size=1}, cmd_class="CONFIGURATION", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\x0F\x01\x00", src_channel=0, version=1}
2024-03-11T18:12:16.147308436+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:12:16.189812103+00:00 TRACE Z-Wave Lock PH  Z-Wave command(88491573) transmit status: TRANSMIT_COMPLETE_OK

In the app I finally see the current state of the auto Lock attribute.

Now I need to re-run some of the tests above and I’ll let you know what I see.

2 Likes

It is not in the ones I downloaded some days ago, nor in 51.x, 49.x and 48.x either.

Ah, I see what’s going on. I’m looking in lock.lua where the get_refresh_commands till exists. It was removed from lockCodes.lua from 48.x onward. Should probably update the driver to remove the option to have the lock codes refreshed.

@philh30 If I submit a PR to remove the setting in profiles, will you merge it and package up a new version of the driver?

Used AWA to set auto Lock and I see it sent to the lock, but no emit event still. So AWA and app do not get refreshed.

2024-03-11T18:23:37.405515351+00:00 TRACE Z-Wave Lock PH  Received event with handler capability
2024-03-11T18:23:37.441750351+00:00 TRACE Z-Wave Lock PH  Z-Wave command(f67a20eb) queued for radio transmission: CC:Configuration, CID:0x04
2024-03-11T18:23:37.444577351+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received command: {"args":{},"capability":"platinummassive43262.autoLock","command":"autolock","component":"settings","positional_args":{}}
2024-03-11T18:23:37.458527018+00:00 TRACE Z-Wave Lock PH  Found CapabilityCommandDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:23:37.474665685+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> sending Z-Wave command: {args={configuration_value=-1, default=false, parameter_number=15, size=1}, cmd_class="CONFIGURATION", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\x0F\x01\xFF", src_channel=0, version=1}
2024-03-11T18:23:37.479950352+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:23:38.843295685+00:00 TRACE Z-Wave Lock PH  Z-Wave command(f67a20eb) transmit status: TRANSMIT_COMPLETE_OK
2024-03-11T18:24:11.782216701+00:00 TRACE Z-Wave Lock PH  Received event with handler unnamed
2024-03-11T18:24:11.805372701+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received Z-Wave command: {args={alarm_level=1, alarm_type=27, event="AUTO_LOCK_LOCKED_OPERATION", event_parameter="", notification_status="ON", notification_type="ACCESS_CONTROL", v1_alarm_level=1, v1_alarm_type=27, z_wave_alarm_event=9, z_wave_alarm_status="ON", z_wave_alarm_type="ACCESS_CONTROL", zensor_net_source_node_id=0}, cmd_class="NOTIFICATION", cmd_id="REPORT", dst_channels={}, encap="S2_ACCESS_CONTROL", payload="\x1B\x01\x00\xFF\x06\x09\x00", src_channel=0, version=3}
2024-03-11T18:24:11.823843368+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:24:11.830362701+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"lock","capability_id":"lock","component_id":"main","state":{"data":{"method":"auto"},"value":"locked"}}
2024-03-11T18:24:11.835993701+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"unlockCodeName","capability_id":"platinummassive43262.unlockCodeName","component_id":"main","state":{"value":"Locked"}}
2024-03-11T18:24:11.840994701+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:24:16.495006037+00:00 TRACE Z-Wave Lock PH  Received event with handler unnamed
2024-03-11T18:24:16.524089037+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received Z-Wave command: {args={door_condition=0, door_lock_mode="DOOR_SECURED", inside_door_handles_mode=0, lock_timeout_minutes=254, lock_timeout_seconds=254, outside_door_handles_mode=0}, cmd_class="DOOR_LOCK", cmd_id="OPERATION_REPORT", dst_channels={}, encap="S2_ACCESS_CONTROL", payload="\xFF\x00\x00\xFE\xFE", src_channel=0, version=1}
2024-03-11T18:24:16.534956703+00:00 TRACE Z-Wave Lock PH  Found ZwaveDispatcher handler in zwave_lock
2024-03-11T18:24:16.541367037+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> emitting event: {"attribute_id":"lock","capability_id":"lock","component_id":"main","state":{"value":"locked"}}
2024-03-11T18:24:16.555104370+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled

Then I set turned off Auto lock and again the command was sent, but no emit event happened.

2024-03-11T18:25:26.462533070+00:00 TRACE Z-Wave Lock PH  Received event with handler capability
2024-03-11T18:25:26.501452737+00:00 TRACE Z-Wave Lock PH  Z-Wave command(b8afe637) queued for radio transmission: CC:Configuration, CID:0x04
2024-03-11T18:25:26.504292737+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> received command: {"args":{},"capability":"platinummassive43262.autoLock","command":"off","component":"settings","positional_args":{}}
2024-03-11T18:25:26.518926070+00:00 TRACE Z-Wave Lock PH  Found CapabilityCommandDispatcher handler in zwave_lock -> Schlage Lock -> Schlage BE469
2024-03-11T18:25:26.525122404+00:00 INFO Z-Wave Lock PH  <ZwaveDevice: de44069a-c231-4cc9-b410-c942844fd837 [6E] (Front door lock)> sending Z-Wave command: {args={configuration_value=0, default=false, parameter_number=15, size=1}, cmd_class="CONFIGURATION", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\x0F\x01\x00", src_channel=0, version=1}
2024-03-11T18:25:26.531443737+00:00 DEBUG Z-Wave Lock PH  Front door lock device thread event handled
2024-03-11T18:25:27.919593071+00:00 TRACE Z-Wave Lock PH  Z-Wave command(b8afe637) transmit status: TRANSMIT_COMPLETE_OK

I don’t think it’s necessary to remove that option, just change the one that needs to be called, I think it should be reload_all_codes function, which is what get_refresh_commands called later in old libraries

Yeah, I see your point. I suppose it’s safe to call it directly since we know that this model lock does support lock codes and the check to see if it does really doesn’t add any value in this situation.

1 Like

Ahhh… @philh30 THAT detail got by me on the 1 lock; all the others were already set to “4”. Changing it to “4” allowed me to toggle the Query Lock Codes on Refresh button… and it stuck!

… and OMG… I was able to go into MySmartThings Advanced, Toggle AutoLock; Off; Refresh AND IT FINALLY ACTIVATED THE AUTO LOCK BUTTON IN MY ANDROID APP!!!

THANK YOU @philh30 !!! :clap: :clap: :clap:

image
image

image
image

1 Like

… Still having problems (on all 8 locks) within the Android App when attempting to Toggle Auto Lock On or Off: Intermittently I get the "A network or server error occurred. Try again later.”

But setting it in MySmartThings Advanced seems to work every time.

@Puzzling: what are your two settings in Android App >Your Lock > Menu > Settings:

  1. “Query lock codes on refresh”: (mine is disabled)
  2. “Length of user code”: (mine is 4)

It works for you on the web because you refresh after changing the capability value.

Say you do the same in the App you will get the same results, even if you have to wait for the network error to appear to refresh the app by sliding your finger down.

1 Like

My comment about preferences was several posts back but the same.

And yes it does make the setting show up, but it still doesn’t refresh automatically like it should. So we aren’t completely out of the woods.

The behavior is still the same that the value can get updated in the app, at the lock, via routine or via AWA and the lock gets the message. But the driver never gets told to refresh its value.

But at least there is a workaround involving a manual refresh.

2 Likes

The smoking gun for me is that the setting can be manually changed at the lock, but no configuration report is being received at your hub. So, the lock may be receiving the command from the hub to change the auto lock setting and executing it, but it’s failing to inform the hub that it did. That smacks of a problem with the lock and/or its firmware.

1 Like

Okay, I just contacted Schlage via phone. After what seemed like an interminable hold time, I talked to an agent (Nick). I’m not sure if he completely understood what I was saying but after verifying that I’d tried a factory reset of the lock, updated my phone, updated the ST app, etc., he basically authorized a replacement of the lock unit via UPS.

I’ll let you know if it comes with different firmware or otherwise fixes the issue. :smiley:

It does make me wonder if @RBoy has noted anything similar with his Z-Wave Lock driver because if it is related to 0.11.0 firmware, then others using that driver should also see the issue when changing the Auto Lock parameter.

3 Likes