Schlage Zwave Configuration Automation

So I’ve gone back and forth as to if this is even needed. All of these options are available in the zwave control panel. Also, many of these are things you’d rarely change. With that said, some people would like the ability to change lock settings via the UI. I’ll say this is 95% complete. I will also add, I think this is a bug, but when I change zwave settings via the services panel, they don’t reflect in the zwave control panel, but the changes definitely take. I dont know if it takes a restart of HA, or just time since the locks are battery devices, but my initial testing showed the lock settings did happen, but again, the zwave contorl panel did not reflect the changes.

Anyway, here is what I believe would be a good foundation for anyone wanting a place to set/change theier configuration. The input selects are ordered with the schlage default setting at the top. The one thing I gave up on and if anyone would like to figure it out, is the best way for this to work with multiple locks. I have two, but I dont want to have two sets of input selects, but maybe that will end up being the best choice. Enjoy

- alias: Set Schlage Lock Options
  trigger:
    - platform: state
      entity_id:
        - input_select.lock_zwave_option_3
        - input_select.lock_zwave_option_4
        - input_select.lock_zwave_option_5
        - input_select.lock_zwave_option_7
        - input_select.lock_zwave_option_8
        - input_select.lock_zwave_option_9
        - input_select.lock_zwave_option_10
        - input_select.lock_zwave_option_11
        - input_select.lock_zwave_option_15
        - input_select.lock_zwave_option_16
  action:
    - service: zwave.set_config_parameter
      data_template:
        node_id: 104
          
        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[4]) |int) %}
          {{ parameter }}

        value: >-
          {% set zwave_parameter = 'lock_zwave_option_' ~ parameter %}
          {{ states['input_select'][zwave_parameter].state }}
		
Input Selects
  lock_zwave_option_3:
      name: Enable or disable the beeper.
      options:
          - Enable Beeper
          - Disable Beeper

  lock_zwave_option_4:
      name: Prevents all user codes from unlocking the deadbolt
      options:
          - Disable Vacation Mode
          - Enable Vacation Mode

  lock_zwave_option_5:
      name: Press the Outside Schlage Button to lock the deadbolt
      options:
          - Enable Lock & Leave
          - Disable Lock & Leave

  lock_zwave_option_7:
      name: Alarm sounds based on door activity
      options:
          - Alarm Off
          - Activity
          - Tamper
          - Forced Entry

  lock_zwave_option_8:
      name: Activity Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_9:
      name: Tamper Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_10:
      name: Forced Entry Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_11:
      name: Disable Local Alarm Controls
      options:
          - Enable local alarm controls
          - Disable local alarm controls

  lock_zwave_option_15:
      name: Auto lock
      options:
          - Disable auto lock
          - Enable auto lock

  lock_zwave_option_16:
      name: User code pin length (changing Lenth erases all codes)
      options:
          - 4
          - 5
          - 6
          - 7
          - 8

groups
zwave_door_lock_options:
  name: zwave configs for schlages
  view: no
  entities:
    - input_select.lock_zwave_option_3
    - input_select.lock_zwave_option_4
    - input_select.lock_zwave_option_5
    - input_select.lock_zwave_option_7
    - input_select.lock_zwave_option_8
    - input_select.lock_zwave_option_9
    - input_select.lock_zwave_option_10
    - input_select.lock_zwave_option_11
    - input_select.lock_zwave_option_15
    - input_select.lock_zwave_option_16
1 Like

Just a heads up, apparently this does not work after all, I’m sure it’s just a minor fix I’m missing. It seems like ti should work, it worked in the template test area, but when i change the input selects I get the following error

Error executing service <ServiceCall zwave.set_config_parameter (c:68ee3379477e42118fb8dac585541de9): node_id=104, parameter=0, value=, size=2>

As you can see it’s not pulling the parameter from the input select, even though it does so in the template test area.

EDIT: I’ve tried a few different ways to get the entiy_ID but I dont believe its working. that’s the issue. Basically this section here

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[4]) |int) %}
          {{ parameter }}

I’ve tried I assume trigger.to_state.object_id should be - input_select.lock_zwave_option_3 (or whatever I changed), I also tried as if it was just "lock_zwave_option_3:, and changed the split # to 3, I tried “trigger.entity_id” and adjusted the values accordingly as well. No luck. Keep getting 0 as the value. Not sure How to test this in the template test area

Looking for some help with this part

- alias: Set Schlage Lock Options
  trigger:
    - platform: state
      entity_id:
        - input_select.lock_zwave_option_3
        - input_select.lock_zwave_option_4
        - input_select.lock_zwave_option_5
        - input_select.lock_zwave_option_7
        - input_select.lock_zwave_option_8
        - input_select.lock_zwave_option_9
        - input_select.lock_zwave_option_10
        - input_select.lock_zwave_option_11
        - input_select.lock_zwave_option_15
        - input_select.lock_zwave_option_16
  action:
    - service: zwave.set_config_parameter
      data_template:
        node_id: 104
          
        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[4]) |int) %}
          {{ parameter }}

