fix: support Symcon numeric dimmers and independent blind slat controls

This commit is contained in:
jhartworks committed 2026-11-09 15:24:59 +01:00
1 parent b934f78b9a
commit 24188f96f7
36 files changed
+1105 -683

No files matched your search

+10
View File
@@ -6,6 +6,7 @@
import type { HassArea, HassEntity, HassEntityEntry, HomeAssistant, SymconObject } from "./types.ts";
import { callSymcon as call } from "./symcon-api.ts";
import { symconControl } from "./symcon-controls.ts";
interface SymconConfig {
endpoint: string;
@@ -172,6 +173,15 @@ export class SymconBridge {
} satisfies HassEntityEntry,
]),
);
// Role aliases are offered only when deliberately choosing a control. They never pollute automatic room lists.
for (const state of Object.values(this.states)) {
for (const role of ["light", "cover"] as const) {
const control = symconControl(state, role);
if (!control || control.entity_id === state.entity_id || this.states[control.entity_id]) continue;
this.states[control.entity_id] = control;
this.entities[control.entity_id] = { ...this.entities[state.entity_id], entity_id: control.entity_id, hidden: true };
}
}
if (data.areas) this.areas = Object.fromEntries(data.areas.map((area) => [area.area_id, area]));
this.facade.states = this.states;
this.facade.entities = this.entities;