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

Blink integration marks motion detection clips as already seen when snapping pictures to save them locally #799

Open
ml0renz0 opened this issue Oct 30, 2023 · 1 comment
Labels
bug There is an issue causing unexpected results help-wanted Assistance required due to lack of resources for testing or complexity

Comments

@ml0renz0
Copy link

ml0renz0 commented Oct 30, 2023

Describe the bug

This happens since HA stable docker image version 2023.8.2

I created the automation (based on this official example) that is marking clips recorded from motion detection as seen whenever this automation is executed and new motion clips were recorded:

2023-08-29 11:18:18.222 DEBUG (SyncWorker_44) [blinkpy.camera] Found 3 recent clips for entrada
2023-08-29 11:18:18.223 DEBUG (SyncWorker_44) [blinkpy.camera] Most recent clip for entrada was created at 2023-08-29T09:11:44+00:00: https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/pir/3654965765.mp4
2023-08-29 11:18:18.224 DEBUG (SyncWorker_44) [blinkpy.api] Making GET request to https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/thumbnail/thumbnail.jpg?ts=1693300686&ext=
2023-08-29 11:18:18.369 DEBUG (SyncWorker_44) [blinkpy.api] Making GET request to https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/pir/3654965765.mp4

It seems this GET is what is marking my video as seen:
2023-08-29 11:18:18.369 DEBUG (SyncWorker_44) [blinkpy.api] Making GET request to https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/pir/3654965765.mp4

Let's check the code, it seems HA version 2023.8.2 includes blinkpy version 0.21.0 that includes this PR: Add get_videos_metadata function (@rhhayward #685)

Hmmm, could it be that this PR (introduced in blinkpy-0.21.0 that comes with HA 2023.8.2) raises this issue as a side effect?

Tracing back from said log line we get to:

Hope this helps.

To Reproduce
Steps to reproduce the behaviour:

  1. Create automation based on the official example to snap pictures and save them locally:
    alias: actualizar captura portero
    description: ""
    trigger:
      - platform: time_pattern
        hours: "*"
        minutes: /5
        seconds: "0"
    condition: []
    action:
      - service: blink.trigger_camera
        data: {}
        target:
          device_id: bd4a5bf0740aad568d894cfb7e1d0c80
      - delay:
          hours: 0
          minutes: 0
          seconds: 5
          milliseconds: 0
      - service: blink.blink_update
        data: {}
      - service: camera.snapshot
        data:
          filename: /tmp/portero.jpg
        target:
          device_id: bd4a5bf0740aad568d894cfb7e1d0c80
    mode: single
    
  2. wait for automation to capture photos
  3. generate some motion detection clips
  4. see how new motion detection clips are already marked as seen when you open blink app to check on new motion detection clips.

Expected behavior
This PR added the possibility to retrieve clips' metadata, but since its merge (blinkpy version 0.21.0) motion detection clips are being marked as read. It seems that it downloads the video, marking it as seen on blink servers, only to get its metadata. It shouldn't mark motion clips as already seen if they weren't downloaded by the user whatsoever.

Home Assistant version (if applicable): since 2023.8.2

blinkpy version (not needed if filling out Home Assistant version): since 0.21.0

Log Output/Additional Information
If using home-assistant, please paste the output of the log showing your error below. If not, please include any additional useful information.

2023-08-29 11:18:18.222 DEBUG (SyncWorker_44) [blinkpy.camera] Found 3 recent clips for entrada
2023-08-29 11:18:18.223 DEBUG (SyncWorker_44) [blinkpy.camera] Most recent clip for entrada was created at 2023-08-29T09:11:44+00:00: https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/pir/3654965765.mp4
2023-08-29 11:18:18.224 DEBUG (SyncWorker_44) [blinkpy.api] Making GET request to https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/thumbnail/thumbnail.jpg?ts=1693300686&ext=
2023-08-29 11:18:18.369 DEBUG (SyncWorker_44) [blinkpy.api] Making GET request to https://rest-e002.immedia-semi.com/api/v3/media/accounts/XXXXXX/networks/369464/lotus/86269/pir/3654965765.mp4
@ml0renz0 ml0renz0 changed the title Blink integration is marking motion detection clips as already seen Blink integration marks motion detection clips as already seen when snapping pictures to save them locally Oct 30, 2023
@fronzbot fronzbot added bug There is an issue causing unexpected results help-wanted Assistance required due to lack of resources for testing or complexity labels Oct 31, 2023
@fronzbot
Copy link
Owner

Thanks for adding this over here- easier for me to keep track of.

Excellent debug work! Your conclusions sound right to me, so I'd be surprised if it's something different. Unfortunately, I don't have a whole lot of time to work on this so please feel free to take a crack at fixing it 👍

@fronzbot fronzbot pinned this issue Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug There is an issue causing unexpected results help-wanted Assistance required due to lack of resources for testing or complexity
Projects
None yet
Development

No branches or pull requests

2 participants