Skip to content

Card: critical toggle and clearing the message (0.4.0) - #9

Merged
will-roscoe merged 1 commit into
mainfrom
feat/card-critical-and-clear
Sep 18, 2026
Merged

will-roscoe merged 1 commit into
mainfrom
feat/card-critical-and-clear

Conversation

@will-roscoe

Copy link
Copy Markdown
Owner

Critical per message

New card option show_critical: true puts a Critical toggle beside the Broadcast button (the button flexes, the toggle sits at its right and turns the warning colour when armed). Each broadcast then sends whatever the toggle says, so a single message can be escalated without editing the card.

The existing critical: option becomes where the toggle starts. Without show_critical, it still applies to every broadcast from that card, exactly as before, so existing cards are untouched.

The toggle stays as you left it between broadcasts rather than resetting.

Clearing the message

  • A appears in the message box's label row whenever there is text. It clears the box and puts the cursor back in it.
  • The box already cleared itself when a broadcast it sent came back complete, but that could not fire while Sonos announcements were never confirmed (fixed in 0.3.0). It is now documented, and shares the clear helper.
  • Results for broadcasts sent elsewhere, replays on card load, and the retry button never clear the box.

Also

The card's VERSION constant still read 0.2.0 while the manifest said 0.3.0; it is logged to the browser console, so a stale value misreports what is running. Synced, with a packaging test so they cannot drift again.

Version bumped to 0.4.0.

Testing

  • 80 Python tests pass, ruff check and ruff format --check clean. The new packaging test fails as intended when the two versions disagree.
  • The card itself has no test harness in this repo, so it was driven in a headless browser against a stub of hass, exercising the real card file. 16 checks, all passing:
    • toggle only present with show_critical, starts disarmed, sits beside the button, arms and reports aria-pressed;
    • critical omitted from the service call when disarmed, sent when armed, and still sent for a card using critical: true without the toggle;
    • clear button hidden while empty, appears with text, empties the box, hides again;
    • a complete result clears the message; a partial one keeps it; another sender's complete broadcast leaves it alone;
    • no page errors.

Assisted by claude-opus-5 anthropic@willroscoe.uk

Two controls the card was missing:

- With the new show_critical option, a Critical toggle sits beside the
  Broadcast button, so a single message can be escalated without editing
  the card. The existing critical option becomes where that toggle
  starts; without show_critical it still applies to every broadcast, as
  before.
- A small clear button appears in the message box's label row whenever
  there is text.

The box already cleared itself on a fully successful broadcast, but that
could not fire while Sonos announcements were never confirmed. Document
it, and route it through the same clear helper.

Also sync the card's VERSION constant with the manifest (it still read
0.2.0) and add a packaging test so the two cannot drift again.

Helped-By: claude-opus-5 <anthropic@willroscoe.uk>
@will-roscoe
will-roscoe merged commit 8d2cb2f into main Sep 18, 2026
4 checks passed
@will-roscoe
will-roscoe deleted the feat/card-critical-and-clear branch September 18, 2026 17:23
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