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

Unifi UA-Ultra - Keep it unlocked/unlock & reset not working #77

Open
EmilionDK opened this issue Sep 22, 2024 · 20 comments
Open

Unifi UA-Ultra - Keep it unlocked/unlock & reset not working #77

EmilionDK opened this issue Sep 22, 2024 · 20 comments
Labels
bug Something isn't working

Comments

@EmilionDK
Copy link

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 version = 2024.9.2
  • Unifi Access version = Access 2.2.11
  • Unifi Access Integration version = 1.2.4

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'

@imhotep imhotep added the bug Something isn't working label Sep 23, 2024
@imhotep
Copy link
Owner

imhotep commented Sep 23, 2024

As such I don't think it's a bug, but more that it is not finished for Unifi UA-Ultra?

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.

@Johnnybyzhang
Copy link
Contributor

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.

@imhotep
Copy link
Owner

imhotep commented Oct 1, 2024

@Johnnybyzhang could you answer the question above?

@Johnnybyzhang
Copy link
Contributor

@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
Picsew_20241002190909

@Johnnybyzhang
Copy link
Contributor

Johnnybyzhang commented Oct 2, 2024

Additionally I can confirm that I am able to use this integration alongside UID (license-free version)

@imhotep
Copy link
Owner

imhotep commented Oct 2, 2024

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
Copy link
Contributor

Here’s the unlock schedule
IMG_3724
I currently don’t have access to my instance, will add that later when I’m back at home.

@imhotep
Copy link
Owner

imhotep commented Oct 3, 2024

@Johnnybyzhang are you seeing the errors listed in the issue when using door locking rules in the integration?

@Johnnybyzhang
Copy link
Contributor

Johnnybyzhang commented Oct 5, 2024

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

2024-10-06 03:34:24.235 INFO (SyncWorker_8) [custom_components.unifi_access.hub] Setting door lock rule for Door ID eb3ebf20-fc46-4cbe-ab50-ed5289b916ad {'type': 'keep_lock'} 2024-10-06 03:34:24.235 DEBUG (SyncWorker_8) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.11.100:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule and data {'type': 'keep_lock'} 2024-10-06 03:34:24.393 DEBUG (SyncWorker_8) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': 'An error occurred on the server.'} 2024-10-06 03:34:24.394 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546545809824] Unexpected exception Traceback (most recent call last): File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 996, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1068, in _handle_entity_call result = await task ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/select/__init__.py", line 188, in async_handle_select_option await self.async_select_option(option) File "/home/homeassistant/.homeassistant/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/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/homeassistant/.homeassistant/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 "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule self._make_http_request( File "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 269, in _make_http_request return response["data"] ~~~~~~~~^^^^^^^^ KeyError: 'data'

Keep unlocked

2024-10-06 03:37:40.666 INFO (SyncWorker_2) [custom_components.unifi_access.hub] Setting door lock rule for Door ID eb3ebf20-fc46-4cbe-ab50-ed5289b916ad {'type': 'keep_unlock'} 2024-10-06 03:37:40.666 DEBUG (SyncWorker_2) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.11.100:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule and data {'type': 'keep_unlock'} 2024-10-06 03:37:40.812 DEBUG (SyncWorker_2) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': 'An error occurred on the server.'} 2024-10-06 03:37:40.813 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546545809824] Unexpected exception Traceback (most recent call last): File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 996, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1068, in _handle_entity_call result = await task ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/select/__init__.py", line 188, in async_handle_select_option await self.async_select_option(option) File "/home/homeassistant/.homeassistant/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/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/homeassistant/.homeassistant/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 "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule self._make_http_request( File "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 269, in _make_http_request return response["data"] ~~~~~~~~^^^^^^^^ KeyError: 'data'

Custom

