Optimization

This commit is contained in:
Dmitry Borisenko
2020-10-20 22:55:45 +03:00
parent 6064b9eac9
commit a5171f1178
25 changed files with 69 additions and 116 deletions

View File

@@ -231,9 +231,6 @@ void publishWidgets() {
void publishState() {
// берет строку json и ключи превращает в топики а значения колючей в них посылает
// {"name":"MODULES","lang":"","ip":"192.168.43.60","DS":"34.00","rel1":"1","rel2":"1"}
// "name":"MODULES","lang":"","ip":"192.168.43.60","DS":"34.00","rel1":"1","rel2":"1"
// "name":"MODULES","lang":"","ip":"192.168.43.60","DS":"34.00","rel1":"1","rel2":"1",
String str = configLiveJson;
str.replace("{", "");
str.replace("}", "");
@@ -242,13 +239,13 @@ void publishState() {
while (str.length()) {
String tmp = selectToMarker(str, ",");
String topic = selectToMarker(tmp, ":");
String topic = selectToMarker(tmp, "\":");
topic.replace("\"", "");
String state = selectToMarkerLast(tmp, ":");
String state = selectToMarkerLast(tmp, "\":");
state.replace("\"", "");
if ((topic != "time") && (topic != "name") && (topic != "lang") && (topic != "ip") && (topic.indexOf("_in") < 0)) {
if (topic != "timenow") {
publishStatus(topic, state);
}
str = deleteBeforeDelimiter(str, ",");