Dashboard Studio 2.4.0: litter box on the appliance card
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -660,6 +660,11 @@
|
||||
["dryer", /(dryer|droger|wasdroger)_(status|state|operation_state|program_state)$/, "Dryer"],
|
||||
["dishwasher", /(dishwasher|vaatwasser|vaatwasmachine)_(status|state|operation_state|program_state)$/, "Dishwasher"]]
|
||||
.map(([kind, re, name]) => ({ kind, name, status: ids.find((e) => domainOf(e) === "sensor" && re.test(e)) })).filter((a) => a.status);
|
||||
// a Tuya litter box: a status sensor next to a cat weight sensor
|
||||
for (const w of ids.filter((e) => /^sensor\..+_cat_weight$/.test(e))) {
|
||||
const status = w.replace(/_cat_weight$/, "_status");
|
||||
if (ha.states[status]) appliances.push({ kind: "litterbox", name: "Litter box", status, fill: W_AUTOFILL("appliance", status) });
|
||||
}
|
||||
if (players.length || appliances.length) {
|
||||
let y2 = Math.max(0, ...d.tabs[0].widgets.map((w) => w.y + w.h)), x2 = 0;
|
||||
if (players.length) { put("media", 0, y2, 4, 3, { entities: players }); x2 = 4; }
|
||||
@@ -667,7 +672,7 @@
|
||||
const base = a.status.replace(/_(status|state|operation_state|program_state)$/, "");
|
||||
const pick = (...suffixes) => suffixes.map((sfx) => `${base}_${sfx}`).find((e) => ha.states[e]) || "";
|
||||
if (x2 + 4 > 12) { x2 = 0; y2 += 3; }
|
||||
put("appliance", x2, y2, 4, 2, { name: tr(a.name), kind: a.kind, status: a.status, remaining: pick("remaining_time", "time_remaining", "remaining", "end_time", "finish_time"), progress: pick("progress", "program_progress"), program: pick("program", "selected_program", "active_program"), power: pick("power") });
|
||||
put("appliance", x2, y2, 4, 2, { name: tr(a.name), kind: a.kind, status: a.status, remaining: pick("remaining_time", "time_remaining", "remaining", "end_time", "finish_time"), progress: pick("progress", "program_progress"), program: pick("program", "selected_program", "active_program"), power: pick("power"), ...a.fill });
|
||||
x2 += 4;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user