Skip to content

Send a report on specific events when the owner turns it on, first a charger that could not identify its car - #2999

Merged
olemarkus merged 1 commit into
mainfrom
feat/event-diagnostics-reports
Oct 25, 2026
Merged

olemarkus merged 1 commit into
mainfrom
feat/event-diagnostics-reports

Conversation

@olemarkus

Copy link
Copy Markdown
Owner

Lands after the Dutch stack (#2969, #2970, #2971, #2980, #2981): don't merge before it.

Why

A car link that fails is recorded in the device journal, but the developer only hears of it from the next daily report or when the owner presses Send. The owner wants a report as soon as PELS sees something go wrong, starting with a charger that could not identify the connected car, and more events to follow.

What changes

  • New switch: Settings → Advanced → Diagnostics reports gets Send a report on specific events (event_diagnostics_reports, off by default), below the daily report. Homey files every report as submitted by the user, so as with the daily report, only this switch sends one.
  • First event: ev_car_link_unmatched. A charger whose window closed with no car identified gets a report about the charger, from an hour before its plug-in.
  • lib/diagnostics/eventReportSchedule.ts:
    • Checks every 5 minutes, starting 17 minutes after start (two minutes off the daily report's hourly check), over the device events kept in the last 30 minutes. A report therefore also carries what followed its event.
    • REPORTED_EVENTS maps an event to the report it asks for. A new event is one entry there.
  • Limits:
    • One report per event and device a day, and at most 6 attempts a day in all.
    • What was sent is written to the userdata database before sending, so a restart or a charger that keeps failing never sends twice.
    • A busy, unprepared or unsendable report is tried again on a later check. An uncertain one never is.
    • The switch is read again once the report is prepared.
  • SupportReportService.sendOnEvent shares the daily report's unattended path and carries trigger: 'event'. Like the daily report, it trims its oldest activity to fit.
  • Settings UI: both switches are driven from one list (diagnosticsReportSwitches.ts, which replaces dailyReportSwitch.ts).

Notes: notes/support-reports.md, notes/settings-key-ownership.md, notes/ev-car-link/README.md.

Validation

  • New specs:
    • The schedule: sends once with the expected request, respects the switch and the lookback, follows the retry rule for every refusal code, never resends an uncertain report, honours the daily cap and the re-read switch, and ignores other events.
    • The service's event path.
    • An SDK e2e where a real charger fails to identify a car and exactly one report reaches Homey's endpoint, with none for a second failure the same day.
    • A browser spec for both switches. The section was also checked in a phone-width screenshot.
  • Existing specs: the report and car-link specs and both SDK e2e files pass.
  • Static checks: typecheck (all configs), eslint, arch:check, setup:boundaries, params:no-bundles, logging:no-legacy and lint:html are clean. The commit and pre-push hooks passed.
  • Adversarial review: no blocker. Its should-fix (a 5-minute interval ran before the 15-minute first check) is fixed, along with its nits.

🤖 Generated with Claude Code

https://claude.ai/code/session_018xVzijrbDYE7H1nTowpvbh

Copilot AI balanced review requested due to automatic review settings October 25, 2026 10:27
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

…charger that could not identify its car

Beside the daily report, Settings → Advanced → Diagnostics reports gets a second
switch, "Send a report on specific events" (`event_diagnostics_reports`, off by
default). When it is on, PELS sends the developer a report about the device an
event concerns. The first such event is `ev_car_link_unmatched`: a charger whose
window closed with no car identified, reported about the charger as of its
plug-in.

- `lib/diagnostics/eventReportSchedule.ts` checks every 5 minutes from 17
  minutes after start (two minutes off the daily report's hourly check), over
  the device events kept in the last 30 minutes, so a report also carries what
  followed its event. Which events send a report, and what
  each says, is `REPORTED_EVENTS`; a new event is one entry there.
- One report per event and device a day, at most 6 attempts a day in all. What was sent
  is written to the userdata database before sending, so a restart or a charger
  that keeps failing never sends one twice. A busy, refused or unprepared
  report is tried again on a later check; an uncertain one never is. The switch
  is read again once the report is prepared.
- `SupportReportService.sendOnEvent` shares the daily report's unattended path,
  and a report on an event trims its oldest activity to fit, like the daily one.
  `trigger` is `event`.
- The settings UI drives both switches from one list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018xVzijrbDYE7H1nTowpvbh
@olemarkus
olemarkus force-pushed the feat/event-diagnostics-reports branch from 193de6f to 7fff9d1 Compare October 25, 2026 13:54
@olemarkus
olemarkus added this pull request to stack #3005 October 25, 2026 14:05
@olemarkus
olemarkus merged commit e74b4ce into main Oct 25, 2026
16 checks passed
@olemarkus
olemarkus deleted the feat/event-diagnostics-reports branch October 25, 2026 14:36
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.

2 participants