Skip to content

Commit

Permalink
Merge pull request #75 from jblattel/working
Browse files Browse the repository at this point in the history
Added Credential Provider for the access.logs.add event
  • Loading branch information
imhotep authored Oct 2, 2024
2 parents b6d7ebe + 8f3d8fa commit 815c0ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit 815c0ab

Please sign in to comment.