mirror of
https://github.com/Lomanic/presence-button
synced 2024-11-21 21:07:30 +00:00
Ping presence-button.glitch.me via (insecure) HTTPS
This commit is contained in:
parent
4c74d44d02
commit
a0d852c1ed
9
main.ino
9
main.ino
@ -9,6 +9,8 @@
|
|||||||
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
|
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
|
||||||
#include <ESP8266mDNS.h> // https://tttapa.github.io/ESP8266/Chap08%20-%20mDNS.html
|
#include <ESP8266mDNS.h> // https://tttapa.github.io/ESP8266/Chap08%20-%20mDNS.html
|
||||||
|
|
||||||
|
#include <WiFiClientSecure.h>
|
||||||
|
|
||||||
//for LED status
|
//for LED status
|
||||||
#include <Ticker.h>
|
#include <Ticker.h>
|
||||||
Ticker ticker;
|
Ticker ticker;
|
||||||
@ -258,10 +260,11 @@ void morseSOSLED() { // ... ___ ...
|
|||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BearSSL::WiFiClientSecure secureClient;
|
||||||
HTTPClient http2;
|
HTTPClient http2;
|
||||||
// http2.setReuse(true);
|
// http2.setReuse(true);
|
||||||
void notifyFuzIsOpen() {
|
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());
|
http2.setAuthorization(matrixUsername.c_str(), matrixPassword.c_str());
|
||||||
int httpCode = http2.GET();
|
int httpCode = http2.GET();
|
||||||
Serial.println("GET status return code: " + String(httpCode));
|
Serial.println("GET status return code: " + String(httpCode));
|
||||||
@ -436,6 +439,8 @@ void setup() {
|
|||||||
Serial.println("mDNS responder started");
|
Serial.println("mDNS responder started");
|
||||||
}
|
}
|
||||||
MDNS.addService("http", "tcp", 80);
|
MDNS.addService("http", "tcp", 80);
|
||||||
|
|
||||||
|
secureClient.setInsecure();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool buttonState = HIGH;
|
bool buttonState = HIGH;
|
||||||
@ -480,6 +485,6 @@ void loop() {
|
|||||||
digitalWrite(RELAY_PIN, LOW);
|
digitalWrite(RELAY_PIN, LOW);
|
||||||
fuzIsOpen = true;
|
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;
|
previousButtonState = buttonState;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user