From a0d852c1ed49de9c049d2704f0af9fc154c130fd Mon Sep 17 00:00:00 2001 From: Lomanic Date: Mon, 24 Feb 2020 23:35:01 +0100 Subject: [PATCH] Ping presence-button.glitch.me via (insecure) HTTPS --- main.ino | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.ino b/main.ino index 6771a84..77d9a4a 100644 --- a/main.ino +++ b/main.ino @@ -9,6 +9,8 @@ #include //https://github.com/bblanchon/ArduinoJson #include // https://tttapa.github.io/ESP8266/Chap08%20-%20mDNS.html +#include + //for LED status #include Ticker ticker; @@ -258,10 +260,11 @@ void morseSOSLED() { // ... ___ ... delay(500); } +BearSSL::WiFiClientSecure secureClient; HTTPClient http2; // http2.setReuse(true); void notifyFuzIsOpen() { - http2.begin("http://presence-button.glitch.me/status?fuzisopen=" + String(fuzIsOpen)); + http2.begin(secureClient, "https://presence-button.glitch.me/status?fuzisopen=" + String(fuzIsOpen)); http2.setAuthorization(matrixUsername.c_str(), matrixPassword.c_str()); int httpCode = http2.GET(); Serial.println("GET status return code: " + String(httpCode)); @@ -436,6 +439,8 @@ void setup() { Serial.println("mDNS responder started"); } MDNS.addService("http", "tcp", 80); + + secureClient.setInsecure(); } bool buttonState = HIGH; @@ -480,6 +485,6 @@ void loop() { digitalWrite(RELAY_PIN, LOW); fuzIsOpen = true; } - digitalWrite(LED_PIN, LOW); // light up the LED, in case we encounter temporary failure in getMessages() + digitalWrite(LED_PIN, LOW); // ensure the LED is lit previousButtonState = buttonState; }