raman325 / lock_code_manager

Lock code manager for locks integrated with Home Assistant
MIT License
43 stars 5 forks source link

Integration making zwave locks unavailable #139

Open pdobrien3 opened 7 months ago

pdobrien3 commented 7 months ago

What happened?

I have been having issues with locks dropping off the zwave network using lock code manager. After playing a bit, I decided to start listening to zwave_js_notification lock events. What I am seeing is(event_label == 'New user code added') followed by (event.data.event_label == 'New user code not added due to duplicate code')

It is not happening on every code slot or every lock and seems to be pretty random.

I have noticed that if I go into the ZwaveJS UI and set a fake code on the slot I can get all the slots sync'ed, otherwise the integration continues until the lock goes unavailable or times out. Activating the lock usually brings it back

Steps to reproduce the issue

1. 2. 3. ...

Home Assistant Version

2024.4.0

What version of Lock Code Manager are you running?

0.4.5

Lock make and model

Kwikset 916 Zwave

Relevant log output

No response

Screenshots

No response

Anything else?

No response

raman325 commented 7 months ago

do you know if this happens on startup? at random times? When the code is supposed to go from inactive to active?

pdobrien3 commented 7 months ago

i think it is any time the lock is not sync'd. defiantly at startup. and it seems like it times out trying at startup. i have 6 different codes on 3 different locks. i have also noticed locks go unavailable when the locks should be going from inactive to acrive so i would suspect then also.

flyize commented 6 months ago

I just started using this and I'm seeing my locks and code slots showing as unavailable in the Lock Code Manager dashboard randomly, and for sure at startup.

Not sure if that is related. No errors in the logs (just the depreciation warnings).

raman325 commented 5 months ago

is this still an issue on the latest version? @pdobrien3 let me know if you see an improvement

fxfitz commented 4 months ago

Well, I noticed this once. This is my first time trying to get Lock Code Manager up and running through (still overall unsuccessful).

Noticed this in the logs:


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 809, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/lock_code_manager/__init__.py", line 298, in async_unload_entry
    await async_unload_lock(hass, config_entry)
  File "/config/custom_components/lock_code_manager/__init__.py", line 276, in async_unload_lock
    coordinator: LockUsercodeUpdateCoordinator = hass_data[COORDINATORS].pop(
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'lock.front_door_new_lock'

2024-06-18 06:21:25.967 INFO (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Creating and/or updating entities
2024-06-18 06:21:25.968 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Adding following locks: ['lock.front_door_new_lock']
2024-06-18 06:21:25.968 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Reusing lock instance for lock ZWaveJSLock(domain=zwave_js, lock=lock.front_door_new_lock)
2024-06-18 06:21:25.968 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 1 seconds before retrying
2024-06-18 06:21:26.970 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 2 seconds before retrying
2024-06-18 06:21:28.971 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 4 seconds before retrying
2024-06-18 06:21:32.973 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 8 seconds before retrying
2024-06-18 06:21:39.569 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 64 seconds before retrying
2024-06-18 06:21:40.974 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 16 seconds before retrying
2024-06-18 06:21:56.977 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 32 seconds before retrying
2024-06-18 06:22:06.715 DEBUG (MainThread) [custom_components.lock_code_manager] aa6543708b411ce25f53919c4da15db7 (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 180 seconds before retrying
2024-06-18 06:22:28.979 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 64 seconds before retrying
2024-06-18 06:22:43.570 DEBUG (MainThread) [custom_components.lock_code_manager] c1e144d3e2a8cb4c19ab7f4b2cbdbb1f (House Locks): Lock lock.front_door_new_lock is not connected to Home Assistant yet, waiting 128 seconds before retrying```

Note: lock.front_door_new_lock definitely is connected at this time.
pdobrien3 commented 4 months ago

nothing ever happened for me. i added the integration a couple days ago, several hass restarts, and nothing. i havent had any entities populate or anything.

fxfitz commented 4 months ago

That's basically where I am too, @pdobrien3.

Curious if you were to enable debug logging, are you seeing a <lock entity> is not connected to Home Assistant yet, waiting XXX seconds before retrying message similar to mine? (note: my lock is definitely connected to HA, and I'm able to control it)

pdobrien3 commented 4 months ago

yesterday I started having connection problems with my locks so I deleted the integration.

raman325 commented 4 months ago

yeah unfortunately something the integration is doing is knocking the locks offline. I suspect I'm queuing up a bunch of commands to the lock and at some point they get overwhelmed and go dead? idk, but until this is fixed this integration is not usable

flyize commented 4 months ago

My locks show connected just fine, but all the slots are showing as unavailable. Not sure if that helps...

uSlackr commented 4 months ago

This is my case.

\Greg


From: flyize @.> Sent: Monday, June 24, 2024 9:16:43 AM To: raman325/lock_code_manager @.> Cc: Subscribed @.***> Subject: Re: [raman325/lock_code_manager] Integration making zwave locks unavailable (Issue #139)

My locks show connected just fine, but all the slots are showing as unavailable. Not sure if that helps...

— Reply to this email directly, view it on GitHubhttps://github.com/raman325/lock_code_manager/issues/139#issuecomment-2186561381, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGEO6ZZ7MVZVP2Y73GMJOZLZJAL3XAVCNFSM6AAAAABFXUEDBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWGU3DCMZYGE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

bwarden commented 4 months ago

Grasping at straws here, but tracing through the code leading up to the "...is not connected to Home Assistant..." message, I decided to dump the data used here; https://github.com/raman325/lock_code_manager/blob/6aef53ac6c69db89fadff052f440aba9336b8734/custom_components/lock_code_manager/providers/zwave_js.py#L145-L162 My lock's runtime_data looks like this:

{
  'client': Client(ws_server_url='ws://localhost:3009', connected),
  'driver_events': <homeassistant.components.zwave_js.DriverEvents object at 0x7f7b2602d070>,
  'client_listen_task': <Task pending name='Task-342' coro=<client_listen() running at /srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/zwave_js/__init__.py:916> wait_for=<Future pending cb=[Task.task_wakeup()]>>,
  'start_client_task': <Task finished name='Task-341' coro=<start_client() done, defined at /srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/zwave_js/__init__.py:194> result=None>
}

client has no driver member; maybe because I'm running node-zwave-js in a snap and connecting Home Assistant to it via websocket?

ETA: I think the "...is not connected..." message and failure of this integration to configure the locks is a separate issue from the locks themselves becoming unavailable.

broyuken commented 2 months ago

I have a similar issue where my lock goes unavailable when my automation triggers it to lock. It comes back a few seconds later but the lock command fails. I think this MAY happen after I’ve added a new code that needs to get pushed to the lock or something but I haven’t been able to confirm that yet.