This commit is contained in:
Mateusz Gruszczyński
2026-09-21 23:21:10 +02:00
parent d80005de33
commit 16001d1a55
17 changed files with 93 additions and 60 deletions
+15
View File
@@ -1897,6 +1897,21 @@ button.outside-pill:focus-visible {
background: color-mix(in srgb, var(--warning-soft) 72%, var(--surface-2));
}
.house-power-actions .house-emergency-stop.idle {
border-color: color-mix(in srgb, var(--warning) 30%, var(--line));
color: color-mix(in srgb, var(--warning) 58%, var(--muted));
background: color-mix(in srgb, var(--warning-soft) 38%, transparent);
font-weight: 650;
opacity: .72;
}
.house-power-actions .house-emergency-stop.idle:hover {
border-color: color-mix(in srgb, var(--warning) 58%, var(--line));
color: var(--warning);
background: var(--warning-soft);
opacity: 1;
}
.house-power-actions .house-emergency-stop.resume,
.house-power-actions .house-emergency-stop.resume.active {
border-color: var(--accent-border);
+13 -5
View File
@@ -49,20 +49,27 @@ function renderHouseClimate() {
const powerOn = $('#housePowerOn'), powerOff = $('#housePowerOff');
const emergencyButton = $('#houseEmergencyStop');
const emergencyActive = !!(app.house?.emergency_stop_enabled || app.controlPlan?.emergency_stop_active);
const hasAutomaticControl = (app.zones || []).some(zone => zone.enabled)
|| (app.schedules || []).some(item => item.enabled)
|| (app.automations || []).some(item => item.enabled);
const planZones = app.controlPlan?.zones || [];
const unitsWorking = (app.devices || []).some(device => device.power === true);
const automationTriggered = planZones.some(zone => zone.desired_power === true || zone.demand === true);
const hasAutomaticControl = (app.schedules || []).some(item => item.enabled)
|| (app.automations || []).some(item => item.enabled)
|| (app.flows || []).some(item => item.enabled && !item.draft)
|| planZones.some(zone => zone.local_thermostat_power === true || !!zone.current_schedule_id || zone.desired_power === true);
const emergencyVisible = emergencyActive || unitsWorking || hasAutomaticControl;
const emergencyIdle = !emergencyActive && !unitsWorking && !automationTriggered && hasAutomaticControl;
if (powerOn) { powerOn.classList.remove('active'); powerOn.removeAttribute('aria-pressed'); }
if (powerOff) { powerOff.classList.remove('active'); powerOff.removeAttribute('aria-pressed'); }
if (emergencyButton) {
emergencyButton.hidden = !emergencyActive && !hasAutomaticControl;
emergencyButton.hidden = !emergencyVisible;
emergencyButton.dataset.value = emergencyActive ? 'false' : 'true';
emergencyButton.classList.toggle('resume', emergencyActive);
emergencyButton.classList.toggle('active', emergencyActive);
emergencyButton.classList.toggle('idle', emergencyIdle);
emergencyButton.setAttribute('aria-pressed', String(emergencyActive));
emergencyButton.textContent = tr(emergencyActive ? 'house.emergencyResume' : 'house.emergencyStop');
emergencyButton.title = tr(emergencyActive ? 'house.emergencyResumeHint' : 'house.emergencyStopHint');
emergencyButton.title = tr(emergencyActive ? 'house.emergencyResumeHint' : emergencyIdle ? 'house.emergencyStopIdleHint' : 'house.emergencyStopHint');
}
node.innerHTML = `<div class="house-climate-head"><div><span class="eyebrow">${esc(tr('house.seasonMode'))}</span><h3>${esc(tr('house.smartThermostat'))}</h3><p>${esc(tr('house.setpointStrategy'))}</p></div><button type="button" class="outside-pill" data-action="open-outdoor-history" title="${esc(tr('house.outdoorHistoryOpen'))}" aria-label="${esc(tr('house.outdoorHistoryOpen'))}"><small>${esc(tr('house.outdoor'))}</small><strong>${esc(outdoor)}</strong></button></div>
<div class="house-mode-row">
@@ -221,6 +228,7 @@ function applyControlPlan(plan, revision = null) {
app.controlPlan = plan;
if (Number.isFinite(nextRevision)) app.controlPlanRevision = nextRevision;
renderControlPlan();
renderHouseClimate();
renderSimulationPage();
return true;
}
+9 -9
View File
@@ -61,8 +61,8 @@ async function handleWebSocketMessage(event) {
}
const data = message.data || {};
if (message.event === 'control_plan.updated') { app.controlPlanPushReady = true; stopControlPlanFallback(); applyControlPlan(data.plan, data.revision); }
else if (message.event === 'device.updated') { updateDevice(data); renderSummary(); renderDevices(); renderGroups(); scheduleControlPlanLoad(); }
else if (message.event === 'device.created') { updateDevice(data); renderSummary(); renderDevices(); renderGroups(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'device.updated') { updateDevice(data); renderSummary(); renderHouseClimate(); renderDevices(); renderGroups(); scheduleControlPlanLoad(); }
else if (message.event === 'device.created') { updateDevice(data); renderSummary(); renderHouseClimate(); renderDevices(); renderGroups(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'device.deleted') { app.devices = app.devices.filter(v => v.id !== data.id); renderAll(); scheduleControlPlanLoad(); }
else if (message.event === 'devices.discovered') { (data.devices || []).forEach(updateDevice); renderAll(); scheduleControlPlanLoad(); }
else if (message.event === 'zone.updated') { const i = app.zones.findIndex(v => v.id === data.id); if (i >= 0) app.zones[i] = data; else app.zones.push(data); renderSummary(); renderHouseClimate(); renderZones(); renderDevices(); renderGroups(); scheduleControlPlanLoad(); }
@@ -91,13 +91,13 @@ async function handleWebSocketMessage(event) {
renderDevices();
}
}
else if (['schedule.updated', 'schedule.created'].includes(message.event)) { const i = app.schedules.findIndex(v => v.id === data.id); if (i >= 0) app.schedules[i] = data; else app.schedules.push(data); renderSchedules(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'schedule.deleted') { app.schedules = app.schedules.filter(v => v.id !== data.id); renderSchedules(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'schedule.template_applied') { try { app.schedules = await api('/api/schedules'); renderSchedules(); fillSelects(); } catch (_) { } scheduleControlPlanLoad(); }
else if (['automation.updated', 'automation.created'].includes(message.event)) { const i = app.automations.findIndex(v => v.id === data.id); if (i >= 0) app.automations[i] = data; else app.automations.push(data); renderAutomations(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'automation.deleted') { app.automations = app.automations.filter(v => v.id !== data.id); renderAutomations(); fillSelects(); scheduleControlPlanLoad(); }
else if (['flow.updated', 'flow.created'].includes(message.event)) { const i = app.flows.findIndex(v => v.id === data.id); if (i >= 0) app.flows[i] = data; else app.flows.push(data); renderFlows(); scheduleControlPlanLoad(); }
else if (message.event === 'flow.deleted') { app.flows = app.flows.filter(v => v.id !== data.id); renderFlows(); scheduleControlPlanLoad(); }
else if (['schedule.updated', 'schedule.created'].includes(message.event)) { const i = app.schedules.findIndex(v => v.id === data.id); if (i >= 0) app.schedules[i] = data; else app.schedules.push(data); renderHouseClimate(); renderSchedules(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'schedule.deleted') { app.schedules = app.schedules.filter(v => v.id !== data.id); renderHouseClimate(); renderSchedules(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'schedule.template_applied') { try { app.schedules = await api('/api/schedules'); renderHouseClimate(); renderSchedules(); fillSelects(); } catch (_) { } scheduleControlPlanLoad(); }
else if (['automation.updated', 'automation.created'].includes(message.event)) { const i = app.automations.findIndex(v => v.id === data.id); if (i >= 0) app.automations[i] = data; else app.automations.push(data); renderHouseClimate(); renderAutomations(); fillSelects(); scheduleControlPlanLoad(); }
else if (message.event === 'automation.deleted') { app.automations = app.automations.filter(v => v.id !== data.id); renderHouseClimate(); renderAutomations(); fillSelects(); scheduleControlPlanLoad(); }
else if (['flow.updated', 'flow.created'].includes(message.event)) { const i = app.flows.findIndex(v => v.id === data.id); if (i >= 0) app.flows[i] = data; else app.flows.push(data); renderHouseClimate(); renderFlows(); scheduleControlPlanLoad(); }
else if (message.event === 'flow.deleted') { app.flows = app.flows.filter(v => v.id !== data.id); renderHouseClimate(); renderFlows(); scheduleControlPlanLoad(); }
else if (message.event === 'settings.application.updated') { applySettingsSection('application', data); if (!isFormDirty($('#settingsForm'))) renderSettings(); renderSimulationModeBanner(); renderSystemInfo(); }
else if (message.event === 'settings.gree.updated') { applySettingsSection('gree', data); if (!isFormDirty($('#settingsForm'))) renderSettings(); scheduleControlPlanLoad(); }
else if (message.event === 'settings.gree_cloud.updated') { applySettingsSection('greeCloud', data); if (!isFormDirty($('#settingsForm'))) renderSettings(); }