Add the Alerts cheatsheet to ESP Screens (0.2.37)
Home Assistant shows an ESPHome device action with bare field names and types only: no description, no dropdowns. The new Alerts button opens a reference page instead: per screen the exact action names (esphome.<node>_show_alert and _dismiss_alert) with copy buttons and whether the firmware is new enough, a paste-ready YAML example per screen, every field with explanation, example and the byte limits per board, all icons with glyph and name (searchable, tap copies), the colour swatches, the behaviour (timeout, button, flash, standby, replace), and the esphome.screen_alert event with an automation that waits for the button. core.alert_reference() carries the data and tests/test_alerts_reference.py keeps it equal to what both board profiles, tile_palette.h, alert_overlay.h and tile_icons.py compile. Screens carry alert_action and dismiss_action in the inventory. App only; firmware stays 0.2.31. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -272,11 +272,11 @@ function openIntegrations() {
|
||||
window.open(path, "_blank");
|
||||
}
|
||||
}
|
||||
async function copyText(text, element) {
|
||||
async function copyText(text, element, what = "API-sleutel") {
|
||||
try {
|
||||
if (!navigator.clipboard || !window.isSecureContext) throw new Error();
|
||||
await navigator.clipboard.writeText(text);
|
||||
toast("API-sleutel gekopieerd.");
|
||||
toast(`${what} gekopieerd.`);
|
||||
} catch {
|
||||
if (element) {
|
||||
const range = document.createRange();
|
||||
@@ -285,7 +285,7 @@ async function copyText(text, element) {
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
toast(document.execCommand("copy") ? "API-sleutel gekopieerd." : "De sleutel is geselecteerd. Kopieer met Ctrl+C of Command+C.");
|
||||
toast(document.execCommand("copy") ? `${what} gekopieerd.` : `${what} is geselecteerd. Kopieer met Ctrl+C of Command+C.`);
|
||||
}
|
||||
}
|
||||
// Profiles that Home Assistant does not list yet: the freshly flashed screen is not lost, it
|
||||
@@ -1128,6 +1128,7 @@ async function refresh(full = true) {
|
||||
renderScreens();
|
||||
if (selected) renderSettingsSupport();
|
||||
if (!selected && inventory.screens.length) select(inventory.screens[0].id);
|
||||
if ($("#alerts-dialog").open) renderAlertScreens();
|
||||
} catch {
|
||||
$("#connection").textContent =
|
||||
"Beheerpagina niet bereikbaar · opnieuw proberen…";
|
||||
@@ -1616,3 +1617,222 @@ async function inspect(entity) {
|
||||
}
|
||||
}
|
||||
$("#inspect").onclick = () => inspect();
|
||||
|
||||
// ----- Alerts: the cheatsheet for esphome.<node>_show_alert, built from the inventory -----
|
||||
const versionAtLeast = (version, minimum) => {
|
||||
const parse = (v) => (/^(\d+)\.(\d+)\.(\d+)$/.exec(v || "") || []).slice(1).map(Number);
|
||||
const [a, b] = [parse(version), parse(minimum)];
|
||||
if (a.length !== 3 || b.length !== 3) return false;
|
||||
for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];
|
||||
return true;
|
||||
};
|
||||
const yamlString = (text) => `"${String(text).replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
||||
function copyChip(text, what) {
|
||||
const b = node("button", "Kopieer", "mini");
|
||||
b.type = "button";
|
||||
b.onclick = () => copyText(text, undefined, what);
|
||||
return b;
|
||||
}
|
||||
function alertExampleYaml(action) {
|
||||
const fields = inventory.alerts?.fields || [];
|
||||
const lines = fields.map((f) => ` ${f.name}: ${f.type === "string" ? (/^[a-z][a-z0-9-]*$/.test(f.example) ? f.example : yamlString(f.example)) : f.example === true ? "true" : f.example === false ? "false" : f.example}`);
|
||||
return `action: ${action || "esphome.<apparaatnaam>_show_alert"}\ndata:\n${lines.join("\n")}`;
|
||||
}
|
||||
function alertWaitYaml(action) {
|
||||
return [
|
||||
`# Deurbel: toon de alert en wacht tot iemand op de knop drukt.`,
|
||||
`actions:`,
|
||||
` - action: ${action || "esphome.<apparaatnaam>_show_alert"}`,
|
||||
` data:`,
|
||||
` title: "Iemand belt aan"`,
|
||||
` subtitle: "Deur 3, achterkant"`,
|
||||
` icon: doorbell`,
|
||||
` color: orange`,
|
||||
` button_text: "Ik kom"`,
|
||||
` timeout: 0`,
|
||||
` flash: true`,
|
||||
` - wait_for_trigger:`,
|
||||
` - trigger: event`,
|
||||
` event_type: ${inventory.alerts?.event || "esphome.screen_alert"}`,
|
||||
` event_data:`,
|
||||
` action: ok`,
|
||||
` timeout: "00:05:00"`,
|
||||
` - if:`,
|
||||
` - condition: template`,
|
||||
` value_template: "{{ wait.trigger is not none }}"`,
|
||||
` then:`,
|
||||
` - action: notify.notify`,
|
||||
` data:`,
|
||||
` message: "Iemand komt naar de deur."`,
|
||||
].join("\n");
|
||||
}
|
||||
function renderAlertScreens() {
|
||||
const alerts = inventory.alerts, list = $("#alerts-screen-list");
|
||||
if (!alerts) return;
|
||||
$("#alerts-min-firmware").textContent = alerts.min_firmware;
|
||||
list.replaceChildren();
|
||||
if (!inventory.screens.length) {
|
||||
list.append(node("p", "Nog geen scherm gekoppeld. Installeer er een via Nieuw scherm; de actie verschijnt zodra Home Assistant het scherm ziet.", "hint"));
|
||||
}
|
||||
for (const screen of inventory.screens) {
|
||||
const row = node("div", undefined, "alert-screen");
|
||||
const head = node("div", undefined, "alert-screen-head");
|
||||
head.append(node("strong", screen.name));
|
||||
const ready = versionAtLeast(screen.firmware, alerts.min_firmware) && screen.alert_action;
|
||||
const badge = node("span", ready ? `● firmware ${screen.firmware}` : screen.alert_action ? `Update nodig · firmware ${screen.firmware || "onbekend"}` : "Apparaatnaam onbekend · werk het scherm bij", `badge ${ready ? "online" : "update"}`);
|
||||
head.append(badge);
|
||||
row.append(head);
|
||||
for (const [label, action] of [["Alert tonen", screen.alert_action], ["Alert sluiten", screen.dismiss_action]]) {
|
||||
const line = node("div", undefined, "copy-line");
|
||||
line.append(node("span", label, "copy-label"), node("code", action || "esphome.<apparaatnaam>_show_alert"));
|
||||
if (action) line.append(copyChip(action, "Actienaam"));
|
||||
row.append(line);
|
||||
}
|
||||
list.append(row);
|
||||
}
|
||||
const select = $("#alerts-example-screen"), current = select.value;
|
||||
select.replaceChildren();
|
||||
for (const screen of inventory.screens.filter((s) => s.alert_action)) {
|
||||
const option = node("option", screen.name);
|
||||
option.value = screen.alert_action;
|
||||
select.append(option);
|
||||
}
|
||||
if (!select.options.length) {
|
||||
const option = node("option", "een scherm (nog niet gekoppeld)");
|
||||
option.value = "";
|
||||
select.append(option);
|
||||
}
|
||||
if ([...select.options].some((o) => o.value === current)) select.value = current;
|
||||
renderAlertExamples();
|
||||
}
|
||||
function renderAlertExamples() {
|
||||
const action = $("#alerts-example-screen").value;
|
||||
$("#alerts-example").textContent = alertExampleYaml(action);
|
||||
$("#alerts-wait-example").textContent = alertWaitYaml(action);
|
||||
}
|
||||
function alertIconCard(icon, label) {
|
||||
const b = node("button", undefined, "alert-icon");
|
||||
b.type = "button";
|
||||
b.title = `${icon.name} kopiëren`;
|
||||
b.append(node("span", glyph(icon.cp), "mdi"), node("code", icon.name));
|
||||
if (label) b.append(node("small", label));
|
||||
b.onclick = () => copyText(icon.name, undefined, "Icoonnaam");
|
||||
return b;
|
||||
}
|
||||
function renderAlertIcons() {
|
||||
const alerts = inventory.alerts, icons = inventory.icons;
|
||||
if (!alerts || !icons) return;
|
||||
const suggested = $("#alerts-suggested");
|
||||
suggested.replaceChildren();
|
||||
for (const icon of alerts.suggested_icons) {
|
||||
const chip = node("button", undefined, "chip");
|
||||
chip.type = "button";
|
||||
chip.append(node("span", glyph(icon.cp), "mdi"), node("code", icon.name));
|
||||
chip.onclick = () => copyText(icon.name, undefined, "Icoonnaam");
|
||||
suggested.append(chip);
|
||||
}
|
||||
const query = $("#alerts-icon-search").value.trim().toLowerCase();
|
||||
const groups = $("#alerts-icon-groups");
|
||||
groups.replaceChildren();
|
||||
const all = [...icons.groups, { label: "Ook beschikbaar: bedienings- en weericonen", icons: alerts.extra_icons }];
|
||||
let shown = 0;
|
||||
for (const group of all) {
|
||||
const matches = group.icons.filter((i) => !query || i.name.includes(query) || (i.label || "").toLowerCase().includes(query));
|
||||
if (!matches.length) continue;
|
||||
shown += matches.length;
|
||||
const block = node("div", undefined, "alert-icon-group");
|
||||
block.append(node("p", `${group.label} · ${matches.length}`, "alerts-subhead"));
|
||||
const grid = node("div", undefined, "alert-icon-grid");
|
||||
for (const icon of matches) grid.append(alertIconCard(icon, icon.label));
|
||||
block.append(grid);
|
||||
groups.append(block);
|
||||
}
|
||||
if (!shown) groups.append(node("p", `Geen icoon voor "${query}". Onbekende namen tonen de waarschuwingsdriehoek (${alerts.fallback_icon}).`, "hint"));
|
||||
}
|
||||
function renderAlertColors() {
|
||||
const alerts = inventory.alerts, swatches = $("#alerts-swatches");
|
||||
if (!alerts) return;
|
||||
swatches.replaceChildren();
|
||||
const white = node("button", undefined, "swatch");
|
||||
white.type = "button";
|
||||
const blank = node("i");
|
||||
blank.style.background = "#FFFFFF";
|
||||
white.append(blank, node("span", undefined));
|
||||
white.lastChild.append(node("code", "leeg"), node("small", "Wit (standaard)"));
|
||||
white.onclick = () => copyText("", undefined, "Lege kleur");
|
||||
swatches.append(white);
|
||||
for (const colour of alerts.colors) {
|
||||
const b = node("button", undefined, "swatch");
|
||||
b.type = "button";
|
||||
const dot = node("i");
|
||||
dot.style.background = colour.color;
|
||||
const text = node("span");
|
||||
text.append(node("code", colour.name), node("small", `${colour.label} · ${colour.color}`));
|
||||
b.append(dot, text);
|
||||
b.onclick = () => copyText(colour.name, undefined, "Kleurnaam");
|
||||
swatches.append(b);
|
||||
}
|
||||
}
|
||||
function renderAlertTables() {
|
||||
const alerts = inventory.alerts;
|
||||
if (!alerts) return;
|
||||
const types = { string: "tekst", int: "getal", bool: "aan / uit" };
|
||||
const table = $("#alerts-field-table");
|
||||
table.replaceChildren();
|
||||
const head = node("tr");
|
||||
for (const title of ["Veld", "Type", "Wat het doet", "Voorbeeld", "Limiet"]) head.append(node("th", title));
|
||||
table.append(head);
|
||||
for (const field of alerts.fields) {
|
||||
const row = node("tr");
|
||||
const name = node("td");
|
||||
name.append(node("code", field.name), node("small", field.label));
|
||||
const example = node("td");
|
||||
example.append(node("code", typeof field.example === "string" ? field.example : String(field.example)));
|
||||
const limit = alerts.limits.cyd[field.name];
|
||||
const cells = [name, node("td", types[field.type] || field.type), node("td", field.help), example,
|
||||
node("td", limit ? `CYD ${limit} · Guition ${alerts.limits.guition[field.name]} bytes` : field.type === "int" ? "0 tot 86400 s" : "—")];
|
||||
cells.forEach((cell, index) => cell.dataset.label = ["Veld", "Type", "Wat het doet", "Voorbeeld", "Limiet"][index]);
|
||||
row.append(...cells);
|
||||
table.append(row);
|
||||
}
|
||||
const endings = $("#alerts-ending-table");
|
||||
endings.replaceChildren();
|
||||
const endHead = node("tr");
|
||||
for (const title of ["action", "Wanneer"]) endHead.append(node("th", title));
|
||||
endings.append(endHead);
|
||||
for (const ending of alerts.endings) {
|
||||
const row = node("tr"), cell = node("td"), when = node("td", ending.label);
|
||||
cell.append(node("code", ending.action));
|
||||
cell.dataset.label = "action";
|
||||
when.dataset.label = "Wanneer";
|
||||
row.append(cell, when);
|
||||
endings.append(row);
|
||||
}
|
||||
$("#alerts-event-name").textContent = alerts.event;
|
||||
const doorbell = alerts.suggested_icons.find((i) => i.name === "doorbell");
|
||||
if (doorbell) $("#alert-mock-icon").textContent = glyph(doorbell.cp);
|
||||
const orange = alerts.colors.find((c) => c.name === "orange");
|
||||
if (orange) $("#alert-mock").querySelector(".alert-mock-card").style.background = orange.color;
|
||||
}
|
||||
function renderAlerts() {
|
||||
if (!inventory.alerts) {
|
||||
toast("De cheatsheet laadt nog; probeer het zo opnieuw.");
|
||||
return false;
|
||||
}
|
||||
renderAlertTables();
|
||||
renderAlertScreens();
|
||||
renderAlertIcons();
|
||||
renderAlertColors();
|
||||
return true;
|
||||
}
|
||||
$("#open-alerts").onclick = () => {
|
||||
if (renderAlerts()) $("#alerts-dialog").showModal();
|
||||
};
|
||||
$("#close-alerts").onclick = () => $("#alerts-dialog").close();
|
||||
$("#alerts-example-screen").onchange = renderAlertExamples;
|
||||
$("#alerts-example-copy").onclick = () => copyText($("#alerts-example").textContent, $("#alerts-example"), "YAML");
|
||||
$("#alerts-wait-copy").onclick = () => copyText($("#alerts-wait-example").textContent, $("#alerts-wait-example"), "YAML");
|
||||
$("#alerts-icon-search").oninput = renderAlertIcons;
|
||||
for (const b of document.querySelectorAll("#alerts-dialog [data-jump]")) {
|
||||
b.onclick = () => document.getElementById(b.dataset.jump)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
><small>Bouwen en installeren via USB of wifi</small></span
|
||||
>
|
||||
</button>
|
||||
<button id="open-alerts" class="tool">
|
||||
<span class="tool-icon" aria-hidden="true">!</span>
|
||||
<span class="tool-text"
|
||||
><b>Alerts</b
|
||||
><small>Meldingen over het hele scherm, vanuit een automatisering</small></span
|
||||
>
|
||||
</button>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
@@ -304,6 +311,157 @@
|
||||
<pre id="firmware-log"></pre>
|
||||
</dialog>
|
||||
<dialog id="tile-sheet" class="tile-sheet" aria-label="Tegel instellen"></dialog>
|
||||
<dialog id="alerts-dialog" class="alerts" aria-label="Alerts">
|
||||
<div class="dialog-head">
|
||||
<div>
|
||||
<p class="eyebrow">ALERTS · CHEATSHEET</p>
|
||||
<h2>Een melding over het hele scherm, vanuit een automatisering.</h2>
|
||||
</div>
|
||||
<button id="close-alerts" class="quiet" aria-label="Sluiten">✕</button>
|
||||
</div>
|
||||
<p>
|
||||
Elk scherm heeft de actie <code>show_alert</code>. Die legt een kaart over alles
|
||||
heen, wekt het scherm en houdt de backlight op de normale helderheid tot iemand op
|
||||
de knop tikt of de timeout verstrijkt. Home Assistant toont bij ESPHome-acties
|
||||
zelf geen uitleg of keuzelijsten; alles wat je kunt invullen staat hier.
|
||||
</p>
|
||||
<div class="alert-hero">
|
||||
<div class="alert-mock" id="alert-mock" aria-hidden="true">
|
||||
<div class="alert-mock-card">
|
||||
<span class="mdi alert-mock-icon" id="alert-mock-icon"></span>
|
||||
<strong id="alert-mock-title">Iemand belt aan</strong>
|
||||
<span id="alert-mock-subtitle">Deur 3, achterkant</span>
|
||||
<button type="button" id="alert-mock-button" tabindex="-1">Ik kom</button>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="alerts-nav" aria-label="Onderdelen">
|
||||
<button type="button" data-jump="alerts-screens">Jouw schermen</button>
|
||||
<button type="button" data-jump="alerts-howto">In een automatisering</button>
|
||||
<button type="button" data-jump="alerts-fields">De velden</button>
|
||||
<button type="button" data-jump="alerts-icons">Iconen</button>
|
||||
<button type="button" data-jump="alerts-colors">Kleuren</button>
|
||||
<button type="button" data-jump="alerts-behaviour">Gedrag</button>
|
||||
<button type="button" data-jump="alerts-events">Events</button>
|
||||
<button type="button" data-jump="alerts-tips">Tips</button>
|
||||
</nav>
|
||||
</div>
|
||||
<section id="alerts-screens">
|
||||
<h3>Jouw schermen</h3>
|
||||
<p>
|
||||
Elke scherm heeft zijn eigen actie, met de apparaatnaam erin. Vanaf firmware
|
||||
<code id="alerts-min-firmware">0.2.31</code>; een ouder scherm werk je bij onder
|
||||
Firmware-updates.
|
||||
</p>
|
||||
<div id="alerts-screen-list"></div>
|
||||
</section>
|
||||
<section id="alerts-howto">
|
||||
<h3>In een automatisering</h3>
|
||||
<ol class="steps">
|
||||
<li><b>Actie toevoegen</b> en zoek op <b>ESPHome</b>. Kies de actie van je scherm:
|
||||
Home Assistant noemt hem "Performs the action show_alert of the node
|
||||
<i>apparaatnaam</i>".</li>
|
||||
<li><b>Vul de velden in.</b> Home Assistant vraagt alle zeven; laat wat je niet
|
||||
gebruikt leeg (<code>""</code>, <code>0</code>, uit).</li>
|
||||
<li>Liever YAML? Kies <b>Bewerken in YAML</b> bij de actie en plak het voorbeeld
|
||||
hieronder.</li>
|
||||
</ol>
|
||||
<div class="alert-example">
|
||||
<label
|
||||
>Voorbeeld voor<select id="alerts-example-screen"></select
|
||||
></label>
|
||||
<div class="copy-line">
|
||||
<pre id="alerts-example"></pre>
|
||||
<button type="button" class="mini" id="alerts-example-copy">Kopieer YAML</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="alerts-fields">
|
||||
<h3>De velden</h3>
|
||||
<p>
|
||||
Teksten zijn vrij; de limiet is in bytes en een letter met accent telt voor twee.
|
||||
Wat niet past krijgt puntjes (titel) of valt weg (subtitle).
|
||||
</p>
|
||||
<div class="table-scroll"><table id="alerts-field-table"></table></div>
|
||||
</section>
|
||||
<section id="alerts-icons">
|
||||
<h3>Iconen</h3>
|
||||
<p>
|
||||
Vul de naam in bij <code>icon</code>, bijvoorbeeld <code>doorbell</code>.
|
||||
<code>mdi:doorbell</code> en de hex-codepoint (<code>F12E6</code>) mogen ook.
|
||||
Alleen deze iconen zitten in de firmware; een andere naam geeft de
|
||||
waarschuwingsdriehoek. Tik op een icoon om de naam te kopiëren.
|
||||
</p>
|
||||
<p class="alerts-subhead">Handig voor meldingen</p>
|
||||
<div class="chips" id="alerts-suggested"></div>
|
||||
<label class="alerts-search"
|
||||
>Zoek een icoon<input
|
||||
id="alerts-icon-search"
|
||||
type="search"
|
||||
placeholder="Zoek op naam of omschrijving…"
|
||||
autocomplete="off"
|
||||
/></label>
|
||||
<div id="alerts-icon-groups"></div>
|
||||
</section>
|
||||
<section id="alerts-colors">
|
||||
<h3>Kleuren</h3>
|
||||
<p>
|
||||
Vul de naam in bij <code>color</code>. Dit zijn de pasteltinten van de tegels,
|
||||
met donkere tekst. Leeg of onbekend geeft de witte kaart. Tik om te kopiëren.
|
||||
</p>
|
||||
<div class="swatches" id="alerts-swatches"></div>
|
||||
</section>
|
||||
<section id="alerts-behaviour">
|
||||
<h3>Gedrag</h3>
|
||||
<ul class="alerts-list">
|
||||
<li><b>Wekken.</b> Een alert maakt een gedimd of donker scherm meteen wakker en
|
||||
komt boven elke pagina, elke open lichtkaart en de standby-laag.</li>
|
||||
<li><b>Aan tot de knop.</b> Zolang de kaart staat blijft de backlight op de
|
||||
normale helderheid. Standby en de nachturen wachten. Na de knop start de gewone
|
||||
standby-tijd opnieuw.</li>
|
||||
<li><b>Timeout.</b> <code>timeout: 0</code> wacht op de knop, hoe lang ook. Met
|
||||
<code>timeout: 60</code> verdwijnt de kaart na een minuut, maar de knop sluit
|
||||
hem eerder.</li>
|
||||
<li><b>Knipperen.</b> <code>flash: true</code> knippert de backlight vier keer
|
||||
bij binnenkomst (ongeveer een seconde) en laat het scherm daarna aan.</li>
|
||||
<li><b>Vervangen.</b> Een nieuwe alert vervangt de huidige; er is geen stapel.
|
||||
De vervangen alert meldt zich als <code>replaced</code>.</li>
|
||||
<li><b>Op afstand sluiten.</b> <code>dismiss_alert</code> haalt de kaart weg,
|
||||
bijvoorbeeld als de deur al open is. Zonder alert doet die actie niets.</li>
|
||||
<li><b>Tikken naast de kaart</b> doet niets; alleen de knop sluit. Zo drukt een
|
||||
wek-tik de alert nooit per ongeluk weg.</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section id="alerts-events">
|
||||
<h3>Events</h3>
|
||||
<p>
|
||||
Elk einde vuurt het event <code id="alerts-event-name">esphome.screen_alert</code>
|
||||
met <code>action</code>, <code>title</code>, <code>screen</code> (de apparaatnaam)
|
||||
en het <code>device_id</code> dat Home Assistant toevoegt. Te zien onder
|
||||
Ontwikkelhulpmiddelen → Events.
|
||||
</p>
|
||||
<div class="table-scroll"><table id="alerts-ending-table"></table></div>
|
||||
<p class="alerts-subhead">Wachten tot iemand op de knop drukt</p>
|
||||
<div class="copy-line">
|
||||
<pre id="alerts-wait-example"></pre>
|
||||
<button type="button" class="mini" id="alerts-wait-copy">Kopieer YAML</button>
|
||||
</div>
|
||||
</section>
|
||||
<section id="alerts-tips">
|
||||
<h3>Tips</h3>
|
||||
<ul class="alerts-list">
|
||||
<li>Gebruik een <b>kleur per soort melding</b>: oranje voor de deur, rood voor
|
||||
rook of water, groen voor "klaar". De tekst blijft altijd donker en leesbaar.</li>
|
||||
<li>Houd de titel <b>kort</b>; de CYD toont ongeveer veertig tekens op één regel.
|
||||
Zet details in de subtitle.</li>
|
||||
<li>Een <b>eigen knoptekst</b> maakt de melding een vraag: "Ik kom", "Gezien",
|
||||
"Uitzetten". Het event zegt dan wie reageerde.</li>
|
||||
<li>Een alert die zichzelf oplost (de deur gaat open, de was is eruit gehaald)
|
||||
sluit je in dezelfde automatisering met <code>dismiss_alert</code>.</li>
|
||||
<li>Meerdere schermen? Roep de actie van elk scherm aan; ze werken los van
|
||||
elkaar en melden zich elk met hun eigen <code>screen</code>.</li>
|
||||
</ul>
|
||||
</section>
|
||||
</dialog>
|
||||
<div id="toast" role="status" hidden></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1083,3 +1083,77 @@ pre {
|
||||
display: inline-block;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* Alerts: the cheatsheet for esphome.<node>_show_alert. */
|
||||
#alerts-dialog { max-width: 920px; width: 92vw; }
|
||||
.alerts section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
|
||||
.alerts h3 { font-size: 18px; letter-spacing: -0.3px; margin-bottom: 4px; }
|
||||
.alerts section > p { margin-top: 4px; }
|
||||
.alerts code { background: var(--soft); color: var(--ink); padding: 1px 6px; border-radius: 6px; font-size: 12px; overflow-wrap: anywhere; }
|
||||
.alerts pre { max-height: none; margin: 0; flex: 1; min-width: 0; }
|
||||
.alerts ol.steps { margin: 6px 0 18px; }
|
||||
.alerts .steps li { margin-bottom: 8px; }
|
||||
.alerts-list { padding-left: 20px; margin: 6px 0 0; font-size: 14px; color: var(--muted); }
|
||||
.alerts-list li { margin-bottom: 9px; }
|
||||
.alerts-list b { color: var(--ink); }
|
||||
.alerts-subhead { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted) !important; margin: 18px 0 8px !important; }
|
||||
.alert-hero { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 20px; align-items: center; margin: 6px 0 4px; }
|
||||
.alert-mock { background: #101820; border-radius: 16px; padding: 22px 18px; display: grid; place-items: center; }
|
||||
.alert-mock-card { position: relative; width: 100%; background: #FFE1C6; border: 1px solid #0001; border-radius: 14px; padding: 12px 12px 48px 52px; color: #1b1b1b; display: grid; gap: 2px; }
|
||||
.alert-mock-icon { position: absolute; left: 12px; top: 12px; font-size: 30px; }
|
||||
.alert-mock-card strong { font-size: 15px; line-height: 1.2; }
|
||||
.alert-mock-card > span { font-size: 12px; color: #3a3a3c; }
|
||||
.alert-mock-card button { position: absolute; right: 10px; bottom: 10px; padding: 6px 16px; border-radius: 999px; background: #1b1b1b; color: white; font-size: 13px; cursor: default; }
|
||||
.alerts-nav { display: flex; flex-wrap: wrap; gap: 6px; align-content: start; }
|
||||
.alerts-nav button { background: var(--soft); color: var(--accent); padding: 7px 12px; font-size: 12px; border-radius: 20px; }
|
||||
.alerts-nav button:hover { filter: none; background: #dfe9ff; }
|
||||
.alert-screen { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 8px; background: white; }
|
||||
.alert-screen-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
|
||||
.alert-screen-head .badge { padding: 4px 9px; font-size: 12px; }
|
||||
.copy-line { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
|
||||
.copy-line .copy-label { flex: none; width: 96px; font-size: 12px; color: var(--muted); padding-top: 2px; }
|
||||
.copy-line > code { flex: 1; min-width: 0; padding: 4px 8px; }
|
||||
.copy-line .mini { flex: none; background: white; color: var(--ink); border: 1px solid var(--line); }
|
||||
.alert-example { display: grid; gap: 10px; }
|
||||
.alert-example label { margin: 0; }
|
||||
.alert-example select { max-width: 360px; margin-top: 7px; }
|
||||
.table-scroll { overflow-x: auto; }
|
||||
.alerts table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
|
||||
.alerts th, .alerts td { text-align: left; vertical-align: top; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); }
|
||||
.alerts th { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
|
||||
.alerts td small { margin-top: 3px; }
|
||||
.alerts td:first-child code, .alerts td code { white-space: nowrap; }
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 7px; background: white; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); font-size: 12px; font-weight: 500; }
|
||||
.chip .mdi { font-size: 18px; }
|
||||
.chip code { background: none; padding: 0; color: var(--ink); }
|
||||
.chip:hover { border-color: #b9cbec; filter: none; }
|
||||
.alerts-search { margin: 18px 0 6px; }
|
||||
.alerts-search input { font-weight: 400; }
|
||||
.alert-icon-group { margin-top: 6px; }
|
||||
.alert-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
|
||||
.alert-icon { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 92px; padding: 10px 6px 8px; background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font-weight: 500; }
|
||||
.alert-icon:hover { border-color: #b9cbec; filter: none; box-shadow: 0 3px 10px #202c3c0c; }
|
||||
.alert-icon .mdi { font-size: 28px; }
|
||||
.alert-icon code { background: none; padding: 0; font-size: 11px; color: var(--accent); text-align: center; }
|
||||
.alert-icon small { font-size: 11px; text-align: center; }
|
||||
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
|
||||
.swatch { display: flex; align-items: center; gap: 10px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font-size: 12px; text-align: left; font-weight: 500; }
|
||||
.swatch:hover { border-color: #b9cbec; filter: none; }
|
||||
.swatch i { width: 34px; height: 34px; border-radius: 10px; border: 1px solid #0001; flex: none; }
|
||||
.swatch span { display: grid; gap: 2px; min-width: 0; }
|
||||
.swatch code { background: none; padding: 0; color: var(--ink); }
|
||||
.swatch small { font-size: 11px; }
|
||||
@media (max-width: 700px) {
|
||||
.alert-hero { grid-template-columns: 1fr; }
|
||||
.copy-line .copy-label { width: 100%; }
|
||||
/* Tables stack per row on a phone; each cell shows its column name. */
|
||||
.alerts table { min-width: 0; }
|
||||
.alerts table tr:first-child { display: none; }
|
||||
.alerts table tr { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
|
||||
.alerts td { display: block; padding: 0; border: 0; }
|
||||
.alerts td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
|
||||
.alerts td:first-child::before { display: none; }
|
||||
.alerts td:first-child code { font-size: 14px; }
|
||||
.copy-line > pre { flex-basis: 100%; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user