Zwave Lock Manager

I get that error while trying to guess my way too. It probably spacing, quotes, or something like that. I have not tested this but generally you want this

          usercode: >-
            {% set object_id = trigger.to_state.object_id %}
            {% set code_slot = "_".join(object_id.split("_")[2:-2]) %}
			{% if code_slot < 10 %}
			  {% set user_code = '1234567' + "_".join(object_id.split("_")[2:-2]) %}
		    {% else %}
			  {% set user_code = '123456' + "_".join(object_id.split("_")[2:-2]) %}
			{% endif %}
            {{ user_code }}

That would give you 12345671 for slot 1 thru 12345679 for slot 9, and 12345610, thru 12345699 for slot 99

Figured out the issue, the code_slot value needs to be case as an integer for the if statement to read correctly. simple fix, just add ā€œ|intā€ to the end of the join statement for the code_slot

      usercode: >-
        {% set object_id = trigger.to_state.object_id %}
        {% set code_slot = "_".join(object_id.split("_")[2:-2])|int %}
		{% if code_slot < 10 %}
		  {% set user_code = '1234567' + "_".join(object_id.split("_")[2:-2]) %}
	    {% else %}
		  {% set user_code = '123456' + "_".join(object_id.split("_")[2:-2]) %}
		{% endif %}
        {{ user_code }}
1 Like

good deal, Let me know if that works for you with your lock.

Values are correctly getting set via the front end code you built. will verify when i get home that the codes are indeed unusable.

image

So since I dont know much about the kwikset lock, I guess I have a couple of question.

can you set the code length?
What are the options 4-8, would be my guess?
If you can set a longer code length, this solution may not work, right?

The documentation for the Kwikset says i can set a code between 4-6 digits. although from zwave, i can set a 7 digit code and it still works.

However settings and 8 digit code, though it stores the value, it does not seem to register in the door, as entering the 8 digits code just provides an immediate wrong code beep

I submitted an issue for HA for this issue, if you add some comments with your lock and details i might help move it up in priority

https://github.com/home-assistant/home-assistant/issues/22464

Might want to put that under the openzwave hass branch instead:

Weirdly enough, either Iā€™m missing something, or I dont have permissions to submit an issue. I cannot see any current issues, nor can I find where to submit an issue? Iā€™m sure itā€™s me though.

Also this is not a python-openzwave issue as much as it is a open-zwave issue

is the actual file that needs to be updated/fixed. I still cannot seem to find any area to submit an issue

Ya looks like they have the issues options disabled on the different repos theyā€™ve forked, likely handling all via the main HA repo then.

Found the open-zwave fork HA has:

I keep getting the following:

Invalid config for [automation]: required key not provided @ data[ā€˜actionā€™]. Got None
required key not provided @ data[ā€˜triggerā€™]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/

even if I repull and change entities to your names. Thoughts?

And just like that. I had no automations, there is a bug that requires at least one. I put the following in my automations:

  • action: []
    id: DUMMY
    alias: DUMMY Can Be Deleted After First Automation Has Been Added
    hide_entity: no # default no, hide from UI
    condition: []
    trigger: []
1 Like

95% likely you have a yaml typo somewhere. Most likely spacing. Iā€™m not familiar with any bugs requiring an automation. If youā€™re looking for formatting help, please try to post your yaml using the code formatting.

Thanks for this, I was really hesitant to move my lock off of Smartthings because of the rboy app but this made that choice easy.

However, I am pulling my hair out trying to get the delete code and temporary codes working. I know I am doing something wrong, I just canā€™t figure out what. I am using the single lock file and I can set codes just fine. However, the temporary codes never clear anything out after the time period expires nor do they appear to set the codes either. They just sit there like an inactive code. If I set it to an Always code it works fine.

I have a Schlage lock and I have not switched anything out with openzwave so I believe I have commented and uncommented the correct things. I uncommented lines 111-114, 117-125 while commenting out lines 126-136. Iā€™ve also uncommented 235-239 and 241-245 and commented out lines 247-258. I named all of my entities identical to what you said in the top comment, I believe I have changed the node IDs that needed to be changed but it just will not work.

I feel like I probably screwed something up with the commenting/uncommenting but I canā€™t for the life of me figure out what. Do you have any sort of guidance or something you can point me to to help figure this out? I am fairly new to Home Assistant and by no means am a professional programmer or experienced in yaml but I am pretty resourceful but I am at a total loss at this point. Thank you!

No worries, uncomment 111-126, then comment out 127-136. uncomment 238-252, then comment 253-260. Unless youā€™ve updated your open zwave (I stopped doing that, it was too much continued work), you need to just set random codes at the moment. The clear code does not work with schlage and some other brands at the moment. I feel like the risk of setting a random code for a slot or two is very minimal.

As far as the temp codes, did you set a start and end time. Basically the temp code will not ā€œactivateā€ until the start time, then will clear at the end time. So make sure to do it in this order. So for testing, Set the name, the code, the start a few minutes in the future, the end time, then turn on the switch.

Its been a while since I set the temp codes, but Iā€™m pretty sure that was the process.

Are you seeing any errors in the log? Is it setting codes, but just not clearing the codes?

So I did comment the right stuff out previously (some of my line numbers were off as I deleted things like the extra notification email address). Iā€™m not seeing any errors in the log related to the lock stuff as far as I can tell. It doesnā€™t delete the codes at all from the lock, it clears the info out in the Home Assistant user interface but I can still use the code in the lock to unlock. If I set up a different code in the same slot, the old code goes away and the new one works.

As far as the temp codes go, they arenā€™t being set at all and then arenā€™t clearing at all either. Nor does the notification fire. It is almost like that whole section does not exist.

So it does set a code, just does not clear it, right? Schalge Lock?

lines 111-126 look exactly like this

      - service: lock.set_usercode
        data_template:
          usercode: >-
            {{ range(1000, 9999) | random }}
# if your lock does not end in "door_lock" ie. often its "door_locked" change line 3 below to match
# no other things should need to be changed
          node_id: >-
            {% set object_id = trigger.to_state.object_id %}
            {% set lock_name = "_".join(object_id.split("_")[3:-1]) %}
            {% set lock_id = 'lock_' ~ lock_name ~ '_door_lock' %}
            {{ states['lock'][lock_id].attributes.node_id }}

          code_slot: >-
            {% set object_id = trigger.to_state.object_id %}
            {% set code_slot = "_".join(object_id.split("_")[2:-2]) %}
            {{ code_slot }}

and your lock is named -

lock.lock_front_door_lock

You can just hard code the node_id: since you only have one lock (82 for example)

          node_id: 82

I have a Schlage lock and if the Access Schedule is set to Always the code sets just fine. However, if I hit the Execute for the delete door code, the code does not delete. The information in the UI clears out but the code sticks with the lock. If I set up another code in that slot it clears the old code and replaces it with the new one.

If I set a Temporary Code no code gets set on the lock at all when the start time hits. The information does not get cleared off of the UI when the expiration time passes either. It acts as if nothing happens.

I double checked my package file and those lines are identical to mine.

My lock is named lock.lock_front_door_lock.

Iā€™ll try hardcoding the node when I get home and see what happens. Thanks again for your help on this, I really appreciate you taking the time to try and help me solve this issue.

Glad to help. Sounds like itā€™s mostly right. Iā€™m sure weā€™ll get it. Double check to make sure youā€™re using

service: lock.set_usercode

to not clear user code. Since that wont work. The work around to set a random # should work, but Itā€™s been a while since I ā€œclearedā€ a code, so I will also verify when I get home

Yes, I am using lock.set_usercode to clear codes.