Zwave Lock Manager

Nope, I would delete the sensor. Just have not had a chance to update my package. Thanks for testing the automation. So the input_text does stay as it should, right?

@ptdalen

Thanks for this great share, what would be even more cool than what you have already put together, is to delete the code and auto generate / add a new random code with a notification of new code.

1 Like

As far as I can tell, input_text.frontdoor_code hasn’t changed. Home Assistant shows “unknown” and I have a change state debug node in Node-Red that doesn’t appear to change when I enter a code.

Edit: Looking, at the states developer tool, the automation is being fired off correctly but no name is being saved in input_text

Strange, my Kwikset lock will tell me “Manually unlocked” (not the exact status) when the lock is manually locked/unlocked, and not a user number.

I was speaking in reply to an issue with one of the sensors I have in the locks package. It pulls the alarm level sensor value which is the code slot, and then uses that value to pull an input text. The input text becomes the value of the sensor. And the input text is the friendly name of the code slot.

Then you use the sensor where ever you want to say “Door unlocked by Bob”, etc.

But what I did not realize until recently is that when the door is manually locked, the alarm level (code slot) changes back to 1. Not sure if all locks do that, or just the schlage.

I don’t know much about node red, but the logic in the automation looked to be correct. At least in my template test area. I probably wont get around to implementing this in my setup for a bit, but I feel like it should be correct, or almost correct. Feel free to tweak/test and share what you find. Maybe the logic here is a bit off

  - service: input_text.set_value
    data_template:
      entity_id: input_text.frontdoor_code
      value_template: >

