Subscribe only to NestQuest bus events

This commit is contained in:
2026-09-20 18:58:07 -04:00
parent 70be1ce75f
commit f14b96fe2b
3 changed files with 368 additions and 446 deletions
File diff suppressed because it is too large Load Diff
-23
View File
@@ -22,18 +22,6 @@ const NESTQUEST_EVENT_TYPES = [
"nestquest_child_day_complete",
];
function stateChangedEntity(event: unknown): string {
if (!event || typeof event !== "object") {
return "";
}
const data = (event as Record<string, unknown>).data;
if (!data || typeof data !== "object") {
return "";
}
const entityId = (data as Record<string, unknown>).entity_id;
return typeof entityId === "string" ? entityId : "";
}
type ChildPlate = {
slug: string;
name: string;
@@ -791,17 +779,6 @@ export class NestQuestPartyBoardCard extends LitElement {
connection.subscribeEvents(() => this.requestUpdate(), eventType)
);
}
track(
connection.subscribeEvents((event: unknown) => {
const entityId = stateChangedEntity(event);
if (
entityId.startsWith("sensor.nestquest_") ||
entityId.startsWith("binary_sensor.nestquest_")
) {
this.requestUpdate();
}
}, "state_changed")
);
}
private _unsubscribeLive(): void {
-23
View File
@@ -27,18 +27,6 @@ const NESTQUEST_EVENT_TYPES = [
"nestquest_child_day_complete",
];
function stateChangedEntity(event: unknown): string {
if (!event || typeof event !== "object") {
return "";
}
const data = (event as Record<string, unknown>).data;
if (!data || typeof data !== "object") {
return "";
}
const entityId = (data as Record<string, unknown>).entity_id;
return typeof entityId === "string" ? entityId : "";
}
type PanelInstance = {
id: number;
child_id: number | null;
@@ -1437,17 +1425,6 @@ export class NestQuestQuestLogCard extends LitElement {
connection.subscribeEvents(() => this.requestUpdate(), eventType)
);
}
track(
connection.subscribeEvents((event: unknown) => {
const entityId = stateChangedEntity(event);
if (
entityId.startsWith("sensor.nestquest_") ||
entityId.startsWith("binary_sensor.nestquest_")
) {
this.requestUpdate();
}
}, "state_changed")
);
}
private _unsubscribeLive(): void {