Skip to content

Fix reolink patrol#360

Open
MateoLostanlen wants to merge 10 commits into
developfrom
fix_reolink_patrol
Open

Fix reolink patrol#360
MateoLostanlen wants to merge 10 commits into
developfrom
fix_reolink_patrol

Conversation

@MateoLostanlen
Copy link
Copy Markdown
Member

The Reolink cameras regularly freeze. To avoid this issue, we propose regularly checking whether the camera poses are changing. If they are not, we reboot the camera

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.74%. Comparing base (1bc58f6) to head (e423927).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #360      +/-   ##
===========================================
- Coverage    73.85%   72.74%   -1.11%     
===========================================
  Files            6        6              
  Lines          631      631              
===========================================
- Hits           466      459       -7     
- Misses         165      172       +7     
Flag Coverage Δ
unittests 72.74% <ø> (-1.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MateoLostanlen MateoLostanlen requested a review from fe51 April 27, 2026 06:01
Copy link
Copy Markdown
Member

@fe51 fe51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR, seems mainly fine, but one quesiton

stuck_check_loop runs in a separate thread from patrol_loop, and both access cam.last_images concurrently.

stuck_check_loop runs in a separate thread from patrol_loop, and both access cam.last_images concurrently. The cam.last_images.clear() call after a reboot (stuck_detector.py line 166) can race with the patrol loop iterating the same dict and raise RuntimeError: dictionary changed size during iteration. Would it be safe to replace clear() with resetting only the known pose keys, or add a small lock shared with the patrol loop?
=> I am not mastering threading but I spot this potentiel conflit -> What do you think ? Would it be an issue ?

)
if stuck_detector_enabled and getattr(cam, "cam_type", "static") == "ptz" and hasattr(cam, "reboot_camera"):
stuck_flag = threading.Event()
stuck_thread = threading.Thread(target=stuck_check_loop, args=(cam_id, stuck_flag), daemon=True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor naming question: stuck_check_loop calls its first argument camera_ip, but main.py passes cam_id to it (the CAMERA_REGISTRY loop variable). Since CAMERA_REGISTRY is keyed by IP here the name is technically correct, but renaming the parameter to cam_id in stuck_detector.py would align with main.py and patrol.py conventions.
what do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Camera occasionally stuck on a single position, returning identical images

2 participants