diff --git a/src/main.cpp b/src/main.cpp index af48783..a422dc2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,6 +10,11 @@ #include #include +#define FIRMWARE "2.0" +#define BOARD "ESP32" +#define SERVICE "LEDChooser" +const String STATUSURL = "http://moon.basement.lan/l/boardstatus.php"; + // Pins Used: // 4, 13, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33, 34, 36, 39 @@ -337,6 +342,16 @@ void configModeCallback (WiFiManager *myWiFiManager) { oled.display(); } +void sendDeviceStatus() { + WiFiClient client; + HTTPClient http; + http.begin(client, STATUSURL.c_str()); + http.addHeader("Content-Type", "application/x-www-form-urlencoded"); + String httpData = "mac=" + WiFi.macAddress() + "&board=" + BOARD + "&firmware=" + FIRMWARE + "&service=" + SERVICE; + int httpResponseCode = http.POST(httpData); + http.end(); +} + void setup() { // Set COLORMODEPIN to INTPUT_PULLUP pinMode(COLORMODEPIN, INPUT_PULLUP); @@ -436,6 +451,7 @@ void setup() { WiFiManager wifiManager; wifiManager.setAPCallback(configModeCallback); wifiManager.autoConnect("LEDChooser"); + sendDeviceStatus(); ArduinoOTA .onStart([]() { String type;