Skip to content

Watchdog sends the default mode to a driver that has just started #1421

Closed

Description

@frahlg

What happens

A driver that has just started is marked stale before its first reading can arrive, and it receives its autonomous default mode. This happens on every Core start, update and driver install, not only after the configured watchdog timeout.

  1. Registry.Add creates the health record at once (go/internal/drivers/registry.go:738, EnsureDriverHealth). LastSuccess is nil and Status is the zero value, StatusOk.
  2. On the next control tick, WatchdogScan treats LastSuccess == nil as stale and Status != StatusOffline as online (go/internal/telemetry/store.go:749).
  3. The driver flips offline, sendDriverDefault runs and DriverLost is published (go/cmd/ftw/main.go:2936).

A driver whose first poll is slow never gets the 60 s grace period. Cloud drivers such as easee_cloud fall in this group, because they log in before they poll.

Evidence (home box, v0.136.3-beta.1 and v0.136.4-beta.1)

Every Core restart or driver install since 2026-09-24 18:00 shows the same sequence. Easee then applies its default, phaseMode → 3 and a rewrite of dynamicChargerCurrent:

Driver added Marked stale Cause
18:40:46 18:40:50 Core update
19:11:55 19:11:59 Core update
20:30:07 20:30:11 Core update
20:56:26 20:56:30 Core update
06:59:16 06:59:19 Core update to v0.136.4-beta.1
07:03:02 07:03:04 easee_cloud 1.3.2 → 1.3.3 install

There were no events between restarts (21:00–06:59). The overnight EV stops were a different cause, fixed in #1417.

Effect

The charger or battery gets its autonomous default on every restart, whatever the plan says. At 07:03 the Easee resumed with a 16 A offer ("auto-resumed after pause"). For a battery, the default hands control back to the inverter for a moment. For Easee, it also writes firmware settings to the cloud. DriverLost has no subscribers today, so no notification fires.

Expected

A driver that has started but not yet emitted counts as fresh until the watchdog timeout has passed since its start. A driver that never emits still goes stale after that timeout and receives its default, as today.

Suggested fix

Record when the health record was created (StartedAt). WatchdogScan uses it in place of LastSuccess while LastSuccess is nil. Add a test with two cases: a newly added driver without an emit is not stale before the timeout, and is stale and defaulted after it.

Activity

  1. added
    bug
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions