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

Added Credential Provider for the access.logs.add event #75

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ An entity will get created for each door. Every time a door is accessed (entry,
### Event metadata
- door_name
- door_id
- authentication # this is the method used to initiate the event ("REMOTE_THROUGH_UAH" , "NFC" , "MOBILE_TAP" , "PIN_CODE")
- actor # this is the name of the user that accessed the door. If set to N/A that means UNAUTHORIZED ACCESS!
- type # `unifi_access_entry` or `unifi_access_exit`

Expand Down
6 changes: 5 additions & 1 deletion custom_components/unifi_access/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ def on_message(self, ws: websocket.WebSocketApp, message): # noqa: C901
if door_id in self.doors:
existing_door = self.doors[door_id]
actor = update["data"]["_source"]["actor"]["display_name"]
#"REMOTE_THROUGH_UAH" , "NFC" , "MOBILE_TAP" , "PIN_CODE"
authentication = update["data"]["_source"]["authentication"]["credential_provider"]
device_config = next(
(
target
Expand All @@ -594,13 +596,15 @@ def on_message(self, ws: websocket.WebSocketApp, message): # noqa: C901
"door_name": existing_door.name,
"door_id": door_id,
"actor": actor,
"authentication": authentication,
"type": ACCESS_EVENT.format(type=access_type),
}
_LOGGER.info(
"Door name %s with id %s accessed by %s. access type: %s",
"Door name %s with id %s accessed by %s. authentication %s, access type: %s",
existing_door.name,
door_id,
actor,
authentication,
access_type,
)
changed_doors.append(existing_door)
Expand Down