From 0a9ea7eebb6853b03df012e5dd315e96e404f413 Mon Sep 17 00:00:00 2001 From: Tilman Date: Wed, 15 Sep 2021 09:26:09 +0200 Subject: [PATCH] Doorbell Speaker status --- doorbell/Doorbell-Speaker.ino | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/doorbell/Doorbell-Speaker.ino b/doorbell/Doorbell-Speaker.ino index 7f45ec0..995a733 100644 --- a/doorbell/Doorbell-Speaker.ino +++ b/doorbell/Doorbell-Speaker.ino @@ -102,7 +102,17 @@ void loop() { // if the current line is blank, you got two newline characters in a row. // that's the end of the client HTTP request, so send a response: if (currentLine.length() == 0) { - if (header.indexOf("GET /volume") >= 0) { + if (header.indexOf("GET /status") >= 0) { + client.println("HTTP/1.1 200 OK"); + client.println("Content-type: application/json; charset=utf-8"); + client.println("Connection: close"); + client.println(); + client.println("{"); + client.println(" \"status\": true"); + client.println("}"); + break; + } + else if (header.indexOf("GET /volume") >= 0) { client.println("HTTP/1.1 200 OK"); client.println("Content-type: application/json; charset=utf-8"); client.println("Connection: close"); @@ -236,22 +246,22 @@ void loop() { String printDetail(uint8_t type, int value){ switch (type) { case TimeOut: - return "Time Out!"; + return "Time Out"; break; case WrongStack: - return "Stack Wrong!"; + return "Stack Wrong"; break; case DFPlayerCardInserted: - return "Card Inserted!"; + return "Card Inserted"; break; case DFPlayerCardRemoved: - return "Card Removed!"; + return "Card Removed"; break; case DFPlayerCardOnline: - return "Card Online!"; + return "Card Online"; break; case DFPlayerPlayFinished: - return "Play Finished!"; + return "Play Finished"; break; case DFPlayerError: switch (value) {