ZacheryThomas / homeassistant-smartrent

Home Assistant Custom Component for SmartRent Locks 🔐, Thermostats 🌡, Sensors 💧 and Switches💡
MIT License
84 stars 3 forks source link

Lock state doesn't update until refresh #20

Closed nickvigilante closed 1 year ago

nickvigilante commented 1 year ago

Great job on this integration! It's been a dream to work with for my thermostat, lights, and sensors. I'm super appreciative of the work you've put in to this.

I noticed when I first started using it that my lock state would update shortly after triggering a lock/unlock. Now I notice that while the lock/unlock of my door happens, the state doesn't update unless I reload the integration entries (and only the last lock/unlock action is returned). I unfortunately don't remember the timeline of when my last update had occurred in comparison to when I last saw the entity update, but I suspect it happened due to upgrading core and supervisor to the latest version. What I've done to troubleshoot:

Note: locking and unlocking still work, but the latest doesn't get sent back to HA until a manual reload/restart.

Here's what I'm running:

Home Assistant 2023.6.3 Supervisor 2023.06.4 Operating System 10.3 Frontend 20230608.0 - latest

ZacheryThomas commented 1 year ago

Glad to hear you are enjoying the integration so far!

Would you be able to get some logs of the integration running? You should be able to change your configuration.yaml to get logs from my integration, that way I can get a better idea of whats goin on. Here's an example of what that would look like: https://github.com/ZacheryThomas/homeassistant-smartrent/blob/main/config/configuration.yaml#L19

nickvigilante commented 1 year ago

Here's what I see in the core logs:

2023-07-03 16:07:03.449 INFO (MainThread) [smartrent.utils] sending payload ["null", "null", "devices:3389619", "update_attributes", {"device_id": 3389619, "attributes": [{"name": "locked", "value": "false"}]}]
2023-07-03 16:07:03.608 INFO (MainThread) [smartrent.utils] Joining topic for Front Door - Lock:3389619 ...
2023-07-03 16:09:12.667 INFO (MainThread) [smartrent.utils] sending payload ["null", "null", "devices:3389619", "update_attributes", {"device_id": 3389619, "attributes": [{"name": "locked", "value": "false"}]}]
2023-07-03 16:09:12.813 INFO (MainThread) [smartrent.utils] Joining topic for Front Door - Lock:3389619 ...

This is after attempting to activate the lock twice. Let me know if I can try anything else!

nickvigilante commented 1 year ago

home-assistant_2023-07-03T20-23-36.562Z.log

Full log from today

ZacheryThomas commented 1 year ago

@nickvigilante thanks for the logs! Thats super helpful.

Nothing looks super out of the ordinary tbh. Like the commands that are getting sent to the lock work fine, its just that something is getting lost from either the lock to Smartrent or Smartrent isn't broadcasting your locks events.

If you are comfortable running python stuff you can try using this script to help me debug things: https://github.com/ZacheryThomas/smartrent.py/tree/main#adding-unsupported-devices

This should at least let us connect to Smartrent's websocket in a simpler way and see if we get any events when you lock and unlock your lock. Let me know if you have any questions or run into any issues!

nickvigilante commented 1 year ago

device_helper.log

I see at the very bottom that when I attempted to unlock and relock my door, it printed {'online': True}:

Joining topic for LOCK_ID...
{'response': {}, 'status': 'ok'}
{'online': True}
{'online': True}
ZacheryThomas commented 1 year ago

Lets try out somethin else. If you go to the web ui for smartrent (https://control.smartrent.com/resident) and you physically unlock/lock your door, does the lock ui change to reflect the actions you do?

nickvigilante commented 1 year ago

You might be on to something with that suggestion. I click Unlock and I hear the door unlock within 2 seconds, but the UI doesn't update to reflect this, even after refreshing the page. I'm gonna get in touch with their support. Thank you for helping me troubleshoot!

ZacheryThomas commented 1 year ago

No problem! Let me know if they figure out whats up. Im curious to see what they come up with. This is my first time seeing this issue tbh

nickvigilante commented 1 year ago

Will do! I think it might be an issue on their end, because I just restarted my SmartRent hub to no avail.

nickvigilante commented 1 year ago

Hey Zach, thanks again for your help earlier with the app. I finally got around to calling Support to un-pair and re-pair the lock to my SmartRent hub, and it fixed the problem. The status reports back immediately. Definitely was not anything wrong with the integration. Thank you!