feat: improve Symcon controls, device readings and designer help
This commit is contained in:
1 parent
ff54f4461a
commit
00fca890de
50 files changed
+2447
-1840
No files matched your search
@@ -22,6 +22,8 @@ import { curvePath } from "../live/day-curves.ts";
|
||||
import { controls, tokens } from "../styles.ts";
|
||||
import type { HassEntity, HomeAssistant } from "../types.ts";
|
||||
import { coverTiltEntity, coverWithTilt } from "../entities/covers.ts";
|
||||
import { deviceValueReadouts } from "../entities/device-values.ts";
|
||||
import { pointInPolygon } from "../model.ts";
|
||||
|
||||
const COVER_SET_POSITION = 4;
|
||||
const COVER_STOP = 8;
|
||||
@@ -533,6 +535,7 @@ export class NfRoomPanel extends LitElement {
|
||||
${media.length ? this.section("panel_media", media.map((st) => this.mediaRow(st))) : nothing}
|
||||
${switches.length ? this.section("panel_switches", switches.map((st) => this.switchRow(st))) : nothing}
|
||||
${sensors.length ? this.section("panel_sensors", sensors.map((st) => this.sensorRow(st))) : nothing}
|
||||
${this.extraValues(room)}
|
||||
${canAnnounce(this.hass) && roomHasSpeaker(this.hass, this.floor, room) ? this.announceSection(room) : nothing}
|
||||
${this.pluginSections(room, ids)}
|
||||
${hiddenCount
|
||||
@@ -545,6 +548,13 @@ export class NfRoomPanel extends LitElement {
|
||||
}
|
||||
|
||||
/** Header facts: the room's temperature and humidity from its climate sensors (chosen or automatic). */
|
||||
private extraValues(room: Room) {
|
||||
if (!this.floor) return nothing;
|
||||
const groups = [...this.floor.placements.filter((p) => !p.outside && pointInPolygon([p.x, p.z], room.points)).map((p) => ({ name: p.name || entityName(this.hass, p.entity_id), rows: deviceValueReadouts(this.hass, p.values) })),
|
||||
...this.floor.furniture.filter((f) => pointInPolygon([f.x, f.z], room.points)).map((f) => ({ name: f.name || (f.entity && f.entity !== "none" ? entityName(this.hass, f.entity) : this.t("device")), rows: deviceValueReadouts(this.hass, f.values) }))].filter((g) => g.rows.length);
|
||||
return groups.length ? this.section("device_values", groups.map((g) => html`<div class="nf-extra-values"><b>${g.name}</b>${g.rows.map((v) => html`<div class="nf-rp-row"><span class="nf-rp-icon">${v.icon}</span><span class="nf-rp-name">${v.label}</span><b class="nf-rp-state">${v.text}</b></div>`)}</div>`)) : nothing;
|
||||
}
|
||||
|
||||
private facts(climates: HassEntity[]): string[] {
|
||||
const out: string[] = [];
|
||||
const room = this.room;
|
||||
@@ -564,6 +574,8 @@ export class NfRoomPanel extends LitElement {
|
||||
else if (climateTemp && room.climate?.temperature !== "none") out.push(`${formatNumber(this.hass, climateTemp.attributes.current_temperature as number, 1)} ${tempUnit(this.hass)}`);
|
||||
const hum = value("humidity", "%");
|
||||
if (hum) out.push(hum);
|
||||
const lux = roomClimateValue(this.hass, this.floor ?? null, room, "illuminance");
|
||||
if (lux !== null) out.push(`☀ ${formatNumber(this.hass, lux, 0)} lx`);
|
||||
// what the room's devices draw now
|
||||
const power = this.floor && this.building ? roomPower(this.hass, this.building, this.floor, room) : null;
|
||||
if (power !== null) out.push(`⚡ ${powerText(this.hass, power)}`);
|
||||
@@ -755,7 +767,7 @@ export class NfRoomPanel extends LitElement {
|
||||
max="100"
|
||||
?disabled=${na}
|
||||
.value=${String(a.current_tilt_position)}
|
||||
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: tiltEntity ?? id, tilt_position: Number((e.target as HTMLInputElement).value) })}
|
||||
@change=${(e: Event) => this.call("cover", "set_cover_tilt_position", { entity_id: a.nf_cover_control ? id : tiltEntity ?? id, tilt_position: Number((e.target as HTMLInputElement).value) })}
|
||||
/></label>`
|
||||
: features & 48
|
||||
? html`<div class="nf-rp-buttons">
|
||||
|
||||
Reference in new issue
Block a user