The value for {{ parameter }} always comes back as 0, but in the HA front end template testing, it comes up as 3, 4, 5, etc… Of course in the template test area I dont have a trigger_to state… so I just end up putting the input_select directly in the set object_id for testing. Any help or guidance is appreciated

End up figuring it out? Looking forward to trying this out as soon as I install my Schlage deadbolt.

I never did, and the got sidetracked. I even posted a seperate post just asking for help with the automation as a whole. Bottom line

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[4]) |int) %}
          {{ parameter }}

Should parse the triggered input select and pull the # from the end. It’s pulling a ‘0’, so I know there is something wrong with my logic. I’m not sure if I’m fully understanding the trigger.to_state.object_id properly.

I’ve tried making the assumption that it is

input_select.lock_zwave_option_16
as well as

lock_zwave_option_16

Either way, i’ve had no luck. Might just me the way I’m trying to to the join. I copied this from another automation and tried to get it to work.

I got pulled away from this, but was hoping someone might be able to give this a fresh set of eyes. This is just an issue with me not understanding what is being returned with “trigger.to_state.object_id”, so when I try to parse the value using “(”".join(object_id.split("")[4]) |int)", I always seem to get a ‘0’ for the value.

When I use the editor, I have to put a static value for trigger.to_state.object_id, which works in the editor. I suspect that what is being returned is not what I think it should be. Probably just me not understanding what’s going on behind the scenes, and not sure how to see.

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[4]) |int) %}
          {{ parameter }}

Try:

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[3]) |int) %}
          {{ parameter }}

I’ll definitely try that. I came across this today, and suspect there may be a bug as well. In this post it looks like the underscores may be getting stripped out, which would make sense. I’m going to do some testing tonight

So, I’m trying to debug, still not working, but it looks like it should work
Here is the action

  action:
    - service: zwave.set_config_parameter
      data_template:
        node_id: 104
          
        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[3]) | int ) %}
          {{ parameter }}

        value: >-
          {{ trigger.to_state.state }}
          
    - service: script.sms_notify_with_images
      data_template:
        service: notify.sms_me
        title: "Testing of zwave entities"
        message: "
       
         1: {{ trigger.to_state.state }}
         
         
         2: {{ trigger.to_state }}
         
         
         3: {{ trigger.from_state.attributes.friendly_name }}
         
         
         4: {{ trigger.to_state.attributes.friendly_name }}
         
         
         5: {{ trigger.from_state.entity_id }}
         
         
         6: {{ trigger.to_state.object_id }}
             
         
         {% if trigger.entity_id == 'lnput_select.lock_zwave_option_3' %}
         7: WORKING
         {% endif %}          
                 
       {{now().strftime('%Y-%m-%d %H:%M:%S')}}" 

So I’m getting a mesage confirming that

         5: {{ trigger.from_state.entity_id }} is input_select.lock_zwave_option_3
         
         
         6: {{ trigger.to_state.object_id }} is lock_zwave_option_3

If I manually use those in the template test area the value returned from

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[3]) | int ) %}
          {{ parameter }}

is in fact 3, which is what I need it to be.

But when the automation runs I get this error every time regardless if how I try to get a value of 3

Error executing service <ServiceCall zwave.set_config_parameter (c:78bd5b4dbe01425f807574698b3ae66a): node_id=104, parameter=0, value=Enable Beeper, size=2>

it continues to get a parameter of 0, I tried removing the | int, thinking maybe it needed ascii, but then got an error saying it expected an int, which is what I figured.

Anyway, why does this continue to return a value of ‘0’

Change it back to [4] using [3] returns 0 :sweat:

I’ve tried 3 and 4. I’ve tried different ways of getting entity or object. Always shows 3 in the template test area and 0 when it actually runs.

so this Entity ID returns 0

        parameter: >-
          {% set object_id = 'trigger.to_state.entity_id' %}
          {% set parameter = ("_".join(object_id.split("_")[4]) | int ) %}
          {{ parameter }}

and this object ID

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = ("_".join(object_id.split("_")[3]) | int ) %}
          {{ parameter }}

returns 0

give this a shot maybe:

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set parameter = "_".join(object_id.split("_")[4]) %}
          {{ parameter | int }}

That method is from the locks package, seems to work in those scripts/automations.

:frowning: thought that might be the solution, still :frowning: received the error about the value being ‘0’

Wondering if this might help:

        parameter: >-
          {% set object_id = "trigger.to_state.object_id" %}
          {% set test = "_".join(object_id.split("_")[4]) %}
          {{ test | int }}

Maybe you can’t use a variable with a name the same as the data for the service call?

That was a great idea. Unfortunatly, did not make a difference. So weird

