Skip to content

fix(circadian): let Flow cards continue before retries finish - #73

Merged
Tiwas merged 1 commit into
mainfrom
circadian-card-time-budget
Oct 8, 2026
Merged

Tiwas merged 1 commit into
mainfrom
circadian-card-time-budget

Conversation

@Tiwas

@Tiwas Tiwas commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Why

Homey stops an app Flow card after 60 s, and the Flow then stops at that card. Since v1.10.25 the Circadian Light Group and Collection cards waited for the first pass, verification and two retry passes. A light that does not answer costs up to 10 s per write (homey-api DEFAULT_TIMEOUT) in every pass. On Lars's Homey on 2026-10-08, "All on" ran about 53 s from the first light to the Collection finishing, with three lights that do not answer.

What changes

  • runDeviceTasksParallel has a deferRetries option. It returns after the first parallel pass and one verification. With a verify step, it first checks unconfirmed lights once more after 1.5 s, so a light that reports late is neither listed nor written twice. Lights still unconfirmed are listed in pending, and the reduced parallel retry and final serial retry run in background. A newer command stops the retries through the operation generation, also during the final serial pass, so a superseded command reports nothing.
  • Member on/off commands (runMemberCommand) and profile updates use it. A member command stays active until its retries finish, so the scheduler still waits. Verification, alarm_config, clg_error_occurred and clg_target_changed are reported when the retries finish, with the same messages as before.
  • runWithinCardTimeBudget (50 s) wraps every Circadian action card and the onoff/clg_paused capability listeners. Work still running after that goes on in the background. An error before the budget still fails the card.
  • Operations return an outcome object. Its ok keeps each operation's old boolean, so the Collection reports group errors as before, and cards without tokens still return that boolean.
  • clg_turn_on/clg_turn_off/clg_toggle return the tokens completed ("All lights confirmed", yes/no) and status (text). They are no longer deprecated, because the device's own On/Off/Toggle cards cannot return tokens. They are titled "… and report the result" in all 11 languages. Homey shows THEN cards with tokens only in Advanced Flows, so the other Circadian cards keep their definitions without tokens; a driver test checks this. Status texts are under circadian_outcome in all locales: Norwegian is translated, the other languages use the English text.
  • Collection: runAwaitedMemberGroups merges the groups' outcomes and reports group failures when every group's retries have finished. Only the newest Collection operation reports, and a group that postponed a profile update is not a failed group. The Collection queue is released when the card's part is done. The group error message used to list undefined; it now names the groups.

Behaviour change

The v1.10.25 promise that the next card waits for all retries no longer holds. A later card for the same group supersedes the retries. A profile card such as Resume or Apply temporary state that arrives while on/off retries are running is applied when they finish. That keeps the order, and the total delay matches the old in-card retries.

Companion tools

docs/tools/clg-editor.html: the config schema did not change, so it round-trips as before and needs no update.

Reviews

This replaces #72, which has the same content. #72's commit messages named a review tool, which the message check rejects.

  • Local high-effort review: fixed tokens hiding existing cards from standard Flows, stale reports after supersession, the settle check running after the card had returned, and duplicated code.
  • Six rounds of automated review on fix(circadian): let Flow cards continue before retries finish #72. All findings are fixed, and the last round had none:
    • stale Collection reports
    • deferred and superseded updates counted as failed groups
    • the report number taken too late
    • pause not stopping background retries
    • a final failure hidden in the first result

Tests

  • Jest: 24 suites / 414 tests pass. npm run test:package: publish-level validation passes.
  • Live test on Lars's Homey (installed with homey app install): the Collection's "Turn off and report the result" returned after 1.8 s. It gave completed: false and a status per group, with the unresponsive Smart Energy Illuminator being retried, and its background report followed about 20 s later. The bedroom group returned in 59 ms with completed: true.

Docs: docs/docs/circadian-light-group.html, PROJECT_DOCUMENTATION.md.

Homey stops an app Flow card after 60 s, and the Flow then stops at that
card. Circadian Light Group and Collection cards waited for the first
pass, verification and two retry passes, so a few lights that do not
answer (up to 10 s per write) brought "All on" close to the limit.

- runDeviceTasksParallel can defer its retries: it returns after the
  first pass and one check (plus a second check of unconfirmed lights
  after 1.5 s), and retries the rest in the background. A newer command
  stops them, also during the final pass, and a superseded command
  reports nothing.
- Member on/off commands and profile updates use it. Verification, the
  alarm, the error trigger and the target-changed trigger are reported
  when the retries finish, with the same messages as before.
- Every Circadian action card and the onoff/clg_paused listeners return
  within 50 s; anything still running goes on in the background.
- Pausing or deleting a group stops its background retries.
- The re-enabled Turn on/off/toggle cards (Advanced Flow) return "All
  lights confirmed" (yes/no) and "Status" (text). Cards that may be in
  standard Flows get no tokens, because Homey hides THEN cards with
  tokens there.
- The Collection merges its groups' results, reports only its newest
  operation, does not count postponed or superseded updates as failed
  groups, and names the groups in its error message.

Replaces #72, whose commit messages named a review tool.
@Tiwas

Tiwas commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T20:10:50.573683Z 1c81836 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 1c81836c0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Tiwas
Tiwas merged commit a3bb701 into main Oct 8, 2026
2 checks passed
@Tiwas
Tiwas deleted the circadian-card-time-budget branch October 8, 2026 20:11
Tiwas added a commit that referenced this pull request Oct 8, 2026
Version 1.10.35 with the Circadian Light Group Flow card fix from #73: store changelog in English and Norwegian, CHANGELOG.md section, README summary, the Homey Community listing, a #retries anchor in the guide, and the worklog. The forum post itself is not changed.
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