Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Door Position Sensor "Unavailable" #103

Closed
vincearnold opened this issue Feb 17, 2025 · 8 comments
Closed

Door Position Sensor "Unavailable" #103

vincearnold opened this issue Feb 17, 2025 · 8 comments
Labels
bug Something isn't working

Comments

@vincearnold
Copy link

Hello! Love the integration so far, it's been working great! Thank you for all your work.

Describe the bug
I've recently had my Door Position Sensor stop reporting it's state to HomeAssistant.
I can see the events sucessfully in Access logs, but my device state either doesn't respond, or shows "Unavalable"

Which Hub are you using

  1. Unifi Access Hub

Screenshots
Image

Image

Versions:

  • Home Assistant version:
Core: 2025.2.4
Supervisor: 2025.02.1
Operating System: 14.2
Frontend: 20250214.0
  • Unifi Access version (Go to settings in your Unifi Access web interface)
    3.0.50
  • Unifi Access Integration version
    v1.2.8
    I've tried reinstalling v1.2.9 from HACS but HA still reports v1.2.8

Image

Image

Home Assistant DEBUG logs (MANDATORY)
home-assistant_unifi_access_2025-02-17T08-34-21.433Z.log

@imhotep
Copy link
Owner

imhotep commented Feb 24, 2025

API is not returning DPS status for your Front Door Hub. It's coming back as "none" which is unexpected. Do you mind following these steps? The logs you provided seem to show the door as always locked. I'd like to see what happens to your DPS when you unlock the door (either through the app or the integration).

@vincearnold
Copy link
Author

vincearnold commented Feb 26, 2025

API is not returning DPS status for your Front Door Hub. It's coming back as "none" which is unexpected. Do you mind following these steps? The logs you provided seem to show the door as always locked. I'd like to see what happens to your DPS when you unlock the door (either through the app or the integration).

Yea no dramas at all!
I was unlocking in the protect app, via the reader, and also via the integration.
I have not given the integration authorisation for that tho, so that explains the error.

These ones look interesting:

2025-02-26 19:03:52.583 DEBUG (Thread-11 (listen_for_updates)) [custom_components.unifi_access.hub] websocket message received {"event":"access.dps_change","receiver_id":"","event_object_id":"5034185f-d98d-4231-b4c4-7742123ee27f","save_to_history":false,"data":{"door_id":"daa529fc-2293-4bca-9ac5-a55735e30ef8","door_name":"Front Door Hub","status":"open","type":"dps_change"}}

2025-02-26 19:03:52.583 DEBUG (Thread-11 (listen_for_updates)) [custom_components.unifi_access.hub] unhandled websocket message access.dps_change

home-assistant_unifi_access_2025-02-26T08-37-45.802Z.log

Here's the Unifi log to correlate:

Image

@imhotep
Copy link
Owner

imhotep commented Feb 26, 2025

Ok. I can see the unlocked status now but the DPS is still coming back as "none". Likely a permission issue like you mentioned. We used to rely on the dps_change event. However, every hub does it differently and the event can't be relied on sadly. Besides, it adds some unnecessary complexity to the event handling. I'd recommend giving permission to the integration to access DPS or use polling (which is very inefficient)

@vincearnold
Copy link
Author

Ok. I can see the unlocked status now but the DPS is still coming back as "none". Likely a permission issue like you mentioned. We used to rely on the dps_change event. However, every hub does it differently and the event can't be relied on sadly. Besides, it adds some unnecessary complexity to the event handling. I'd recommend giving permission to the integration to access DPS or use polling (which is very inefficient)

Ahh ok, no dramas.
Let me test tonight with full access token and I'll get back to you.
Here's the permissions FYI:

Image

@vincearnold
Copy link
Author

@imhotep Updated the API token to full access, and setup the integration again.
Can confirm the unlocking now functions.
Still no luck with the door position sensor in HomeAssistant tho.

Image Image

home-assistant_unifi_access_2025-02-27T08-20-09.769Z.log

@imhotep imhotep added the bug Something isn't working label Feb 27, 2025
@imhotep
Copy link
Owner

imhotep commented Feb 27, 2025

@vincearnold can you try to dps-change branch please?

@vincearnold
Copy link
Author

vincearnold commented Feb 28, 2025

@vincearnold can you try to dps-change branch please?

Absolutely!
I've tried with that branch on, and can confirm HomeAssistant is getting the events now, but they seem to flick back to closed after a couple seconds (which is not the case, door is open for at least 5 seconds each open in these tests).
EG 17:10:12 open event
HomeAssistant reported closed at 17:10:13
Access Logs state 17:10:23

Image
Image

Actual open durations are longer:

Image

home-assistant_unifi_access_2025-02-28T06-42-50.264Z.log

@imhotep
Copy link
Owner

imhotep commented Feb 28, 2025

@vincearnold yeah not sure what to make of this. If the API is not returning the right DPS information, there is nothing this integration can do to work around the issue you're facing. I do remember the "dps_change" event being finicky like this, that is why I didn't want to rely on it.
The only other way is to use polling but you'd be delayed by a maximum of 3 seconds and it's also very inefficient. I'd delete the token and start over with full access. Maybe hard reset the hub as well.
If you're still facing the issue, I'd recommend reaching out to unifi support (either ticket or via community).
Closing this for now.

@imhotep imhotep closed this as completed Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants