Repository: uilibs/uiprotect

Issue:
Feature Request: NFC Card Scan Support
### Is your feature request related to a problem? Please describe.

Currently, uiprotect does not support NFC card scans. Integrating NFC support would allow users to trigger specific actions in Home Assistant by scanning NFC tags

### Describe alternatives you've considered

Without native NFC support, alternative options require additional hardware or custom scripts to bridge NFC interactions with Home Assistant

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Are you willing to resolve this issue by submitting a Pull Request?

- [ ] Yes, I have the time, and I know how to start.
- [X] Yes, I have the time, but I don't know how to start. I would need guidance.
- [ ] No, I don't have the time, although I believe I could do it if I had the time...
- [ ] No, I don't have the time and I wouldn't even know how to start.

Discussion:
coderabbitai[bot]: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: review in progress by coderabbit.ai -->

> [!NOTE]
> Currently processing new changes in this PR. This may take a few minutes, please wait...
> 
> <details>
> <summary>📥 Commits</summary>
> 
> Reviewing files that changed from the base of the PR and between 1f8c024cc2abf40bb5ea74d297a76c4cedee40dc and 1eef55d7ebcd1f6e61005b6ba6f919f12e512c9b.
> 
> </details>
> 
> <details>
> <summary>📒 Files selected for processing (8)</summary>
> 
> * `src/uiprotect/data/bootstrap.py` (1 hunks)
> * `src/uiprotect/data/devices.py` (4 hunks)
> * `src/uiprotect/data/nvr.py` (2 hunks)
> * `src/uiprotect/data/types.py` (2 hunks)
> * `tests/conftest.py` (0 hunks)
> * `tests/sample_data/sample_constants.json` (1 hunks)
> * `tests/sample_data/sample_raw_events.json` (1 hunks)
> * `tests/test_api_ws.py` (1 hunks)
> 
> </details>
> 
> ```ascii
>  ________________________________________________
> < Name's Rabbit. CodeRabbit. Licensed to review. >
>  ------------------------------------------------
>   \
>    \   \
>         \ /\
>         ( )
>       .( o ).
> ```

<!-- end of auto-generated comment: review in progress by coderabbit.ai -->

<!-- usage_tips_start -->

> [!TIP]
> <details>
> <summary>You can disable sequence diagrams in the walkthrough.</summary>
> 
> Disable the `reviews.sequence_diagrams` setting in your project's settings in CodeRabbit to disable sequence diagrams in the walkthrough.
> 
> </details>

<!-- usage_tips_end -->
<!-- tips_start -->

---

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs) Report
Attention: Patch coverage is `93.54839%` with `2 lines` in your changes missing coverage. Please review.