2024-10-06 03:38:25.983 INFO (SyncWorker_12) [custom_components.unifi_access.hub] Setting door lock rule for Door ID eb3ebf20-fc46-4cbe-ab50-ed5289b916ad {'type': 'custom', 'interval': 10} 2024-10-06 03:38:25.983 DEBUG (SyncWorker_12) [custom_components.unifi_access.hub] Making HTTP PUT Request with URL https://192.168.11.100:12445/api/v1/developer/doors/eb3ebf20-fc46-4cbe-ab50-ed5289b916ad/lock_rule and data {'type': 'custom', 'interval': 10} 2024-10-06 03:38:26.127 DEBUG (SyncWorker_12) [custom_components.unifi_access.hub] HTTP Response {'code': 'CODE_SYSTEM_ERROR', 'msg': 'An error occurred on the server.'} 2024-10-06 03:38:26.127 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546545809824] Unexpected exception Traceback (most recent call last): File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 996, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/service.py", line 1068, in _handle_entity_call result = await task ^^^^^^^^^^ File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/select/__init__.py", line 188, in async_handle_select_option await self.async_select_option(option) File "/home/homeassistant/.homeassistant/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/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/homeassistant/.homeassistant/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 "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 210, in set_door_lock_rule self._make_http_request( File "/home/homeassistant/.homeassistant/custom_components/unifi_access/hub.py", line 269, in _make_http_request return response["data"] ~~~~~~~~^^^^^^^^ KeyError: 'data'

EDIT: include the log file as an attachment
home-assistant_unifi_access_2024-10-05T19-41-55.570Z.log

@Johnnybyzhang
Copy link
Contributor

Additionally, there is no doorbell on the UA-Ultra, so this entity should also be removed following the same logic.

@Johnnybyzhang
Copy link
Contributor

Update:
I have been using this integration for over a week now, and there do not seem to be any breaking issues affecting my normal usage (e.g., unlocking the door in Home Assistant using a Zigbee button).

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.

@imhotep
Copy link
Owner

imhotep commented Oct 14, 2024

@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?
There is no easy way to detect hub type when requesting door information. Therefore, it is not easy to disable this entity automatically. You may disable it manually in the UI though.
EDIT: same goes for the doorbell or anything else really. The integration does not have an easy way to know what kind of hub a door is attached to when it starts. We get that on message updates via the websocket API later on.

@imhotep
Copy link
Owner

imhotep commented Oct 14, 2024

@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

@Johnnybyzhang
Copy link
Contributor

Johnnybyzhang commented Oct 15, 2024

@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? There is no easy way to detect hub type when requesting door information. Therefore, it is not easy to disable this entity automatically. You may disable it manually in the UI though. EDIT: same goes for the doorbell or anything else really. The integration does not have an easy way to know what kind of hub a door is attached to when it starts. We get that on message updates via the websocket API later on.

Yes, this device does not have a DPS terminal

@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

image
I have setup a API key with all the possible permissions as shown above
Yet I still get the following:

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
EDIT: It seems that there's something wrong with the shell command, following the official API guide to reconstruct the request.
FINAL EDIT: Used the reference from api reference, updated with the response. @imhotep

@Johnnybyzhang
Copy link
Contributor

There is no easy way to detect hub type when requesting door information.

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

@imhotep
Copy link
Owner

imhotep commented Oct 15, 2024

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

@Johnnybyzhang
Copy link
Contributor

I have tried all the possible actions (custom,keep_lock,keep_unlock,reset and lock_early)
And got no luck.
All the request just return

{"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 GET request

{"code":"SUCCESS","data":{"ended_time":0,"type":""}

According to the api reference, the type entry really shouldn't be empty and I believe this is a bug on their side

@imhotep
Copy link
Owner

imhotep commented Oct 15, 2024

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.

@Johnnybyzhang
Copy link
Contributor

I have created a Ticket for this issue regarding this missing API function, we'll see how they respond.

@AlekEagle
Copy link

AlekEagle commented Jan 3, 2025

Looking at the app or web interface, it looks like the UA-ULTRA does not support lock rules to begin with.

A screenshot of a UA-HUB's lock rules from the UniFi Access Android app:
UA-HUB

A screenshot of a UA-ULTRA's lack of lock rules from the UniFi Access Android app:
UA-ULTRA

Note: This is from our UNVR with UniFi OS v4.1.11 (EA) with Access v3.0.21 (EA) and the Android app v2.4.0 (Beta)

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

4 participants