feat: add end-to-end relay test scripts for both Pis#363
Open
MateoLostanlen wants to merge 10 commits intodevelopfrom
Open
feat: add end-to-end relay test scripts for both Pis#363MateoLostanlen wants to merge 10 commits intodevelopfrom
MateoLostanlen wants to merge 10 commits intodevelopfrom
Conversation
Member
MateoLostanlen
commented
Apr 29, 2026
- New watchdog/main_pi/relay_check.py and watchdog/pi_zero/relay_check.py: ping the controlled device, drive the relay LOW for POWER_OFF_TIME, verify the device drops, restore HIGH, and verify it returns. Useful after transport to confirm GPIO -> relay -> power wiring is intact.
- Pi Zero script supports --relay {main,cams,all}; cams test pings the first configured camera as a proxy for the 12V rail.
- Drop detection requires two consecutive failed pings and runs across the full cut window to avoid false positives from transient packet loss or slow-discharging loads.
- Both scripts restore relays HIGH in finally to avoid leaving a rail off on early exit.
Avoid pytest auto-collection of files matching test_*.py pattern.
- Require two consecutive failed pings before declaring the target dropped to avoid transient packet-loss false positives. - Detect drop across the full POWER_OFF_TIME window so slow-discharging targets are not falsely flagged. - Pi Zero: only setup and restore the relays selected via --relay; do not touch unselected pins. - Drop dead CAM_IPS guard (CAM_IPS always falls back to a default list).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #363 +/- ##
===========================================
+ Coverage 72.74% 73.85% +1.10%
===========================================
Files 6 6
Lines 631 631
===========================================
+ Hits 459 466 +7
+ Misses 172 165 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds scripts/setup_patrol_presets.py to configure PTZ presets 0-3 via the camera API. Updates ruff per-file-ignores to cover scripts/.
Watchdog and relay_check scripts on both main Pi and Pi Zero need RPi.GPIO; document it so deployment can pip install it.
Point operators at watchdog/requirements.txt so they install RPi.GPIO before running watchdog.py or relay_check.py on either Pi.
RPi.GPIO 0.7.1 has no piwheels wheel for Python 3.13 and fails to compile without python3-dev. rpi-lgpio is a drop-in replacement (same RPi.GPIO API), ships wheels, and works on Pi 5 / kernel 6.x where the legacy package is broken.
Cron runs scripts with /usr/bin/python3, so the GPIO library must be available to system Python. Use python3-rpi-lgpio (Debian package) so no venv or PEP 668 workaround is needed; drop requirements.txt.
Add instructions for the common case where operators only have SSH to the main Pi: launch the test detached on the Pi Zero so the script survives the main Pi rebooting mid-cut, then read /tmp/relay_check.log after reconnect. Also ignore T201/FURB105 under watchdog/ since these CLI scripts intentionally use print().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.