KeyMaster Z-Wave lock manager and scheduler

Did you modify your lock name to remove the base name?

I have

lock.schlage_allegion_be469zp_connect_smart_deadbolt_locked_frontdoor

Which is what you should have gotten after adding _frontdoor. Meaning your original should look like:

lock.schlage_allegion_be469zp_connect_smart_deadbolt_locked

I suggest excluding your lock, deleting anything that is leftover and including your lock again, which should give you the entity immediately above

And this in your ini is wrong:

lockfactoryname="lock_deadbolt"

That should have the “base name” something like

schlage_allegion_be469zp_connect_smart_deadbolt_locked

All my devices are renamed. I have over 150 zwave devices, so everything needs to be named clean. The latest version of HA allows for easy rename of all device base names. I will remove and readd to see if that fixes things, but my basename is lock_deadbolt. I have nothing that has the original basename. With tons of light switches/sensors/etc. they start showing up as basename(1) basename(2) etc.

In that case you might need to modify the txt files accordingly.

Look in the frontdoor/yaml to see if wed_frontdoor_3 exists anywhere.

@crzykidd paste this into your template editor and paste the results


mon_frontdoor_1:
      entity_id:
        - sensor.time
        - input_datetime.mon_start_date_frontdoor_1
        - input_datetime.mon_end_date_frontdoor_1
      value_template: "{{ ((is_state('input_boolean.mon_frontdoor_1', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Monday') and ((states.input_datetime.mon_start_date_frontdoor_1.state  == states.input_datetime.mon_end_date_frontdoor_1.state) or ((states('sensor.time') >= states('input_datetime.mon_start_date_frontdoor_1')[0:5]) and (states('sensor.time') <= states('input_datetime.mon_end_date_frontdoor_1')[0:5]))) }}"
      
      Date: {{ states('sensor.date') }}
      
Error rendering template: UndefinedError: 'str object' has no attribute 'strftime'

Also I completely removed the package, removed the left behind entities in HA, removed my doorlock and re added it. So now my naming is identical to your, and have the same issue.

Think I found the problem. Do a pull then run the script again. Then check the template. If there is no error you should be good. It’s totally weird how I found this error doing something else

Ok way farther now. No errors in the log file. However now when I add a username and pinn and click enable the status changes to connected but nothing happens. I don’t see any communication with the lock in my zwave logs. Not sure where to troubleshoot.

Test the lock.set_usercode function in dev services.

Works as expected. When I hit the enable button on the lock page, it doesn’t send anything out to the ZWave network.

Does the status show connected and change color to yellow?

Yes it does. I expected that as soon as I select enabled, and the status turned to yellow that I would see it send the set message out via Zwave. It is almost like a automation is broken somewhere…

hang on. I’ll test mine

1 Like

Mine is working. Start throwing this into your generated automations actions block to track what is firing and what is not. Especially the FrontDoor Add Code automation

    - service: persistent_notification.create
      data_template:
        title: "debug"
        message: "message goes here"

When that sensor changes to Connected, it should add the PIN to that slot. Likewise when it’s disconnected it will delete the PIN.

I missed this. That’s a good idea. Yes, you have to tweak you other automations, however you can create sensors with your naming scheme that just pony off the new lock name. I do this all the time so I only have to change entity names in one or two places.

This is the code that adds a new PIN. I’d investigate that the nodeid matches the zwave nodeid of the lock.

    - alias: FrontDoor Add Code
      condition:
        - condition: state
          entity_id: 'binary_sensor.allow_automation'
          state: 'on' 
      trigger:
        entity_id: binary_sensor.active_frontdoor_1, binary_sensor.active_frontdoor_2, binary_sensor.active_frontdoor_3, binary_sensor.active_frontdoor_4, binary_sensor.active_frontdoor_5, binary_sensor.active_frontdoor_6
        platform: state
        to: 'on'
      action:
        - service: lock.set_usercode
          data_template:
            node_id: >- 
                {{states.lock.schlage_allegion_be469zp_connect_smart_deadbolt_locked_frontdoor.attributes.node_id}}
            code_slot: >-
                {% set object_id = trigger.to_state.object_id %}
                {% set index = 17 %}
                {% set code_slot = object_id[index:] %}
                {{ code_slot  }}
            usercode: >-
                {% set object_id = trigger.to_state.object_id %}
                {% set index = 17 %}
                {% set code_slot = object_id[index:] %}    
                {% set codetext = 'frontdoor_pin_' + code_slot | string %}
                {% set code = states['input_text'][codetext].state %}
                {{ code | string }}

Anytime a Code is Enabled, this fires.

Oh snap! I forgot to document this. Make sure you have created a sensor named binary_sensor.allow_automation .I use this during startup to prevent automations from running. Put this where you create sensors. Then create the input_boolean allow_automation_execution and set it to true.

    allow_automation:
      friendly_name: "Allow Automation"
      value_template: "{{ is_state('input_boolean.allow_automation_execution', 'on') }}"

There are some missing scripts that run during setup to turn this on and off. I’ll add them later.

Yes that was it. Ok two last questions.

  1. when you disable a slot what happens? Do you delete the code or set it to a random #
  2. any issues supporting 6 digit codes?

Deleted codes are randomized per what @ptdalen discovered that you can’t “wipe” slots. I was going to see if you could factory reset the lock to wipe the slots, but that doesn’t work.

Six digit codes might work with a little tweaking. Matter of fact it might work already. I just haven’t adjusted the lock to try .

1 Like