After playing around with it, it didn’t like value_template. After modifying that line, the automation I am using below is working 100% for me. Thanks for the help!

  - alias: Set Last Person to unlock with Keypad (Front Door)
    trigger:
    - platform: template
      value_template: "{{ states.lock.lock_front_door_lock.attributes.notification == 'Keypad Unlock' }}"
    action:
    - service: input_text.set_value
      data_template:
        entity_id: input_text.frontdoor_code
        value: >
          {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
          {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
          {% set user = 'Master' if number == '0' else states(entity_id) %}
          {{ user }}
1 Like

Thanks for the detailed response. Super helpful. I did have a thought. How long do you have your usercodes set to?

This is the code for “clearing a usercode”

      - service: lock.set_usercode
        data_template:
          usercode: >-
            {{ range(1000, 9999) | random }}

Basically it’s setting a 4 digit code between 1000 and 9999. Since everything else seems to be working, I was wondering if maybe you had longer codes configured for your deadbolt. If so you’d just need to change the range to (100000, 999999) for 6 digits, or however many digits you have configured.

I’m hoping that’s the issue, because it looks to me like everything is configured correctly. If this was not the issue, I’d say check your zwave logs at the time the random code is trying to be set, that would be helpful.

Ah right, that’s because the alarm level is 1 when the alarm type is 21 (Lock Secured using Keyed cylinder or inside thumb-turn) maybe add a conditional that if alarm type is 21 make the user display “Manual” or something similar?

Exactly. Actually I believe the automation above solves the issue. The goal of the automation for me was just to show which person was the last person to unlock the door with a code. Then that could be used in other automations. Like alerts or maybe tts, etc. there is another sensor in the package that is used to show different details like manual, keypad lock, etc

Thanks for the assist. I put this in my package and have commented out the sensors for the moment. I did find during my testing that using the notification attribute seemed to be a bit slow, or maybe it was just my network. Either way I changed the trigger to use alarm type for keypad unlock and also added a 1 second delay just to make sure the user code had been reported. So far so good.

  - alias: Set Last Person to unlock with Keypad (Front Door)
    trigger:
    - platform: template
      value_template: "{{ states('sensor.lock_front_door_deadbolt_alarm_type') | int == 19 }}"
    action:
    - delay:
        seconds: 1
    - service: input_text.set_value
      data_template:
        entity_id: input_text.frontdoor_code
        value: >
          {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
          {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
          {% set user = 'Master' if number == '0' else states(entity_id) %}
          {{ user }}

For anyone trying to get this working - I spent several evenings trying to figure out why none of the automations in the package would work. Turns out you have to add initial_state: true to them all.

automation:
  - alias: Keypad switch turned on
    initial_state: true
    trigger:
      - platform: state

You don’t have the set the initial state to true, but if you want to make sure your automations (true with any automation) is always on after a restart then do so. Makes sense to me for these though.

I was thinking about making the move from Wink to a HUSBZB-1, does anyone have any insight on how well the Schlage BE469 would work with it? And how difficult it is to setup. Also it is very important to me that I can get which user code unlocked the door into HA for many of my automations is this possible with a ZWave stick and HA? Thanks in advance

I have a HUSBZB-1 and three schlage locks (2 be469 and an FE599), they all work well. Adding the lock to HA is as easy as adding any zwave device. I wont go into detail on adding zwave devices, they are plenty of guides and posts on that. There is a sensor that returns a value for the user slot used to unlock a door, which you can use for your automations, etc. The package that is refrenced here is not required at all to lock, unlock, get code slots, program codes, etc. But it does make it more UI based.

The only “issue” at the moment is an Open Zwave issue regarding clearing of user codes. The schlage locks seems to have problems with clear user code commands. There is a fix, it just has not been reviewed/added to the HA open-zwave yet. The fix for clearing user codes at the moment, is to overwrite with a different code.

Ok great thanks for the input… what do you think about the range of the HUSBZB-1 as my nuc is in my basement so I have concerns about it reaching the garage and my front door lock. My wink hub is in the office which is almost in the same spot but one floor up I just wasn’t sure if the foundation walls would hinder the signal a little.

There are several people on this thread who have had issues with this lock and this usb stick when it comes to range. It seems to be that it mostly has to do with the zwave mesh you have. I have many powered zwave devices and have no issues with any of them, including the locks. If you only have a couple zwave devices, I think there is a decent chance you’ll have range issues. if you have plenty of zwave devices between the lock and the stick, you should be good

Hey @kevinduong I followed your instructions was able to clone the repo, export and uninstall homeassistant-pyozw==0.1.4 (the current version) but when I try to reinstall I get:

`bash-4.4# pip install homeassistant-pyozw==0.1.4 --no-cache-dir --no-deps --install-option="–flavor=dev"
/usr/local/lib/python3.7/site-packages/pip/internal/commands/install.py:207: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting homeassistant-pyozw==0.1.4
Downloading https://files.pythonhosted.org/packages/2e/48/ffc8e03c7249a68bdf35bc5e9fa2af2222acab16eb4f0022d7626c34e83a/homeassistant_pyozw-0.1.4.zip (147kB)
100% |████████████████████████████████| 153kB 7.1MB/s
Installing collected packages: homeassistant-pyozw
Running setup.py install for homeassistant-pyozw … error
Complete output from command /usr/local/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-lfrojk_o/homeassistant-pyozw/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-7hfz97s
/install-record.txt --single-version-externally-managed --compile –flavor=dev:
sysargv [’-c’, ‘install’, ‘–record’, ‘/tmp/pip-record-7hfz97s_/install-record.txt’, ‘–single-version-externally-managed’, ‘–compile’, ‘–flavor=dev’]
Found SETUP_DIR : /tmp/pip-install-lfrojk_o/homeassistant-pyozw
<pyozw_setup.EmbedTemplate object at 0x7fa60cc28e48>
{‘name’: ‘libopenzwave’, ‘sources’: [‘openzwave-embed/open-zwave-hass/python-openzwave/src-lib/libopenzwave/libopenzwave.cpp’], ‘include_dirs’: [‘src-lib/libopenzwave/’, ‘openzwave-embed/open-zwave-hass/cpp/src’, ‘openzwave-embed/open-zwave-hass/cpp/src/value_classes’, ‘openzwave-embed/open-zwave-hass/cpp/src/platform’, ‘openzwave-embed/open-zwave-hass/cpp/build/linux’], ‘define_macros’: [(‘PY_LIB_VERSION’, ‘0.1.4’), (‘PY_SSIZE_T_CLEAN’, 1), (‘PY_LIB_FLAVOR’, ‘embed’), (‘PY_LIB_BACKEND’, ‘cpp’)], ‘libraries’: [‘udev’, ‘stdc++’, ‘resolv’], ‘extra_objects’: [‘openzwave-embed/open-zwave-hass/libopenzwave.a’], ‘extra_compile_args’: [], ‘extra_link_args’: [], ‘language’: ‘c++’}
[‘six’, ‘PyDispatcher>=2.0.5’]
invalid command name ‘–flavor=dev’

----------------------------------------

Command “/usr/local/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-lfrojk_o/homeassistant-pyozw/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-7hfz97s_/install-record.txt --single-version-externally-managed --compile –flavor=dev” failed with error code 1 in /tmp/pip-install-lfrojk_o/homeassistant-pyozw/
`

Any suggestions?

Make sure it is

--flavor=dev" 

at the end.
For some reason the copy/paste does not work well for that . Also as a side note, my fork is a bit outdated. You may want to make your own fork.

Still getting an error:
`bash-4.4# pip install homeassistant-pyozw==0.1.4 --no-cache-dir --no-deps --install-option="–flavor=dev"
/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py:207: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
cmdoptions.check_install_build_global(options)
Collecting homeassistant-pyozw==0.1.4
Downloading https://files.pythonhosted.org/packages/2e/48/ffc8e03c7249a68bdf35bc5e9fa2af2222acab16eb4f0022d7626c34e83a/homeassistant_pyozw-0.1.4.zip (147kB)
100% |████████████████████████████████| 153kB 1.4MB/s
Installing collected packages: homeassistant-pyozw
Running setup.py install for homeassistant-pyozw … error
Complete output from command /usr/local/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-3jx9ps5w/homeassistant-pyozw/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-r1ee1r91/install-record.txt --single-version-externally-managed --compile --flavor=dev:
sysargv [’-c’, ‘install’, ‘–record’, ‘/tmp/pip-record-r1ee1r91/install-record.txt’, ‘–single-version-externally-managed’, ‘–compile’]
Found SETUP_DIR : /tmp/pip-install-3jx9ps5w/homeassistant-pyozw
<pyozw_setup.DevTemplate object at 0x7f56f499fa58>
Fail to install minimal dependencies Cython
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-3jx9ps5w/homeassistant-pyozw/setup.py”, line 42, in
print(current_template.ctx)
File “/tmp/pip-install-3jx9ps5w/homeassistant-pyozw/pyozw_setup.py”, line 226, in ctx
self.finalize_context(self._ctx)
File “/tmp/pip-install-3jx9ps5w/homeassistant-pyozw/pyozw_setup.py”, line 247, in finalize_context
ctx[‘define_macros’] += [(‘PY_LIB_FLAVOR’, self.flavor.replace(’–flavor=’,’’))]
TypeError: ‘NoneType’ object is not subscriptable

----------------------------------------

Command “/usr/local/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-install-3jx9ps5w/homeassistant-pyozw/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-r1ee1r91/install-record.txt --single-version-externally-managed --compile --flavor=dev” failed with error code 1 in /tmp/pip-install-3jx9ps5w/homeassistant-pyozw/`

Not sure how I would “make my own fork”