Skip to content

Occasionally failing to download an event #435

@hawkins6423

Description

@hawkins6423

Thanks for putting this project together. I will get a lot of use out of this and I'd be happy to contribute however python is not my cup of tea.

I'm intermittently getting the error below. It seems to be random. I have several cameras and I'm running 5x containers, all separate databases and protect users. Each container is reading from 4 cameras, controlled by Protect permissions. I mention this because I observed the normal behavior to be not concurrent (one camera, one download at a time), and I'm not sure if there are concurrency limitations with the Protect API.

backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   INFO    ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]  Downloading event: 6626763e00f65103e400597e
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]  Remaining Download Queue: 0
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]  Video Download Buffer: 0.0B/256.0MiB
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Camera: 10 Kitchen
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Type: motion
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Start: 2024-04-22T10-37-47 (1713796667.0)
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    End: 2024-04-22T10-38-01 (1713796681.25)
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Duration: 14.25s
backup_protect_inside_3-1   | 2024-04-22 14:38:03 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Sleeping (5.35772s) to ensure clip is ready to download...
backup_protect_inside_3-1   | 2024-04-22 14:38:05 [   DEBUG   ] unifi_protect_backup.event_listener        :  Adding event 6626764803615103e40059a0 to queue (Current download queue=1)
backup_protect_inside_3-1   | 2024-04-22 14:38:07 [   DEBUG   ] unifi_protect_backup.event_listener        :  Adding event 6626764802a85103e400599f to queue (Current download queue=2)
backup_protect_inside_3-1   | 2024-04-22 14:38:07 [   DEBUG   ] unifi_protect_backup.missing_event_checker :  Running check for missing events...
backup_protect_inside_3-1   | 2024-04-22 14:38:08 [   DEBUG   ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]    Downloading video...
backup_protect_inside_3-1   | 2024-04-22 14:38:08 [  WARNING  ] unifi_protect_backup.downloader            : [6626763e00f65103e400597e]  Event failed download attempt 1
backup_protect_inside_3-1   | Traceback (most recent call last):
backup_protect_inside_3-1   |   File "/usr/lib/python3.11/site-packages/unifi_protect_backup/downloader.py", line 144, in start
backup_protect_inside_3-1   |     video = await self._download(event)
backup_protect_inside_3-1   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
backup_protect_inside_3-1   |   File "/usr/lib/python3.11/site-packages/unifi_protect_backup/downloader.py", line 184, in _download
backup_protect_inside_3-1   |     video = await self._protect.get_camera_video(event.camera_id, event.start, event.end)
backup_protect_inside_3-1   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backup_protect_inside_3-1   |   File "/usr/lib/python3.11/site-packages/pyunifiprotect/api.py", line 1328, in get_camera_video
backup_protect_inside_3-1   |     camera = self._bootstrap.cameras[camera_id]
backup_protect_inside_3-1   |              ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
backup_protect_inside_3-1   | KeyError: '65e600f401570403e40448ad'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions