diff --git a/WaterishOS-core2.0/WaterishOS-core2.0.ino b/WaterishOS-core3.0/WaterishOS-core3.0.ino similarity index 86% rename from WaterishOS-core2.0/WaterishOS-core2.0.ino rename to WaterishOS-core3.0/WaterishOS-core3.0.ino index fb0c0ca..99159a5 100644 --- a/WaterishOS-core2.0/WaterishOS-core2.0.ino +++ b/WaterishOS-core3.0/WaterishOS-core3.0.ino @@ -1,3 +1,4 @@ +#include #include #include #include @@ -69,6 +70,22 @@ void updatemqtt() { mqtt.publish("/waterishos/node" + nodename + "/flowrate2", String(sensor2.getCurrentFlowrate())); mqtt.publish("/waterishos/node" + nodename + "/volume2", String(sensor2.getTotalVolume())); } +// Copyright Siwat INC(tm) 2019 +// Created by Siwat Sirichai +// ESPCommander EXTENDED v1.2 +// For Legal Distribution of this code, the comment must not be removed! +void espcommander(String topic, String rawcommand) { + StaticJsonDocument<200> doc; + DeserializationError error = deserializeJson(doc, rawcommand); + if (error) { + Serial.print(F("deserializeJson() failed: ")); + Serial.println(error.c_str()); + return; + } + const char* command = doc["command"]; + const char* value = doc["value"]; +} +//END OF ESPCOMMANDER CODE void setup() { lcd.begin(); writelcd(" Siwat INC (tm) "," Waterish OS"); @@ -117,6 +134,7 @@ void setup() { writelcd(" Telemetry Node","siwatsystem.com"); if (client.connect("waterishos",telemetryuser,telemetrykey)) { writelcd(" Telemetry Node","Connected"); + mqtt.subscribe("/waterishos/node" + nodename + "command", espcommander); delay(1000); } else { writelcd(" Telemetry Node"," Failed Offline"); diff --git a/WaterishOS-core2.0/config.h b/WaterishOS-core3.0/config.h similarity index 100% rename from WaterishOS-core2.0/config.h rename to WaterishOS-core3.0/config.h diff --git a/WaterishOS-core2.0/lcdcontrol.h b/WaterishOS-core3.0/lcdcontrol.h similarity index 100% rename from WaterishOS-core2.0/lcdcontrol.h rename to WaterishOS-core3.0/lcdcontrol.h