Have not been able to figure out how to split this correctly, I’m going to have to do something like this in the meantime.

- alias: Set Schlage Lock Options
  trigger:
    - platform: state
      entity_id:
        - input_select.lock_zwave_option_3
        - input_select.lock_zwave_option_4
        - input_select.lock_zwave_option_5
        - input_select.lock_zwave_option_7
        - input_select.lock_zwave_option_8
        - input_select.lock_zwave_option_9
        - input_select.lock_zwave_option_10
        - input_select.lock_zwave_option_11
        - input_select.lock_zwave_option_15
        - input_select.lock_zwave_option_16
  action:
    - service: zwave.set_config_parameter
      data_template:
        node_id: 104
          
        parameter: >-
        {% if trigger.entity_id == 'input_select.lock_zwave_option_3' %}
          3
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_4' %}
          4
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_5' %}
          5
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_7' %}
          7
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_8' %}
          8
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_9' %}
          9
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_10' %}
          10
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_11' %}
          11
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_15' %}
          15
        {% elif trigger.entity_id == 'input_select.lock_zwave_option_16' %}
          16
        {% else %}
          0
        {% endif %}
        value: >-
          {{ trigger.to_state.state }}

Maybe templates don’t work in zwave service calls…
Might be a bug, did you report it?

Not yet, still trying to understand what’s going on. Thats a good idea about templates and service calls. Will do some more tesitng

Here is the working automation, input selects, and groups to set your lock options via front end vs the zwave control panel. I have not tested every single option, but I’ve tested most.

Automation

- alias: Set Schlage Lock Options
  trigger:
    - platform: state
      entity_id:
        - input_select.lock_zwave_option_3
        - input_select.lock_zwave_option_4
        - input_select.lock_zwave_option_5
        - input_select.lock_zwave_option_7
        - input_select.lock_zwave_option_8
        - input_select.lock_zwave_option_9
        - input_select.lock_zwave_option_10
        - input_select.lock_zwave_option_11
        - input_select.lock_zwave_option_15
        - input_select.lock_zwave_option_16
  action:
    - service: zwave.set_config_parameter
      data_template:
        node_id: 104  #enter your node ID here
          
        parameter: >-
          {% if trigger.entity_id == 'input_select.lock_zwave_option_3' %}
            3
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_4' %}
            4
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_5' %}
            5
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_7' %}
            7
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_8' %}
            8
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_9' %}
            9
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_10' %}
            10
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_11' %}
            11
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_15' %}
            15
          {% elif trigger.entity_id == 'input_select.lock_zwave_option_16' %}
            16
          {% else %}
            0
          {% endif %}

        value: >-
          {{ trigger.to_state.state }}

Input selects

  lock_zwave_option_3:
      name: Enable or disable the beeper.
      options:
          - Enable Beeper
          - Disable Beeper

  lock_zwave_option_4:
      name: Prevents all user codes from unlocking the deadbolt
      options:
          - Disable Vacation Mode
          - Enable Vacation Mode

  lock_zwave_option_5:
      name: Press the Outside Schlage Button to lock the deadbolt
      options:
          - Enable Lock & Leave
          - Disable Lock & Leave

  lock_zwave_option_7:
      name: Alarm sounds based on door activity
      options:
          - Alarm Off
          - Activity
          - Tamper
          - Forced Entry

  lock_zwave_option_8:
      name: Activity Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_9:
      name: Tamper Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_10:
      name: Forced Entry Alarm Sensitivity
      options:
          - Medium Sensitivity
          - Most Sensitive
          - Medium/high Sensitivity
          - Medium/low Sensitivity
          - Least Sensitivity

  lock_zwave_option_11:
      name: Disable Local Alarm Controls
      options:
          - Enable local alarm controls
          - Disable local alarm controls

  lock_zwave_option_15:
      name: Auto lock
      options:
          - Disable auto lock
          - Enable auto lock

  lock_zwave_option_16:
      name: User code pin length (changing Lenth erases all codes)
      options:
          - 4
          - 5
          - 6
          - 7
          - 8

group

zwave_door_lock_options:
  name: zwave configs for schlages
  view: no
  entities:
    - input_select.lock_zwave_option_3
    - input_select.lock_zwave_option_4
    - input_select.lock_zwave_option_5
    - input_select.lock_zwave_option_7
    - input_select.lock_zwave_option_8
    - input_select.lock_zwave_option_9
    - input_select.lock_zwave_option_10
    - input_select.lock_zwave_option_11
    - input_select.lock_zwave_option_15
    - input_select.lock_zwave_option_16

As soon as you change an option it sends the zwave change to the lock. Be careful with the PIN length, as changing it will erase all codes.

If anyone wants to play with this to make it work with multiple locks, please share.

Enjoy!

I believe this should work for you,look at my last post for updated code

2 Likes