GUI verbessert
This commit is contained in:
+13
-48
@@ -409,27 +409,11 @@ class SternwarteCard extends HTMLElement {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
_powerIndicatorState() {
|
_powerIndicatorClassName() {
|
||||||
const state = this._state(this._powerEntityId())?.state;
|
const state = this._state(this._powerEntityId())?.state;
|
||||||
if (state === "on") {
|
if (state === "on") return "on";
|
||||||
return {
|
if (state === "off") return "off";
|
||||||
className: "on",
|
return "unknown";
|
||||||
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);",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_windIndicatorState() {
|
_windIndicatorState() {
|
||||||
@@ -781,7 +765,7 @@ class SternwarteCard extends HTMLElement {
|
|||||||
if (!this.shadowRoot || !this._hass) return;
|
if (!this.shadowRoot || !this._hass) return;
|
||||||
|
|
||||||
const powerEntityId = this._powerEntityId();
|
const powerEntityId = this._powerEntityId();
|
||||||
const powerIndicator = this._powerIndicatorState();
|
const powerIndicatorClassName = this._powerIndicatorClassName();
|
||||||
const rain = this._state(this.config.rain);
|
const rain = this._state(this.config.rain);
|
||||||
const openScheduleEntityId = this._scheduleOpenEntityId();
|
const openScheduleEntityId = this._scheduleOpenEntityId();
|
||||||
const closeScheduleEntityId = this._scheduleCloseEntityId();
|
const closeScheduleEntityId = this._scheduleCloseEntityId();
|
||||||
@@ -804,7 +788,11 @@ class SternwarteCard extends HTMLElement {
|
|||||||
const openOn = this._state(this.config.roofOpen)?.state === "on";
|
const openOn = this._state(this.config.roofOpen)?.state === "on";
|
||||||
const closedOn = this._state(this.config.roofClosed)?.state === "on";
|
const closedOn = this._state(this.config.roofClosed)?.state === "on";
|
||||||
const openBlockedReason = this._openBlockedReason();
|
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 openButtonDisabled;
|
||||||
let closeButtonDisabled;
|
let closeButtonDisabled;
|
||||||
let stopButtonDisabled;
|
let stopButtonDisabled;
|
||||||
@@ -1188,25 +1176,6 @@ class SternwarteCard extends HTMLElement {
|
|||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
align-items: center;
|
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 {
|
.schedule-overview {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
@@ -1340,7 +1309,7 @@ class SternwarteCard extends HTMLElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel control-panel ${powerIndicator.className}">
|
<div class="panel control-panel ${powerIndicatorClassName}">
|
||||||
<div class="title">Steuerung</div>
|
<div class="title">Steuerung</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button type="button" id="open-btn" ${openButtonDisabled ? "disabled" : ""}>\u00d6ffnen</button>
|
<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>
|
<button type="button" class="secondary" id="close-btn" ${closeButtonDisabled ? "disabled" : ""}>Schlie\u00dfen</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-actions">
|
<div class="inline-actions">
|
||||||
<button type="button" class="secondary" id="power-on-btn">Dachsteuerung ein</button>
|
<button type="button" class="secondary" id="power-on-btn" ${powerOnButtonDisabled ? "disabled" : ""}>Dachsteuerung ein</button>
|
||||||
<button type="button" class="secondary" id="power-off-btn">Dachsteuerung aus</button>
|
<button type="button" class="secondary" id="power-off-btn" ${powerOffButtonDisabled ? "disabled" : ""}>Dachsteuerung aus</button>
|
||||||
<div class="power-indicator ${powerIndicator.className}">
|
|
||||||
<span class="power-indicator-light" style="${powerIndicator.lightStyle}"></span>
|
|
||||||
<span>${powerIndicator.label}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
${openBlockedReason ? `<div class="hint">${openBlockedReason}</div>` : ""}
|
${openBlockedReason ? `<div class="hint">${openBlockedReason}</div>` : ""}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user