Skip to content

Shelly migration & Drive watchdog cron by explicit watchdog_type#52

Open
fe51 wants to merge 3 commits into
mainfrom
shelly-migration
Open

Shelly migration & Drive watchdog cron by explicit watchdog_type#52
fe51 wants to merge 3 commits into
mainfrom
shelly-migration

Conversation

@fe51

@fe51 fe51 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Replaces the implicit "is pi_zero_hostname set?" logic for choosing a Pi's reboot/watchdog behaviour with an explicit watchdog_type variable. This adds first-class support for the new Shelly watchdog alongside the existing pi-zero watchdog and the plain nightly-reboot fallback, and makes the cron configuration converge cleanly when a host's type changes.

watchdog_type values

  • no_watchdog — nightly reboot cron (shutdown -r at midnight), no watchdog
  • pi_zero — pi-zero watchdog
  • shelly — Shelly relay watchdog

Changes

  • engine_cron
    • Cron jobs are now selected by watchdog_type. Each job is paired with an explicit removal task so switching type (e.g. pi_zero → shelly) tears down the
      stale job/.env instead of leaving it behind.
    • Reboot cron and watchdog cron are mutually exclusive.
    • New watchdog_shelly.env.j2 template (SHELLY_IP, SHELLY_OUTPUT_ID, CAM_IPS derived from config_json).
    • New defaults: watchdog_main_script map (pi_zero/shelly script paths), shelly_ip (default 192.168.1.97), shelly_output_id (default 0).
    • Watchdog script paths updated to the new pyro-engine watchdog/ layout (zero/ and shelly/ subdirs, per pyro-engine PR #374).
  • check_vars
    • Asserts watchdog_type is defined and one of the three valid values on every engine host.
    • Fails fast if watchdog_type == pi_zero but pi_zero_hostname is unset.
  • pi_zero_watchdog
    • pi_zero_watchdog_script path updated to watchdog/zero/pi_zero/watchdog.py.

Notes / dependencies

  • Requires the matching pyro-engine watchdog directory layout (watchdog/zero/..., watchdog/shelly/...) to be merged
  • shelly_ip defaults to a fixed LAN address by convention; override per-host for stations that differ.

fe51 added 3 commits June 10, 2026 13:38
 Replace pi_zero_hostname inference with an explicit per-engine
  watchdog_type (no_watchdog | pi_zero | shelly), validated in
  check_vars (fails if unset/invalid). Add Shelly watchdog support
  (env template + cron) and update watchdog script paths to the
  pyro-engine PR #374 layout (watchdog/zero/* and watchdog/shelly/*).

  Each cron (reboot vs. watchdog) is paired with an explicit removal for
  the inactive types, so changing watchdog_type converges instead of
  leaving a stale job behind (e.g. no_watchdog -> pi_zero no longer keeps
  the nightly reboot cron alongside the new watchdog cron).
@fe51 fe51 marked this pull request as ready for review June 19, 2026 07:21
@fe51 fe51 requested a review from MateoLostanlen June 19, 2026 15:40
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