mirror of
https://github.com/Lomanic/presence-button
synced 2024-11-22 05:17:30 +00:00
Fix HTTP polling to presence-button.glitch.me, randomly crashing after some time
This commit is contained in:
parent
450fdfcddf
commit
b7ec6df8ec
14
main.ino
14
main.ino
@ -14,7 +14,7 @@
|
|||||||
Ticker ticker;
|
Ticker ticker;
|
||||||
|
|
||||||
const byte RELAY_PIN = 12;
|
const byte RELAY_PIN = 12;
|
||||||
const byte LED_PIN = 2; // 13 for Sonoff S20, 2 for NodeMCU/ESP12 internal LED
|
const byte LED_PIN = 13; // 13 for Sonoff S20, 2 for NodeMCU/ESP12 internal LED
|
||||||
const byte BUTTON_PIN = 0;
|
const byte BUTTON_PIN = 0;
|
||||||
|
|
||||||
bool fuzIsOpen = false;
|
bool fuzIsOpen = false;
|
||||||
@ -320,12 +320,14 @@ void morseSOSLED() { // ... ___ ...
|
|||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HTTPClient http2;
|
||||||
|
// http2.setReuse(true);
|
||||||
void notifyFuzIsOpen() {
|
void notifyFuzIsOpen() {
|
||||||
HTTPClient http;
|
http2.begin("http://presence-button.glitch.me/status?fuzisopen=" + String(fuzIsOpen));
|
||||||
http.begin("http://presence-button.glitch.me/status?fuzisopen=" + String(fuzIsOpen));
|
http2.setAuthorization(matrixUsername.c_str(), matrixPassword.c_str());
|
||||||
http.setAuthorization(matrixUsername.c_str(), matrixPassword.c_str());
|
int httpCode = http2.GET();
|
||||||
http.GET();
|
Serial.println("GET status return code: " + String(httpCode));
|
||||||
Serial.println("GET status body: " + http.getString());
|
http2.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loggedInMatrix = false;
|
bool loggedInMatrix = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user