Websocket Fix, Added Clock NTP Sync, Updated MQTT IP

This commit is contained in:
2025-12-26 09:33:24 +02:00
parent b04590d270
commit 7d9bc42078
6 changed files with 193 additions and 56 deletions

View File

@@ -342,8 +342,11 @@ void setup()
// Set up network callbacks
networking.setNetworkCallbacks(
[]() {
[]() {
communication.onNetworkConnected();
// Sync time with NTP server when network becomes available
LOG_INFO("⏰ Syncing time with NTP server...");
timekeeper.syncTimeWithNTP();
// Start AsyncWebServer when network becomes available
if (networking.getState() != NetworkState::WIFI_PORTAL_MODE) {
LOG_INFO("🚀 Starting AsyncWebServer on port 80...");
@@ -358,7 +361,11 @@ void setup()
if (networking.isConnected()) {
LOG_INFO("Network already connected - triggering MQTT connection");
communication.onNetworkConnected();
// Sync time with NTP server if network is already connected
LOG_INFO("⏰ Syncing time with NTP server...");
timekeeper.syncTimeWithNTP();
// 🔥 CRITICAL: Start AsyncWebServer ONLY when network is ready
// Do NOT start if WiFiManager portal is active (port 80 conflict!)
LOG_INFO("🚀 Starting AsyncWebServer on port 80...");