feat: improve Symcon designer controls and KNX temperature selection
This commit is contained in:
1 parent
804f2d0494
commit
b934f78b9a
24 files changed
+908
-562
No files matched your search
@@ -48,6 +48,9 @@ export class NextFloorPanel extends LitElement {
|
||||
_outside: { state: true },
|
||||
_timeDrag: { state: true },
|
||||
_floorUndo: { state: true },
|
||||
_variablesLoading: { state: true },
|
||||
_variablesNotice: { state: true },
|
||||
_variablesError: { state: true },
|
||||
};
|
||||
|
||||
declare hass: HomeAssistant;
|
||||
@@ -79,6 +82,9 @@ export class NextFloorPanel extends LitElement {
|
||||
/** After "everything off" on a floor: the calls that bring it back, offered for a few seconds. */
|
||||
private declare _floorUndo: ServiceCall[] | null;
|
||||
private floorUndoTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
private declare _variablesLoading: boolean;
|
||||
private declare _variablesNotice: string;
|
||||
private declare _variablesError: boolean;
|
||||
|
||||
private readonly data = new BuildingController(this);
|
||||
private readonly store = new PrefStore(browserStorage());
|
||||
@@ -101,6 +107,9 @@ export class NextFloorPanel extends LitElement {
|
||||
this._outside = false;
|
||||
this._timeDrag = null;
|
||||
this._floorUndo = null;
|
||||
this._variablesLoading = false;
|
||||
this._variablesNotice = "";
|
||||
this._variablesError = false;
|
||||
}
|
||||
|
||||
/** Shows or hides the time-of-day switch; hiding it goes back to the real sun. */
|
||||
@@ -345,6 +354,22 @@ export class NextFloorPanel extends LitElement {
|
||||
</div>`;
|
||||
}
|
||||
|
||||
private async reloadVariables(): Promise<void> {
|
||||
if (this._variablesLoading || !this.hass.symconRefresh) return;
|
||||
this._variablesLoading = true;
|
||||
this._variablesNotice = "";
|
||||
this._variablesError = false;
|
||||
try {
|
||||
await this.hass.symconRefresh();
|
||||
this._variablesNotice = this.t("symcon_variables_loaded");
|
||||
} catch (error: unknown) {
|
||||
this._variablesError = true;
|
||||
this._variablesNotice = this.t("symcon_variables_error", { error: error instanceof Error ? error.message : String(error) });
|
||||
} finally {
|
||||
this._variablesLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private renderHeader(building: Building | null) {
|
||||
const saveState = this.data.saveState;
|
||||
const tab = (mode: Mode, label: string, extra = "") =>
|
||||
@@ -355,6 +380,7 @@ export class NextFloorPanel extends LitElement {
|
||||
<h1>${NEXTFLOOR_MARK}NextFloor</h1>
|
||||
${this.isAdmin ? html`<div class="nf-seg" role="tablist">${tab("view", this.t("view"))}${tab("editor", this.t("editor"))}${tab("extensions", `✦ ${this.t("ext_tab")}`, "nf-tab-ext")}</div>` : nothing}
|
||||
<span class="nf-grow"></span>
|
||||
${this.isAdmin && this.hass.symconRefresh ? html`<button class="nf-btn nf-reload-variables" ?disabled=${this._variablesLoading} aria-busy=${this._variablesLoading} @click=${() => void this.reloadVariables()}>↻ ${this.t(this._variablesLoading ? "symcon_variables_loading" : "symcon_variables_reload")}</button>` : nothing}
|
||||
${this._mode === "view" && building?.floors.some((f) => f.rooms.length) ? this.renderViewOptions() : nothing}
|
||||
${this._mode === "editor" && saveState !== "idle" ? html`<span class="nf-save nf-save-${saveState}">${this.t(saveLabel)}</span>` : nothing}
|
||||
<span class="nf-version" title=${this.t("version_hint", { backend: this.data.backendVersion ?? "?" })}>v${this.data.frontendVersion}</span>
|
||||
@@ -365,6 +391,7 @@ export class NextFloorPanel extends LitElement {
|
||||
private renderNotices() {
|
||||
const d = this.data;
|
||||
const notices: TemplateResult[] = [];
|
||||
if (this._variablesNotice) notices.push(html`<div class="nf-notice ${this._variablesError ? "nf-notice-error" : ""}" role=${this._variablesError ? "alert" : "status"}>${this._variablesNotice}</div>`);
|
||||
if (d.needsRestart) {
|
||||
// an old bundle in the browser or the companion app is cured by a reload, not by a restart
|
||||
notices.push(
|
||||
|
||||
Reference in new issue
Block a user