версия 306 добавлено блокирование многократного повторения события в сценарии - *

This commit is contained in:
Dmitry Borisenko
2022-02-03 23:33:39 +01:00
parent 810f3ca061
commit 069ba9ae9f
5 changed files with 26 additions and 4 deletions

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#pragma once
#define FIRMWARE_VERSION 305
#define FIRMWARE_VERSION 306
//#define svelte

View File

@@ -2,8 +2,6 @@
#include <Arduino.h>
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();

View File

@@ -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);

View File

@@ -416,3 +416,14 @@ const String getStateStr() {
break;
}
}
String getAllJson() {
String str;
if (configLiveJson != "{}") {
str += configLiveJson;
}
if (configStoreJson != "{}") {
str += "," + configStoreJson;
}
return str;
}