| [Files with missing lines](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs) | Patch % | Lines |
|---|---|---|
| [src/uiprotect/data/devices.py](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&filepath=src%2Fuiprotect%2Fdata%2Fdevices.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs#diff-c3JjL3VpcHJvdGVjdC9kYXRhL2RldmljZXMucHk=) | 85.71% | [2 Missing :warning: ](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs) |

| [Files with missing lines](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs) | Coverage Δ | |
|---|---|---|
| [src/uiprotect/data/bootstrap.py](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&filepath=src%2Fuiprotect%2Fdata%2Fbootstrap.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs#diff-c3JjL3VpcHJvdGVjdC9kYXRhL2Jvb3RzdHJhcC5weQ==) | `65.79% <ø> (ø)` | |
| [src/uiprotect/data/nvr.py](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&filepath=src%2Fuiprotect%2Fdata%2Fnvr.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs#diff-c3JjL3VpcHJvdGVjdC9kYXRhL252ci5weQ==) | `80.07% <100.00%> (+0.38%)` | :arrow_up: |
| [src/uiprotect/data/types.py](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&filepath=src%2Fuiprotect%2Fdata%2Ftypes.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs#diff-c3JjL3VpcHJvdGVjdC9kYXRhL3R5cGVzLnB5) | `99.60% <100.00%> (+<0.01%)` | :arrow_up: |
| [src/uiprotect/data/devices.py](https://app.codecov.io/gh/uilibs/uiprotect/pull/275?src=pr&el=tree&filepath=src%2Fuiprotect%2Fdata%2Fdevices.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs#diff-c3JjL3VpcHJvdGVjdC9kYXRhL2RldmljZXMucHk=) | `85.27% <85.71%> (+<0.01%)` | :arrow_up: |

... and [1 file with indirect coverage changes](https://app.codecov.io/gh/uilibs/uiprotect/pull/275/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uilibs)


Patch:
diff --git a/src/uiprotect/data/bootstrap.py b/src/uiprotect/data/bootstrap.py
index 0c69bcd..b405bed 100644
--- a/src/uiprotect/data/bootstrap.py
+++ b/src/uiprotect/data/bootstrap.py
@@ -98,6 +98,14 @@ CAMERA_EVENT_ATTR_MAP: dict[EventType, tuple[str, str]] = {
         "last_smart_audio_detect_event_id",
     ),
     EventType.RING: ("last_ring", "last_ring_event_id"),
+    EventType.NFC_CARD_SCANNED: (
+        "last_nfc_card_scanned",
+        "last_nfc_card_scanned_event_id",
+    ),
+    EventType.FINGERPRINT_IDENTIFIED: (
+        "last_fingerprint_identified",
+        "last_fingerprint_identified_event_id",
+    ),
 }
 
 
diff --git a/src/uiprotect/data/devices.py b/src/uiprotect/data/devices.py
index 9ad6cad..b6f21f9 100644
--- a/src/uiprotect/data/devices.py
+++ b/src/uiprotect/data/devices.py
@@ -998,6 +998,10 @@ class Camera(ProtectMotionDeviceModel):
 
     # not directly from UniFi
     last_ring_event_id: str | None = None
+    last_nfc_card_scanned_event_id: str | None = None
+    last_nfc_card_scanned: datetime | None = None
+    last_fingerprint_identified_event_id: str | None = None
+    last_fingerprint_identified: datetime | None = None
     last_smart_detect: datetime | None = None
     last_smart_audio_detect: datetime | None = None
     last_smart_detect_event_id: str | None = None
@@ -1018,6 +1022,10 @@ class Camera(ProtectMotionDeviceModel):
     def _get_excluded_changed_fields(cls) -> set[str]:
         return super()._get_excluded_changed_fields() | {
             "last_ring_event_id",
+            "last_nfc_card_scanned",
+            "last_nfc_card_scanned_event_id",
+            "last_fingerprint_identified",
+            "last_fingerprint_identified_event_id",
             "last_smart_detect",
             "last_smart_audio_detect",
             "last_smart_detect_event_id",
@@ -1086,6 +1094,10 @@ class Camera(ProtectMotionDeviceModel):
         pop_dict_tuple(
             data,
             (
+                "lastFingerprintIdentified",
+                "lastFingerprintIdentifiedEventId",
+                "lastNfcCardScanned",
+                "lastNfcCardScannedEventId",
                 "lastRingEventId",
                 "lastSmartDetect",
                 "lastSmartAudioDetect",
@@ -1148,6 +1160,23 @@ class Camera(ProtectMotionDeviceModel):
             return None
         return self._api.bootstrap.events.get(last_smart_detect_event_id)
 
+    @property
+    def last_nfc_card_scanned_event(self) -> Event | None:
+        if (
+            last_nfc_card_scanned_event_id := self.last_nfc_card_scanned_event_id
+        ) is None:
+            return None
+        return self._api.bootstrap.events.get(last_nfc_card_scanned_event_id)
+
+    @property
+    def last_fingerprint_identified_event(self) -> Event | None:
+        if (
+            last_fingerprint_identified_event_id
+            := self.last_fingerprint_identified_event_id
+        ) is None:
+            return None
+        return self._api.bootstrap.events.get(last_fingerprint_identified_event_id)
+
     @property
     def hdr_mode_display(self) -> Literal["auto", "off", "always"]:
         """Get HDR mode similar to how Protect interface works."""
diff --git a/src/uiprotect/data/nvr.py b/src/uiprotect/data/nvr.py
index 122fc9f..0eae064 100644
--- a/src/uiprotect/data/nvr.py
+++ b/src/uiprotect/data/nvr.py
@@ -136,6 +136,32 @@ class EventThumbnailAttribute(ProtectBaseObject):
     val: str
 
 
+class NfcMetadata(ProtectBaseObject):
+    nfc_id: str
+    user_id: str
+
+    @classmethod
+    @cache
+    def _get_unifi_remaps(cls) -> dict[str, str]:
+        return {
+            **super()._get_unifi_remaps(),
+            "nfcId": "nfc_id",
+            "userId": "user_id",
+        }
+
+
+class FingerprintMetadata(ProtectBaseObject):
+    ulp_id: str | None = None
+
+    @classmethod
+    @cache
+    def _get_unifi_remaps(cls) -> dict[str, str]:
+        return {
+            **super()._get_unifi_remaps(),
+            "ulpId": "ulp_id",
+        }
+
+
 class EventThumbnailAttributes(ProtectBaseObject):
     color: EventThumbnailAttribute | None = None
     vehicle_type: EventThumbnailAttribute | None = None
@@ -195,6 +221,9 @@ class EventMetadata(ProtectBaseObject):
     license_plate: LicensePlateMetadata | None = None
     # requires 2.11.13+
     detected_thumbnails: list[EventDetectedThumbnail] | None = None
+    # requires 5.1.34+
+    nfc: NfcMetadata | None = None
+    fingerprint: FingerprintMetadata | None = None
 
     _collapse_keys: ClassVar[SetStr] = {
         "lightId",
diff --git a/src/uiprotect/data/types.py b/src/uiprotect/data/types.py
index 3acf076..3d43d22 100644
--- a/src/uiprotect/data/types.py
+++ b/src/uiprotect/data/types.py
@@ -201,6 +201,8 @@ class EventType(str, ValuesEnumMixin, enum.Enum):
     POOR_CONNECTION = "poorConnection"
     STREAM_RECOVERY = "streamRecovery"
     MOTION = "motion"
+    NFC_CARD_SCANNED = "nfcCardScanned"
+    FINGERPRINT_IDENTIFIED = "fingerprintIdentified"
     RECORDING_DELETED = "recordingDeleted"
     SMART_AUDIO_DETECT = "smartAudioDetect"
     SMART_DETECT = "smartDetectZone"
@@ -274,6 +276,8 @@ class EventType(str, ValuesEnumMixin, enum.Enum):
     def device_events() -> list[str]:
         return [
             EventType.MOTION.value,
+            EventType.NFC_CARD_SCANNED.value,
+            EventType.FINGERPRINT_IDENTIFIED.value,
             EventType.RING.value,
             EventType.SMART_DETECT.value,
             EventType.SMART_AUDIO_DETECT.value,


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index c8430d4..b4214ff 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -878,7 +878,6 @@ def compare_objs(obj_type, expected, actual):
             if "clockBestWall" not in exp_thumb:
                 del act_thumbnails[index]["clockBestWall"]
         assert exp_thumbnails == act_thumbnails
-
         expected_keys = (expected.get("metadata") or {}).keys()
         actual_keys = (actual.get("metadata") or {}).keys()
         # delete all extra metadata keys, many of which are not modeled
diff --git a/tests/sample_data/sample_constants.json b/tests/sample_data/sample_constants.json
index c0243d5..fdd98b9 100644
--- a/tests/sample_data/sample_constants.json
+++ b/tests/sample_data/sample_constants.json
@@ -21,7 +21,7 @@
         "schedule": 0
     },
     "time": "2022-01-24T20:23:32.433278+00:00",
-    "event_count": 1374,
+    "event_count": 1377,
     "camera_thumbnail": "e-90f051ebf085214d331644a5",
     "camera_heatmap": "e-90f051ebf085214d331644a5",
     "camera_video_length": 23,
diff --git a/tests/sample_data/sample_raw_events.json b/tests/sample_data/sample_raw_events.json
index cf86a0d..b63d2c4 100644
--- a/tests/sample_data/sample_raw_events.json
+++ b/tests/sample_data/sample_raw_events.json
@@ -29985,5 +29985,78 @@
         "heatmap": "e-df90543f94ff894427b79827",
         "modelKey": "event",
         "timestamp": null
+    },
+    {
+        "id": "6730b5af01029603e4453bdb",
+        "modelKey": "event",
+        "type": "nfcCardScanned",
+        "start": 1731245487257,
+        "end": 1731245487257,
+        "score": 0,
+        "smartDetectTypes": [],
+        "smartDetectEvents": [],
+        "camera": "1c9a2db4df6efda47a3509be",
+        "partition": null,
+        "user": null,
+        "metadata": {
+            "nfc": {
+                "nfcId": "64B2A621",
+                "userId": "672b573764f79603e400031d"
+            },
+            "ramDescription": "",
+            "ramClassifications": []
+        },
+        "thumbnail": "e-6730b5af01029603e4003bdb",
+        "heatmap": "e-6730b5af01029603e4003bdb",
+        "timestamp": 1731245487257,
+        "category": null
+    },
+    {
+        "id": "05cb9efc794deb5625d63901",
+        "modelKey": "event",
+        "type": "fingerprintIdentified",
+        "start": 1731761536049,
+        "end": 1731761536049,
+        "score": 0,
+        "smartDetectTypes": [],
+        "smartDetectEvents": [],
+        "camera": "1c9a2db4df6efda47a3509be",
+        "partition": null,
+        "user": null,
+        "metadata": {
+            "fingerprint": {
+                "ulpId": "0ef32f28-f654-404d-ab34-30e373e66436"
+            },
+            "ramDescription": "",
+            "ramClassifications": []
+        },
+        "thumbnail": "e-05cb9efc794deb5625d63901",
+        "heatmap": "e-05cb9efc794deb5625d63901",
+        "timestamp": 1731761536049,
+        "category": null
+    },
+    {
+        "id": "ebbf14dc11a45c2c846f43fc",
+        "modelKey": "event",
+        "type": "fingerprintIdentified",
+        "start": 1731761533438,
+        "end": 1731761533438,
+        "score": 0,
+        "smartDetectTypes": [],
+        "smartDetectEvents": [],
+        "camera": "1c9a2db4df6efda47a3509be",
+        "partition": null,
+        "user": null,
+        "metadata": {
+            "fingerprint": {
+                "ulpId": null
+            },
+            "ramDescription": "",
+            "ramClassifications": []
+        },
+        "thumbnail": "e-ebbf14dc11a45c2c846f43fc",
+        "heatmap": "e-ebbf14dc11a45c2c846f43fc",
+        "timestamp": 1731761533438,
+        "category": null
     }
 ]
diff --git a/tests/test_api.py b/tests/test_api.py
index fb84159..fdd54cb 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -66,6 +66,9 @@ async def check_camera(camera: Camera):
     if camera.last_smart_detect_event is not None:
         await check_motion_event(camera.last_smart_detect_event)
 
+    assert camera.last_nfc_card_scanned is None
+    assert camera.last_fingerprint_identified is None
+
     for channel in camera.channels:
         assert channel._api is not None
 
diff --git a/tests/test_api_polling.py b/tests/test_api_polling.py
index 5651ddd..56f111a 100644
--- a/tests/test_api_polling.py
+++ b/tests/test_api_polling.py
@@ -42,6 +42,10 @@ def _reset_events(camera: Camera) -> None:
     camera.last_motion = None
     camera.last_smart_detect = None
     camera.last_smart_detect_event_id = None
+    camera.last_fingerprint_identified_event_id = None
+    camera.last_fingerprint_identified = None
+    camera.last_nfc_card_scanned_event_id = None
+    camera.last_nfc_card_scanned = None
     camera.last_smart_detects = {}
     camera.last_smart_detect_event_ids = {}
 
@@ -194,3 +198,19 @@ async def test_process_events_smart(protect_client: ProtectApiClient, now, camer
     assert smart_event.heatmap_id == f"e-{expected_event_id}"
     assert smart_event.start == (now - timedelta(seconds=30))
     assert smart_event.end == now
+
+
+@pytest.mark.asyncio()
+@patch("uiprotect.api.datetime", MockDatetime)
+async def test_event_return_none(protect_client: ProtectApiClient, now, camera):
+    def get_camera():
+        return protect_client.bootstrap.cameras[camera["id"]]
+
+    camera = get_camera()
+
+    _reset_events(camera)
+
+    assert camera.last_smart_detect_event is None
+    assert camera.last_nfc_card_scanned_event is None
+    assert camera.last_motion_event is None
+    assert camera.last_fingerprint_identified_event is None
diff --git a/tests/test_api_ws.py b/tests/test_api_ws.py
index 8ecdd6b..82d5efc 100644
--- a/tests/test_api_ws.py
+++ b/tests/test_api_ws.py
@@ -293,6 +293,152 @@ async def test_ws_event_motion(
         assert channel._api is not None
 
 
+@pytest.mark.asyncio()
+@patch("uiprotect.api.datetime", MockDatetime)
+async def test_ws_event_nfc_card_scanned(
+    protect_client_no_debug: ProtectApiClient,
+    now,
+    camera,
+    packet: WSPacket,
+):
+    protect_client = protect_client_no_debug
+
+    def get_camera():
+        return protect_client.bootstrap.cameras[camera["id"]]
+
+    camera_before = get_camera().copy()
+
+    expected_updated_id = "0441ecc6-f0fa-4b03-b071-7987c143138a"
+    expected_event_id = "6730b5af01029603e4003bdb"
+    expected_nfc_id = "66B2A649"
+    expected_user_id = "672b570000f79603e400049d"
+
+    action_frame: WSJSONPacketFrame = packet.action_frame  # type: ignore[assignment]
+    action_frame.data["newUpdateId"] = expected_updated_id
+
+    data_frame: WSJSONPacketFrame = packet.data_frame  # type: ignore[assignment]
+    data_frame.data = {
+        "id": expected_event_id,
+        "modelKey": "event",
+        "type": "nfcCardScanned",
+        "start": to_js_time(now - timedelta(seconds=30)),
+        "end": to_js_time(now),
+        "score": 0,
+        "smartDetectTypes": [],
+        "smartDetectEvents": [],
+        "camera": camera["id"],
+        "metadata": {
+            "nfc": {"nfcId": expected_nfc_id, "userId": expected_user_id},
+            "ramDescription": "",
+            "ramClassifications": [],
+        },
+        "thumbnail": f"e-{expected_event_id}",
+        "heatmap": f"e-{expected_event_id}",
+    }
+
+    camera = get_camera()
+
+    assert camera.last_nfc_card_scanned_event is None
+
+    msg = MagicMock()
+    msg.data = packet.pack_frames()
+
+    protect_client._process_ws_message(msg)
+
+    event = camera.last_nfc_card_scanned_event
+    camera_before.last_nfc_card_scanned_event_id = None
+    camera.last_nfc_card_scanned_event_id = None
+
+    assert camera.last_nfc_card_scanned == event.start
+    camera_before.last_nfc_card_scanned = None
+    camera.last_nfc_card_scanned = None
+
+    assert camera.dict() == camera_before.dict()
+    assert event.id == expected_event_id
+    assert event.type == EventType.NFC_CARD_SCANNED
+    assert event.metadata.nfc.nfc_id == expected_nfc_id
+    assert event.metadata.nfc.user_id == expected_user_id
+    assert event.thumbnail_id == f"e-{expected_event_id}"
+    assert event.heatmap_id == f"e-{expected_event_id}"
+    assert event.start == (now - timedelta(seconds=30))
+    assert event.end == now
+
+    for channel in camera.channels:
+        assert channel._api is not None
+
+
+@pytest.mark.asyncio()
+@patch("uiprotect.api.datetime", MockDatetime)
+async def test_ws_event_fingerprint_identified(
+    protect_client_no_debug: ProtectApiClient,
+    now,
+    camera,
+    packet: WSPacket,
+):
+    protect_client = protect_client_no_debug
+
+    def get_camera():
+        return protect_client.bootstrap.cameras[camera["id"]]
+
+    camera_before = get_camera().copy()
+
+    expected_updated_id = "0441ecc6-f0fa-4b03-b071-7987c143138a"
+    expected_event_id = "6730b5af01029603e4003bdb"
+    expected_ulp_id = "0ef32f12-f291-123d-ab12-30e373e12345"
+
+    action_frame: WSJSONPacketFrame = packet.action_frame  # type: ignore[assignment]
+    action_frame.data["newUpdateId"] = expected_updated_id
+
+    data_frame: WSJSONPacketFrame = packet.data_frame  # type: ignore[assignment]
+    data_frame.data = {
+        "id": expected_event_id,
+        "modelKey": "event",
+        "type": "fingerprintIdentified",
+        "start": to_js_time(now - timedelta(seconds=30)),
+        "end": to_js_time(now),
+        "score": 0,
+        "smartDetectTypes": [],
+        "smartDetectEvents": [],
+        "camera": camera["id"],
+        "metadata": {
+            "fingerprint": {"ulpId": expected_ulp_id},
+            "ramDescription": "",
+            "ramClassifications": [],
+        },
+        "thumbnail": f"e-{expected_event_id}",
+        "heatmap": f"e-{expected_event_id}",
+    }
+
+    camera = get_camera()
+
+    assert camera.last_fingerprint_identified_event is None
+
+    msg = MagicMock()
+    msg.data = packet.pack_frames()
+
+    protect_client._process_ws_message(msg)
+
+    event = camera.last_fingerprint_identified_event
+    camera_before.last_fingerprint_identified_event_id = None
+    camera.last_fingerprint_identified_event_id = None
+
+    assert camera.last_fingerprint_identified == event.start
+    camera_before.last_fingerprint_identified = None
+    camera.last_fingerprint_identified = None
+
+    assert camera.dict() == camera_before.dict()
+    assert event.id == expected_event_id
+    assert event.type == EventType.FINGERPRINT_IDENTIFIED
+    assert event.metadata.fingerprint.ulp_id == expected_ulp_id
+    assert event.thumbnail_id == f"e-{expected_event_id}"
+    assert event.heatmap_id == f"e-{expected_event_id}"
+    assert event.start == (now - timedelta(seconds=30))
+    assert event.end == now
+
+    for channel in camera.channels:
+        assert channel._api is not None
+
+
 @pytest.mark.asyncio()
 @patch("uiprotect.api.datetime", MockDatetime)
 async def test_ws_event_smart(