Skip to content

Add automatic PoE power cycling for recovery loop#24

Merged
widgetii merged 1 commit intomasterfrom
power-cycle-poe
Apr 3, 2026
Merged

Add automatic PoE power cycling for recovery loop#24
widgetii merged 1 commit intomasterfrom
power-cycle-poe

Conversation

@widgetii
Copy link
Copy Markdown
Member

@widgetii widgetii commented Apr 3, 2026

Summary

  • Adds pluggable PowerController ABC (src/defib/power/base.py) for device power control
  • Implements RouterOS API client from scratch (zero deps) with auto-discovery of PoE ports by matching serial device names against switch interface comments
  • Integrates power cycling into RecoverySession as optional step before handshake
  • Adds --power-cycle flag to defib burn command, configured via DEFIB_POE_* env vars

Tested on real hardware

CRS112-8P-4S PoE switch with two cameras:

  • IVGHP203Y-AF on ether3 — power cycled, bootrom 0x20 pattern detected via /dev/uart-IVGHP203Y-AF
  • IVG85HG50PYA-S on ether4 — power cycled, bootrom 0x20 pattern detected via /dev/uart-IVG85HG50PYA-S

Usage

export DEFIB_POE_HOST=192.168.88.1
export DEFIB_POE_USER=admin
export DEFIB_POE_PASS=

defib burn -c <chip> -p /dev/uart-IVGHP203Y-AF --power-cycle

Test plan

  • 20 unit tests for ABC, RouterOS wire protocol, response parsing, env var factory
  • Full test suite passes (275 tests)
  • Verified power cycle + bootrom detection on both cameras
  • CI green

🤖 Generated with Claude Code

Pluggable PowerController ABC with RouterOS implementation that
auto-discovers PoE ports by matching serial device names against
switch interface comments. Zero external dependencies — custom
RouterOS API protocol over async TCP.

Tested on CRS112-8P-4S with two cameras:
- IVGHP203Y-AF (ether3) via /dev/uart-IVGHP203Y-AF
- IVG85HG50PYA-S (ether4) via /dev/uart-IVG85HG50PYA-S

Usage: defib burn -c <chip> -p /dev/uart-CAM --power-cycle
Env: DEFIB_POE_HOST, DEFIB_POE_USER, DEFIB_POE_PASS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 8025807 into master Apr 3, 2026
13 checks passed
@widgetii widgetii deleted the power-cycle-poe branch April 3, 2026 05:17
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.

1 participant