Merge pull request #3 in WAT/waterishos-revision3.0x from develop to master
* commit '9c557b1f8e66fa35a7483279f0b0f920ba07c0ad': Fix bugs add espcommander Preparing ESPCommander Intergration
This commit is contained in:
commit
763b934796
|
@ -1,3 +1,4 @@
|
|||
#include <ArduinoJson.h>
|
||||
#include <LiquidCrystal_I2C.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <MqttWildcard.h>
|
||||
|
@ -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");
|
Loading…
Reference in New Issue