mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
версия 306 добавлено блокирование многократного повторения события в сценарии - *
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define FIRMWARE_VERSION 305
|
#define FIRMWARE_VERSION 306
|
||||||
|
|
||||||
//#define svelte
|
//#define svelte
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void mqttInit();
|
void mqttInit();
|
||||||
void selectBroker();
|
void selectBroker();
|
||||||
void getMqttData1();
|
void getMqttData1();
|
||||||
@@ -29,3 +27,5 @@ void publishState();
|
|||||||
|
|
||||||
void mqttCallback(char* topic, uint8_t* payload, size_t length);
|
void mqttCallback(char* topic, uint8_t* payload, size_t length);
|
||||||
const String getStateStr();
|
const String getStateStr();
|
||||||
|
|
||||||
|
String getAllJson();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "items/vSensorSHT20.h"
|
#include "items/vSensorSHT20.h"
|
||||||
#include "items/vSensorUltrasonic.h"
|
#include "items/vSensorUltrasonic.h"
|
||||||
#include "items/vSensorUptime.h"
|
#include "items/vSensorUptime.h"
|
||||||
|
#include "MqttClient.h"
|
||||||
|
|
||||||
void loopCmdAdd(const String& cmdStr) {
|
void loopCmdAdd(const String& cmdStr) {
|
||||||
if (cmdStr.endsWith(",")) {
|
if (cmdStr.endsWith(",")) {
|
||||||
@@ -103,7 +104,7 @@ void csvCmdExecute(String& cmdStr) {
|
|||||||
#ifdef EnableSensorUltrasonic
|
#ifdef EnableSensorUltrasonic
|
||||||
sCmd.addCommand(order.c_str(), ultrasonic);
|
sCmd.addCommand(order.c_str(), ultrasonic);
|
||||||
#endif
|
#endif
|
||||||
//ИНТЕГРИРУЮ: Первая интеграция в ядро. Следим за наименованием
|
//ИНТЕГРИРУЮ: Первая интеграция в ядро. Следим за наименованием
|
||||||
} else if (order == F("dallas-temp")) {
|
} else if (order == F("dallas-temp")) {
|
||||||
#ifdef EnableSensorDallas
|
#ifdef EnableSensorDallas
|
||||||
sCmd.addCommand(order.c_str(), dallas);
|
sCmd.addCommand(order.c_str(), dallas);
|
||||||
@@ -182,6 +183,16 @@ void spaceCmdExecute(String& cmdStr) {
|
|||||||
cmdStr.replace("\r", "\n");
|
cmdStr.replace("\r", "\n");
|
||||||
while (cmdStr.length()) {
|
while (cmdStr.length()) {
|
||||||
String buf = selectToMarker(cmdStr, "\n");
|
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 != "") {
|
if (buf != "") {
|
||||||
sCmd.readStr(buf);
|
sCmd.readStr(buf);
|
||||||
SerialPrint("I", F("Order done W"), buf);
|
SerialPrint("I", F("Order done W"), buf);
|
||||||
|
|||||||
@@ -416,3 +416,14 @@ const String getStateStr() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getAllJson() {
|
||||||
|
String str;
|
||||||
|
if (configLiveJson != "{}") {
|
||||||
|
str += configLiveJson;
|
||||||
|
}
|
||||||
|
if (configStoreJson != "{}") {
|
||||||
|
str += "," + configStoreJson;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user