Card: critical toggle and clearing the message (0.4.0) - #9
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical per message
New card option
show_critical: trueputs 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. Withoutshow_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
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.Also
The card's
VERSIONconstant still read0.2.0while the manifest said0.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
ruff checkandruff format --checkclean. The new packaging test fails as intended when the two versions disagree.hass, exercising the real card file. 16 checks, all passing:show_critical, starts disarmed, sits beside the button, arms and reportsaria-pressed;criticalomitted from the service call when disarmed, sent when armed, and still sent for a card usingcritical: truewithout the toggle;