From 069ba9ae9f5c6888eb951ca630e315acf9273aab Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Thu, 3 Feb 2022 23:33:39 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20306=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=B1?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=D0=BA=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B2=20=D1=81=D1=86=D0=B5=D0=BD=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B8=20-=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_esp/set.device.json.gz | Bin 3141 -> 3141 bytes include/Consts.h | 2 +- include/MqttClient.h | 4 ++-- src/BufferExecute.cpp | 13 ++++++++++++- src/MqttClient.cpp | 11 +++++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/data_esp/set.device.json.gz b/data_esp/set.device.json.gz index ad9860a6ff35a34626d76ec29c1a7fac5926a493..b365adb556731bd01eb167a5777da45fa2042e00 100644 GIT binary patch delta 33 pcmX>qaa4j`zMF%CE8@>a_H~R*eKDK2Gq!PYEKnEHb24UN006fq39JAB delta 33 pcmX>qaa4j`zMF$XtMlPT_H~R*eDRyNGq!PYSeMNH;bhFf006p#3ZMW0 diff --git a/include/Consts.h b/include/Consts.h index 7bf62928..e086a38d 100644 --- a/include/Consts.h +++ b/include/Consts.h @@ -1,6 +1,6 @@ #pragma once -#define FIRMWARE_VERSION 305 +#define FIRMWARE_VERSION 306 //#define svelte diff --git a/include/MqttClient.h b/include/MqttClient.h index 45189279..850d79f6 100644 --- a/include/MqttClient.h +++ b/include/MqttClient.h @@ -2,8 +2,6 @@ #include - - void mqttInit(); void selectBroker(); void getMqttData1(); @@ -29,3 +27,5 @@ void publishState(); void mqttCallback(char* topic, uint8_t* payload, size_t length); const String getStateStr(); + +String getAllJson(); diff --git a/src/BufferExecute.cpp b/src/BufferExecute.cpp index 74817482..21feaa94 100644 --- a/src/BufferExecute.cpp +++ b/src/BufferExecute.cpp @@ -24,6 +24,7 @@ #include "items/vSensorSHT20.h" #include "items/vSensorUltrasonic.h" #include "items/vSensorUptime.h" +#include "MqttClient.h" void loopCmdAdd(const String& cmdStr) { if (cmdStr.endsWith(",")) { @@ -103,7 +104,7 @@ void csvCmdExecute(String& cmdStr) { #ifdef EnableSensorUltrasonic sCmd.addCommand(order.c_str(), ultrasonic); #endif -//ИНТЕГРИРУЮ: Первая интеграция в ядро. Следим за наименованием + //ИНТЕГРИРУЮ: Первая интеграция в ядро. Следим за наименованием } else if (order == F("dallas-temp")) { #ifdef EnableSensorDallas sCmd.addCommand(order.c_str(), dallas); @@ -182,6 +183,16 @@ void spaceCmdExecute(String& cmdStr) { cmdStr.replace("\r", "\n"); while (cmdStr.length()) { String buf = selectToMarker(cmdStr, "\n"); + if (buf.indexOf("*") != -1) { + buf.replace("*", ""); + String order = selectToMarker(buf, " "); + String newValue = selectToMarkerLast(buf, " "); + String allJson = getAllJson(); + String currentValue = jsonReadStr(allJson, order); + if (newValue == currentValue) { + buf = ""; + } + } if (buf != "") { sCmd.readStr(buf); SerialPrint("I", F("Order done W"), buf); diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index c122f19b..3f055f52 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -416,3 +416,14 @@ const String getStateStr() { break; } } + +String getAllJson() { + String str; + if (configLiveJson != "{}") { + str += configLiveJson; + } + if (configStoreJson != "{}") { + str += "," + configStoreJson; + } + return str; +}