GUI verbessert

This commit is contained in:
2026-05-01 18:10:35 +02:00
parent f40f3ca440
commit ff1f343faa
+13 -48
View File
@@ -409,27 +409,11 @@ class SternwarteCard extends HTMLElement {
return "";
}
_powerIndicatorState() {
_powerIndicatorClassName() {
const state = this._state(this._powerEntityId())?.state;
if (state === "on") {
return {
className: "on",
label: "Dachsteuerung an",
lightStyle: "background:#4caf50; box-shadow:0 0 12px rgba(76, 175, 80, 0.45);",
};
}
if (state === "off") {
return {
className: "off",
label: "Dachsteuerung aus",
lightStyle: "background:#c62828; box-shadow:0 0 10px rgba(198, 40, 40, 0.25);",
};
}
return {
className: "unknown",
label: "Dachsteuerung unbekannt",
lightStyle: "background:#d1a94a; box-shadow:0 0 10px rgba(209, 169, 74, 0.3);",
};
if (state === "on") return "on";
if (state === "off") return "off";
return "unknown";
}
_windIndicatorState() {
@@ -781,7 +765,7 @@ class SternwarteCard extends HTMLElement {
if (!this.shadowRoot || !this._hass) return;
const powerEntityId = this._powerEntityId();
const powerIndicator = this._powerIndicatorState();
const powerIndicatorClassName = this._powerIndicatorClassName();
const rain = this._state(this.config.rain);
const openScheduleEntityId = this._scheduleOpenEntityId();
const closeScheduleEntityId = this._scheduleCloseEntityId();
@@ -804,7 +788,11 @@ class SternwarteCard extends HTMLElement {
const openOn = this._state(this.config.roofOpen)?.state === "on";
const closedOn = this._state(this.config.roofClosed)?.state === "on";
const openBlockedReason = this._openBlockedReason();
const powerOn = this._state(powerEntityId)?.state === "on";
const powerState = this._state(powerEntityId)?.state;
const powerOn = powerState === "on";
const powerOff = powerState === "off";
const powerOnButtonDisabled = powerOn;
const powerOffButtonDisabled = powerOff;
let openButtonDisabled;
let closeButtonDisabled;
let stopButtonDisabled;
@@ -1188,25 +1176,6 @@ class SternwarteCard extends HTMLElement {
margin-top: 12px;
align-items: center;
}
.power-indicator {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-radius: 12px;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.08);
font-size: 13px;
font-weight: 600;
color: var(--primary-text-color);
}
.power-indicator-light {
width: 12px;
height: 12px;
border-radius: 999px;
background: #7a7a7a;
box-shadow: 0 0 0 rgba(122, 122, 122, 0);
}
.schedule-overview {
display: grid;
grid-template-columns: repeat(2, 1fr);
@@ -1340,7 +1309,7 @@ class SternwarteCard extends HTMLElement {
</div>
</div>
<div class="panel control-panel ${powerIndicator.className}">
<div class="panel control-panel ${powerIndicatorClassName}">
<div class="title">Steuerung</div>
<div class="controls">
<button type="button" id="open-btn" ${openButtonDisabled ? "disabled" : ""}>\u00d6ffnen</button>
@@ -1348,12 +1317,8 @@ class SternwarteCard extends HTMLElement {
<button type="button" class="secondary" id="close-btn" ${closeButtonDisabled ? "disabled" : ""}>Schlie\u00dfen</button>
</div>
<div class="inline-actions">
<button type="button" class="secondary" id="power-on-btn">Dachsteuerung ein</button>
<button type="button" class="secondary" id="power-off-btn">Dachsteuerung aus</button>
<div class="power-indicator ${powerIndicator.className}">
<span class="power-indicator-light" style="${powerIndicator.lightStyle}"></span>
<span>${powerIndicator.label}</span>
</div>
<button type="button" class="secondary" id="power-on-btn" ${powerOnButtonDisabled ? "disabled" : ""}>Dachsteuerung ein</button>
<button type="button" class="secondary" id="power-off-btn" ${powerOffButtonDisabled ? "disabled" : ""}>Dachsteuerung aus</button>
</div>
${openBlockedReason ? `<div class="hint">${openBlockedReason}</div>` : ""}
</div>