Last active
September 21, 2018 08:57
-
-
Save linusheck/8ba678d3e5935a3669e89e6484e47b1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <ESP8266HTTPClient.h> | |
const char* POST_TO = /* local IP of router here */; | |
// Sensitive data omitted | |
const char* POST_REQUEST = "ACT=LOGI%40LTYP=1%40MAC=%40IP=%40ERV=%40URL=%40PUB=1%40MEDM=0%40USR=%40PASS="; | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
WiFi.begin(/* network name */); | |
Serial.println(); | |
Serial.print("Connecting"); | |
while (WiFi.status() != WL_CONNECTED) { | |
delay(1000); | |
Serial.print("."); | |
} | |
Serial.println("Connected!"); | |
Serial.println("Posting"); | |
HTTPClient http; | |
http.begin(POST_TO); | |
http.POST(POST_REQUEST); | |
http.writeToStream(&Serial); | |
http.end(); | |
WiFi.disconnect(); | |
WiFi.forceSleepBegin(); | |
delay(10*60*1000); | |
WiFi.forceSleepWake(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment