edit script to react on command
This commit is contained in:
parent
e14a0edb3c
commit
b5d48be64a
@ -184,6 +184,15 @@ void loadDataFromWeb() {
|
|||||||
int sleepTime = jsonContent["device"]["sleepTime"];
|
int sleepTime = jsonContent["device"]["sleepTime"];
|
||||||
String hostName = jsonContent["device"]["hostname"];
|
String hostName = jsonContent["device"]["hostname"];
|
||||||
String requestState = jsonContent["state"];
|
String requestState = jsonContent["state"];
|
||||||
|
String command = jsonContent["command"];
|
||||||
|
|
||||||
|
if (command == "reset"){
|
||||||
|
ESP.reset();
|
||||||
|
} else if (command == "config") {
|
||||||
|
CleanEeprom();
|
||||||
|
EEPROM.commit();
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestState != "succes") {
|
if (requestState != "succes") {
|
||||||
unsuccessfulRounds++;
|
unsuccessfulRounds++;
|
||||||
|
@ -185,6 +185,7 @@ void loadDataFromWeb() {
|
|||||||
//configuration setup
|
//configuration setup
|
||||||
String hostName = jsonContent["device"]["hostname"];
|
String hostName = jsonContent["device"]["hostname"];
|
||||||
String requestState = jsonContent["state"];
|
String requestState = jsonContent["state"];
|
||||||
|
String command = jsonContent["command"];
|
||||||
if (!buttonActive) {
|
if (!buttonActive) {
|
||||||
state = (int)jsonContent["value"];
|
state = (int)jsonContent["value"];
|
||||||
Serial.println("state: " + (String)state);
|
Serial.println("state: " + (String)state);
|
||||||
@ -194,6 +195,14 @@ void loadDataFromWeb() {
|
|||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command == "reset"){
|
||||||
|
ESP.reset();
|
||||||
|
} else if (command == "config") {
|
||||||
|
CleanEeprom();
|
||||||
|
EEPROM.commit();
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestState != "succes") {
|
if (requestState != "succes") {
|
||||||
unsuccessfulRounds++;
|
unsuccessfulRounds++;
|
||||||
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
||||||
|
@ -198,6 +198,7 @@ void loadDataFromWeb() {
|
|||||||
//configuration setup
|
//configuration setup
|
||||||
String hostName = jsonContent["device"]["hostname"];
|
String hostName = jsonContent["device"]["hostname"];
|
||||||
String requestState = jsonContent["state"];
|
String requestState = jsonContent["state"];
|
||||||
|
String command = jsonContent["command"];
|
||||||
if (!buttonActive) {
|
if (!buttonActive) {
|
||||||
state = (int)jsonContent["value"];
|
state = (int)jsonContent["value"];
|
||||||
Serial.println("state: " + (String)state);
|
Serial.println("state: " + (String)state);
|
||||||
@ -207,6 +208,14 @@ void loadDataFromWeb() {
|
|||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command == "reset"){
|
||||||
|
ESP.reset();
|
||||||
|
} else if (command == "config") {
|
||||||
|
CleanEeprom();
|
||||||
|
EEPROM.commit();
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestState != "succes") {
|
if (requestState != "succes") {
|
||||||
unsuccessfulRounds++;
|
unsuccessfulRounds++;
|
||||||
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
||||||
|
@ -199,6 +199,7 @@ void loadDataFromWeb() {
|
|||||||
//configuration setup
|
//configuration setup
|
||||||
String hostName = jsonContent["device"]["hostname"];
|
String hostName = jsonContent["device"]["hostname"];
|
||||||
String requestState = jsonContent["state"];
|
String requestState = jsonContent["state"];
|
||||||
|
String command = jsonContent["command"];
|
||||||
if (!buttonActive) {
|
if (!buttonActive) {
|
||||||
state = (int)jsonContent["value"];
|
state = (int)jsonContent["value"];
|
||||||
Serial.println("state: " + (String)state);
|
Serial.println("state: " + (String)state);
|
||||||
@ -208,6 +209,14 @@ void loadDataFromWeb() {
|
|||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command == "reset"){
|
||||||
|
ESP.reset();
|
||||||
|
} else if (command == "config") {
|
||||||
|
CleanEeprom();
|
||||||
|
EEPROM.commit();
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
|
||||||
if (requestState != "succes") {
|
if (requestState != "succes") {
|
||||||
unsuccessfulRounds++;
|
unsuccessfulRounds++;
|
||||||
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5");
|
||||||
|
Loading…
Reference in New Issue
Block a user