diff --git a/data_esp/set.device.json.gz b/data_esp/set.device.json.gz index ad9860a6..b365adb5 100644 Binary files a/data_esp/set.device.json.gz and b/data_esp/set.device.json.gz differ 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; +}