Files
home_automatization_control…/growbox/growbox.ino
cacto bb85c617a4 Добавлен локальный веб-интерфейс и распиновка в README
Плата поднимает страницу + JSON API (/api/state, /api/command) на порту 80
для наблюдения и управления актуаторами независимо от MQTT/Laravel.
Команда с веб-UI публикует тот же ack в devices/{id}/ack, что и MQTT-команда,
поэтому device shadow платформы не расходится с реальным состоянием.
Включается/выключается флагом ENABLE_WEB_UI в config.h.

В README добавлены ASCII-схема подключения DHT22/реле и раздел про сборку
через arduino-cli (включая обходной путь для проблемы с правами на
~/Documents/Arduino на macOS).
2026-08-11 19:27:41 +05:00

36 lines
888 B
Arduino
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Контроллер зоны "Гроубокс" для платформы home_automatization.
// Одна плата ESP32 владеет четырьмя устройствами зоны:
// sensor-1 (DHT22, телеметрия temperature/humidity)
// light-1, pump-1, fan-1 (реле, turn_on/turn_off/set_level)
// Протокол общения с device-control-service/ingest-service описан в README.md.
#include "config.h"
#include "devices.h"
#include "mqtt_link.h"
#include "net.h"
#include "telemetry.h"
#include "time_sync.h"
#include "web_ui.h"
void setup() {
Serial.begin(115200);
devicesBegin();
netBegin();
timeSyncBegin();
mqttBegin();
telemetryBegin();
#if ENABLE_WEB_UI
webUiBegin();
#endif
}
void loop() {
netEnsureConnected();
mqttEnsureConnected();
mqttLoop();
telemetryTick();
#if ENABLE_WEB_UI
webUiHandle();
#endif
}