From a923236ecdca8ce428c1421a8c81d2496eaed194 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 21 Jul 2020 14:31:17 +0200 Subject: [PATCH] send mqtt hearbeat as soon as we have a wifi connection --- src/EMSESPStatusService.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EMSESPStatusService.cpp b/src/EMSESPStatusService.cpp index 381371368..ba3745a01 100644 --- a/src/EMSESPStatusService.cpp +++ b/src/EMSESPStatusService.cpp @@ -28,25 +28,23 @@ EMSESPStatusService::EMSESPStatusService(AsyncWebServer * server, SecurityManage void EMSESPStatusService::onStationModeConnected(WiFiEvent_t event, WiFiEventInfo_t info) { EMSESP::logger().debug(F("Wifi Connected")); } - void EMSESPStatusService::onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info) { EMSESP::logger().debug(F("WiFi Disconnected. Reason code=%d"), info.disconnected.reason); } - void EMSESPStatusService::onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info) { EMSESP::logger().debug(F("WiFi connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname()); + EMSESP::system_.send_heartbeat(); // send out heartbeat MQTT as soon as we have a connection } #elif defined(ESP8266) void EMSESPStatusService::onStationModeConnected(const WiFiEventStationModeConnected & event) { EMSESP::logger().debug(F("Wifi connected with SSID %s"), event.ssid.c_str()); } - void EMSESPStatusService::onStationModeDisconnected(const WiFiEventStationModeDisconnected & event) { EMSESP::logger().debug(F("WiFi Disconnected. Reason code=%d"), event.reason); } - void EMSESPStatusService::onStationModeGotIP(const WiFiEventStationModeGotIP & event) { EMSESP::logger().debug(F("WiFi connected with IP=%s, hostname=%s"), event.ip.toString().c_str(), WiFi.hostname().c_str()); + EMSESP::system_.send_heartbeat(); // send out heartbeat MQTT as soon as we have a connection } #endif