From ce413dc20c4972fc8549c1b1f9c60d835c4744dd Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Fri, 13 Feb 2026 20:21:11 -0800 Subject: [PATCH] snapshot --- doorbell-touch.ino | 47 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/doorbell-touch.ino b/doorbell-touch.ino index e8525e8..abfea3f 100644 --- a/doorbell-touch.ino +++ b/doorbell-touch.ino @@ -31,7 +31,8 @@ struct WiFiCred { const char *ssid; const char *pass; }; WiFiCred wifiNetworks[] = { { "Dobro Veče", "goodnight" }, - { "iot-2GHz", "lesson-greater" }, + { "berylpunk", "dhgwilliam" }, + // { "iot-2GHz", "lesson-greater" }, }; const int NUM_WIFI = sizeof(wifiNetworks) / sizeof(wifiNetworks[0]); WiFiMulti wifiMulti; @@ -447,23 +448,45 @@ void parseMessages(String &response, const char *topicName, bool networkOK = false; void checkNetwork() { - Serial.printf("[NET] WiFi: %s RSSI: %d IP: %s GW: %s DNS: %s\n", - WiFi.SSID().c_str(), - WiFi.RSSI(), - WiFi.localIP().toString().c_str(), - WiFi.gatewayIP().toString().c_str(), - WiFi.dnsIP().toString().c_str()); + Serial.printf("[NET] WiFi: %s RSSI: %d IP: %s\n", + WiFi.SSID().c_str(), WiFi.RSSI(), WiFi.localIP().toString().c_str()); + Serial.printf("[NET] GW: %s DNS: %s\n", + WiFi.gatewayIP().toString().c_str(), WiFi.dnsIP().toString().c_str()); Serial.flush(); - // Test DNS resolution + // Test DNS IPAddress ip; - if (WiFi.hostByName("ntfy.sh", ip)) { - Serial.printf("[NET] ntfy.sh resolved to %s\n", ip.toString().c_str()); + if (!WiFi.hostByName("ntfy.sh", ip)) { + Serial.println("[NET] *** DNS FAILED ***"); + networkOK = false; + return; + } + Serial.printf("[NET] ntfy.sh -> %s\n", ip.toString().c_str()); + + // Test TCP connectivity on port 80 + WiFiClient testClient; + Serial.println("[NET] Testing TCP to ntfy.sh:80..."); + Serial.flush(); + if (testClient.connect("ntfy.sh", 80, 5000)) { + Serial.println("[NET] TCP port 80 OK!"); + testClient.stop(); networkOK = true; } else { - Serial.println("[NET] *** DNS FAILED for ntfy.sh ***"); - networkOK = false; + Serial.println("[NET] *** TCP port 80 BLOCKED ***"); } + + // Test TCP connectivity on port 443 + WiFiClient testClient2; + Serial.println("[NET] Testing TCP to ntfy.sh:443..."); + Serial.flush(); + if (testClient2.connect("ntfy.sh", 443, 5000)) { + Serial.println("[NET] TCP port 443 OK!"); + testClient2.stop(); + networkOK = true; + } else { + Serial.println("[NET] *** TCP port 443 BLOCKED ***"); + } + Serial.flush(); }