-
Notifications
You must be signed in to change notification settings - Fork 18
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
Unifi UA-Ultra - Keep it unlocked/unlock & reset not working #77
Comments
Oh it is 100% a bug :) Can you set door locking rules through your Unifi Access mobile app or web UI? If not, it is possible that the UA-Ultra does not support Door Locking rules and the integration needs to remove access to this feature (same way we do for UGT and UAH-Ent). The truth is that there are too many UA hubs and I only own the Unifi Access Hub (OG) so short of community support, people that own hubs that want to contribute to this integration, I will have hard time supporting all of them, sadly. |
I have a UA-Ultra and am happy to help. Do let me know if there's anything I can do to bring support for UA-Ultra. |
@Johnnybyzhang could you answer the question above? |
I don’t think I am able to find a relevant setting in my application, attached is a screenshot of the settings page of UA-Ultra |
Additionally I can confirm that I am able to use this integration alongside UID (license-free version) |
Can you tap/click on unlock schedule at the bottom and tell me what you see? Also are you seeing the same errors above when setting door locking rules? |
@Johnnybyzhang are you seeing the errors listed in the issue when using door locking rules in the integration? |
I'm sorry for the delay in getting back to you, I was moving to a new site and spent 2 days installing home assistant on the UDM Pro directly. Here's the debug log: (TL;DR, there does seems to be the same error) Keep lock
Keep unlocked
Custom
EDIT: include the log file as an attachment |
Additionally, there is no |
Update: However, I have noticed that the "Door position sensor" is not available on the UA-Ultra. I installed the device around 5 days ago, and this entity consistently shows as "Open," regardless of the actual state of the door. Additionally, I am unable to find any relevant entries related to this in the Unifi Access WebUI. |
@Johnnybyzhang thanks for testing. From a quick glance at the UA-Ultra's product page, it doesn't look like the UA-Ultra has a DPS terminal. Does it? |
@Johnnybyzhang Regarding the issue above. Can you share some logs on integration load? Or even better can you run this? curl -H "Authorization: bearer YOUR_TOKEN" https://192.168.1.1:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule |
Yes, this device does not have a DPS terminal
curl 'https://192.168.11.100:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule' \
-H 'Authorization: Bearer [TOKEN]' \
-H 'accept: application/json' -k
{"code":"SUCCESS","data":{"ended_time":0,"type":""},"msg":"success"} EDIT: I have double checked and ensured that the account I am using is also a "door attendent" of the Access Device (I am also the owner of the Console) So I don't think this is the issue |
curl 'https://192.168.11.100:12445/api/v1/developer/devices' -H 'Authorization: [TOKEN]' -H 'accept: application/json' -k
{"code":"SUCCESS","data":[[{"id":"9c05d6bdc399","name":"UA Ultra c399","type":"UA-ULTRA"}]],"msg":"success"} It seems that it is possible to get the type of the Device through a different endpoint (Devices), but I didn't find an apparent way to connect the Device with the Door |
Yes, this is precisely the problem. The only way I found to associate a hub with a door is to wait for an update message via the websocket API which tends to be a bit more verbose than the HTTP endpoints. Thanks for running those curl commands. Can you set door lock rules via curl as well? Same way the integration is doing it? Example: curl -X PUT -H 'Authorization: Bearer YOUR_TOKEN' -H 'Content-Type: application/json' -d '{"type": "keep_unlock"}' https://192.168.11.100:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule |
I have tried all the possible actions ( {"code":"CODE_SYSTEM_ERROR","msg":"An error occurred on the server."} I have tried setting a "Unlock Schedule" in Unifi Access, but nothing seems to change the response from the {"code":"SUCCESS","data":{"ended_time":0,"type":""} According to the api reference, the |
Gotcha. Well that explains why it's not working. My only idea right now is to provide a dropdown in the configuration screen where you can select your hub type as there is no easy way to detect it. We'd then disable this feature until it's actually supported by the API. |
I have created a Ticket for this issue regarding this missing API function, we'll see how they respond. |
Describe the bug
First I would like to say thank you for this work you have done, It's super cool that there are so many people who are dictated to make things work for the Home assistant.
As such I don't think it's a bug, but more that it is not finished for Unifi UA-Ultra?
but the Keep it unlocked/unlock & reset and custom set.Iis not working.
Home assistant gives this error message:
Failed to perform the action select/select_option. 'data'
Is there anything I can do to help make it work?
Which Hub are you using
Unifi UA-Ultra
Versions:
Home Assistant DEBUG logs (MANDATORY)
2024-09-22 21:50:55.651 INFO (SyncWorker_36) [custom_components.unifi_access.hub] Setting door lock rule for Door ID 07ddb690-0b0d-4796-9ba3-4c2aaaf84414 {'type': 'keep_lock'}
2024-09-22 21:50:55.651 DEBUG (SyncWorker_36) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.1.1:12445/api/v1/developer/doors/07ddb690-0b0d-4796-9ba3-4c2aaaf84414/lock_rule and data {'type': 'keep_lock'}
2024-09-22 21:50:55.711 DEBUG (SyncWorker_36) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': "An error occurred on the server's end."}
2024-09-22 21:50:55.712 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140544372489760] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 188, in async_handle_select_option
await self.async_select_option(option)
File "/config/custom_components/unifi_access/select.py", line 89, in async_select_option
await self.hass.async_add_executor_job(self.door.set_lock_rule, option)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/unifi_access/door.py", line 93, in set_lock_rule
self._hub.set_door_lock_rule(self._id, new_door_lock_rule)
File "/config/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule
self._make_http_request(
File "/config/custom_components/unifi_access/hub.py", line 269, in _make_http_request
return response["data"]
~~~~~~~~^^^^^^^^
KeyError: 'data'
2024-09-22 21:50:58.774 INFO (SyncWorker_61) [custom_components.unifi_access.hub] Setting door lock rule for Door ID 07ddb690-0b0d-4796-9ba3-4c2aaaf84414 {'type': 'keep_unlock'}
2024-09-22 21:50:58.774 DEBUG (SyncWorker_61) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.1.1:12445/api/v1/developer/doors/07ddb690-0b0d-4796-9ba3-4c2aaaf84414/lock_rule and data {'type': 'keep_unlock'}
2024-09-22 21:50:58.848 DEBUG (SyncWorker_61) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': "An error occurred on the server's end."}
2024-09-22 21:50:58.850 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140544372489760] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 188, in async_handle_select_option
await self.async_select_option(option)
File "/config/custom_components/unifi_access/select.py", line 89, in async_select_option
await self.hass.async_add_executor_job(self.door.set_lock_rule, option)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/unifi_access/door.py", line 93, in set_lock_rule
self._hub.set_door_lock_rule(self._id, new_door_lock_rule)
File "/config/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule
self._make_http_request(
File "/config/custom_components/unifi_access/hub.py", line 269, in _make_http_request
return response["data"]
~~~~~~~~^^^^^^^^
KeyError: 'data'
2024-09-22 21:51:02.003 INFO (SyncWorker_14) [custom_components.unifi_access.hub] Setting door lock rule for Door ID 07ddb690-0b0d-4796-9ba3-4c2aaaf84414 {'type': 'reset'}
2024-09-22 21:51:02.003 DEBUG (SyncWorker_14) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.1.1:12445/api/v1/developer/doors/07ddb690-0b0d-4796-9ba3-4c2aaaf84414/lock_rule and data {'type': 'reset'}
2024-09-22 21:51:02.067 DEBUG (SyncWorker_14) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': "An error occurred on the server's end."}
2024-09-22 21:51:02.069 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140544372489760] Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 188, in async_handle_select_option
await self.async_select_option(option)
File "/config/custom_components/unifi_access/select.py", line 89, in async_select_option
await self.hass.async_add_executor_job(self.door.set_lock_rule, option)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/unifi_access/door.py", line 93, in set_lock_rule
self._hub.set_door_lock_rule(self._id, new_door_lock_rule)
File "/config/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule
self._make_http_request(
File "/config/custom_components/unifi_access/hub.py", line 269, in _make_http_request
return response["data"]
~~~~~~~~^^^^^^^^
KeyError: 'data'
The text was updated successfully, but these errors were encountered: