work: функционал для работы с вятяжкой

* Добавил полный функционал управления elica через esp32 по MQTT
* Добавил в прошивку принудительную блокировку внешнего винтелятора при работающей вытяжке
* Добавил веб-панели для управления вытяжкой
This commit is contained in:
2026-09-26 23:59:01 +03:00
parent 3b3c7a3f13
commit bf832ac86b
12 changed files with 631 additions and 52 deletions
+85
View File
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<title>Elica — виджет</title>
<link rel="stylesheet" href="/ui/static/css/base.css">
<link rel="stylesheet" href="/ui/static/css/widget.css">
<link rel="stylesheet" href="/ui/static/css/exhaust-widget.css">
</head>
<body>
<div class="ambient" aria-hidden="true"></div>
<main class="widget exhaust-widget" aria-live="polite">
<header class="widget-header exhaust-widget-header">
<div class="identity">
<span class="brand-icon hood-icon" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none"><path d="M5 4h14M8 4v5l-3 4h14l-3-4V4M9 17c0 1.3-1 2-1 3M12 17c0 1.3-1 2-1 3M15 17c0 1.3-1 2-1 3" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>
</span>
<span class="identity-copy">
<span class="title-row"><h1>Elica</h1><span id="connection" class="pill muted">Загрузка</span></span>
<small id="header-detail">Вытяжная вентиляция</small>
</span>
</div>
<button id="theme-button" class="theme-button" type="button" title="Сменить тему">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M12 3v2m0 14v2M3 12h2m14 0h2M5.64 5.64l1.42 1.42m9.88 9.88 1.42 1.42m0-12.72-1.42 1.42M7.06 16.94l-1.42 1.42" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="1.8"/></svg>
</button>
</header>
<section class="widget-tile control-card speed-card exhaust-widget-speed" aria-labelledby="speed-title">
<div class="card-title">
<svg class="ui-icon feature-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#fan"></use></svg>
<span><h2 id="speed-title">Скорость вытяжки</h2><p id="speed-note">Фактическая ступень Elica</p></span>
</div>
<div class="hero-control exhaust-widget-hero">
<span class="hero-spacer" aria-hidden="true"></span>
<strong id="speed" class="hero-value value skeleton">0</strong>
<span class="hero-spacer" aria-hidden="true"></span>
</div>
<div class="speed-segments exhaust-widget-segments" role="group" aria-label="Выбор скорости">
<button type="button" data-speed="1" aria-label="Скорость 1"></button>
<button type="button" data-speed="2" aria-label="Скорость 2"></button>
<button type="button" data-speed="3" aria-label="Скорость 3"></button>
<button type="button" data-speed="4" aria-label="Скорость 4"></button>
</div>
<div class="scale-labels exhaust-widget-labels" aria-hidden="true"><span>1</span><span>2</span><span>3</span><span>4</span></div>
</section>
<section class="switch-grid exhaust-switch-grid" aria-label="Управление вентиляцией">
<article class="widget-tile switch-card power-card">
<div class="switch-title">
<svg class="ui-icon switch-icon green" aria-hidden="true"><use href="/ui/static/assets/icons.svg#power"></use></svg>
<span><h2>Вытяжка</h2><small id="power-detail">Выключена</small></span>
</div>
<button id="power-toggle" class="glass-switch green" type="button" aria-pressed="false">OFF</button>
</article>
<article id="external-fan-card" class="widget-tile switch-card external-fan-card" data-on="false">
<div class="switch-title">
<svg class="ui-icon switch-icon fan-glyph" aria-hidden="true"><use href="/ui/static/assets/icons.svg#fan"></use></svg>
<span><h2>Внешний</h2><small id="external-fan-detail">OUT5 · NC</small></span>
</div>
<button id="external-fan-toggle" class="glass-switch green" type="button" aria-pressed="false">OFF</button>
</article>
</section>
<section class="widget-tile info-card exhaust-actions" aria-label="Таймер и свет">
<div class="exhaust-action-row">
<span class="exhaust-action-copy"><svg class="ui-icon section-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#clock"></use></svg><span><b>Таймер</b><small id="timer-detail">Выключен</small></span></span>
<button id="timer-toggle" class="glass-switch compact green" type="button" aria-pressed="false">OFF</button>
</div>
<i class="exhaust-divider" aria-hidden="true"></i>
<div class="exhaust-action-row">
<span class="exhaust-action-copy"><svg class="bulb-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M9 18h6M10 21h4M8.5 14.5A6 6 0 1 1 15.5 14.5c-.9.7-1.5 1.5-1.7 2.5h-3.6c-.2-1-.8-1.8-1.7-2.5Z" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg><span><b>Подсветка</b><small>Импульсное управление</small></span></span>
<button id="light-toggle" class="glass-action" type="button">Переключить</button>
</div>
</section>
<button id="open-panel" class="open-panel" type="button">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M5 4h14M8 4v5l-3 4h14l-3-4V4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>
<span>Открыть панель вытяжки</span><b aria-hidden="true">↗</b>
</button>
</main>
<script type="module" src="/ui/static/js/exhaust-widget.js"></script>
</body>
</html>
+118
View File
@@ -0,0 +1,118 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<title>Elica — управление вытяжкой</title>
<link rel="stylesheet" href="/ui/static/css/base.css">
<link rel="stylesheet" href="/ui/static/css/panel.css">
<link rel="stylesheet" href="/ui/static/css/exhaust.css">
</head>
<body>
<div class="ambient" aria-hidden="true"></div>
<main class="climate-panel exhaust-panel" aria-live="polite">
<header class="panel-header exhaust-header">
<div class="identity exhaust-identity">
<span class="hood-mark glass-tile" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none">
<path d="M5 4h14M8 4v5l-3 4h14l-3-4V4M9 17c0 1.3-1 2-1 3M12 17c0 1.3-1 2-1 3M15 17c0 1.3-1 2-1 3" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</span>
<span class="identity-copy">
<span class="title-row"><h1>Elica</h1><span id="connection" class="pill muted">Загрузка</span></span>
<small>Кухонная вытяжка и внешний вытяжной вентилятор</small>
</span>
</div>
<div class="header-tools">
<div class="ventilation-badge glass-tile exhaust-badge">
<svg class="ui-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#fan"></use></svg>
<span><strong>Вытяжная вентиляция</strong><small>Управление Elica и внешним вентилятором</small></span>
</div>
<a class="icon-button panel-link" href="/ui/panel" title="Открыть Tion 4S" aria-label="Открыть Tion 4S">
<svg class="ui-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#wind"></use></svg>
</a>
<button id="refresh-button" class="icon-button" type="button" title="Обновить данные">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M20 11a8 8 0 1 0-2.34 5.66M20 5v6h-6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
</button>
<button id="theme-button" class="icon-button" type="button" title="Сменить тему">
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M12 3v2m0 14v2M3 12h2m14 0h2M5.64 5.64l1.42 1.42m9.88 9.88 1.42 1.42m0-12.72-1.42 1.42M7.06 16.94l-1.42 1.42" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="1.8"/></svg>
</button>
</div>
</header>
<section class="primary-controls exhaust-primary" aria-label="Основное управление">
<article class="control-card glass-tile speed-card exhaust-speed-card">
<div class="card-title">
<svg class="ui-icon feature-icon fan-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#fan"></use></svg>
<span><h2>Скорость вытяжки</h2><p id="speed-caption">Скорость определяется по индикаторам Elica</p></span>
</div>
<div class="hero-control exhaust-hero-control">
<span class="hero-spacer" aria-hidden="true"></span>
<strong id="speed-value" class="hero-value">—</strong>
<span class="hero-spacer" aria-hidden="true"></span>
</div>
<div class="speed-segments exhaust-speed-segments" role="group" aria-label="Выбор скорости">
<button type="button" data-speed="1" aria-label="Скорость 1"></button>
<button type="button" data-speed="2" aria-label="Скорость 2"></button>
<button type="button" data-speed="3" aria-label="Скорость 3"></button>
<button type="button" data-speed="4" aria-label="Скорость 4"></button>
</div>
<div class="speed-labels exhaust-speed-labels" aria-hidden="true"><span>1</span><span>2</span><span>3</span><span>4</span></div>
</article>
<article class="switch-card glass-tile power-card exhaust-switch-card">
<div class="card-title compact">
<svg class="ui-icon feature-icon green" aria-hidden="true"><use href="/ui/static/assets/icons.svg#power"></use></svg>
<span><h2>Питание</h2><p id="power-caption">Ожидаем состояние панели</p></span>
</div>
<button id="power-toggle" class="glass-switch green" type="button" aria-pressed="false">OFF</button>
</article>
<article id="external-fan-card" class="switch-card glass-tile exhaust-fan-card exhaust-switch-card" data-on="false">
<div class="card-title compact">
<svg class="ui-icon feature-icon fan-glyph" aria-hidden="true"><use href="/ui/static/assets/icons.svg#fan"></use></svg>
<span><h2>Внешний вентилятор</h2><p id="external-fan-caption">Ожидаем состояние OUT5</p></span>
</div>
<button id="external-fan-toggle" class="glass-switch green" type="button" aria-pressed="false">OFF</button>
</article>
<article class="control-card glass-tile action-card exhaust-action-card">
<div class="action-row">
<div class="action-copy">
<svg class="ui-icon feature-icon orange" aria-hidden="true"><use href="/ui/static/assets/icons.svg#clock"></use></svg>
<div><h2>Таймер</h2><p id="timer-caption">По миганию индикатора скорости</p></div>
</div>
<button id="timer-toggle" class="glass-switch orange compact-switch" type="button" aria-pressed="false">OFF</button>
</div>
<div class="glass-divider"></div>
<div class="action-row">
<div class="action-copy">
<svg class="bulb-icon" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M9 18h6M10 21h4M8.5 14.5A6 6 0 1 1 15.5 14.5c-.9.7-1.5 1.5-1.7 2.5h-3.6c-.2-1-.8-1.8-1.7-2.5Z" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>
<div><h2>Подсветка</h2><p>Без обратной связи по состоянию</p></div>
</div>
<button id="light-toggle" class="aero-button" type="button">Переключить</button>
</div>
</article>
</section>
<section class="content-section glass-section exhaust-status-section" aria-labelledby="status-title">
<div class="section-title">
<div><svg class="ui-icon section-icon" aria-hidden="true"><use href="/ui/static/assets/icons.svg#settings"></use></svg><h2 id="status-title">Связь с контроллером</h2></div>
<span id="updated-at" class="updated">—</span>
</div>
<div class="status-grid">
<article class="status-item glass-tile"><span>MQTT</span><strong id="mqtt-status">—</strong></article>
<article class="status-item glass-tile"><span>ESP32</span><strong id="device-status">—</strong></article>
<article class="status-item glass-tile"><span>Панель Elica</span><strong id="feedback-status">—</strong></article>
<article class="status-item glass-tile"><span>OUT5 физически</span><strong id="relay5-status">—</strong></article>
</div>
<p id="diagnostic-note" class="diagnostic-note">Получаем данные…</p>
</section>
</main>
<script type="module" src="/ui/static/js/exhaust.js"></script>
</body>
</html>
+1 -1
View File
@@ -295,7 +295,7 @@ export function showToast(message, error = false) {
}
export function panelUrl(themeMode = "auto", hash = "") {
const url = new URL("/ui/panel", window.location.origin);
const url = new URL("/ui/tion", window.location.origin);
url.searchParams.set("theme", themeMode);
if (isDemo) url.searchParams.set("demo", "1");
url.hash = hash;