Skip to content

Commit a011a40

Browse files
committed
First go at force update of value
1 parent ddf86d3 commit a011a40

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/MqttEntry.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class MqttEntry {
1212

1313
char* name = "N/A";
1414
int interval = -1;
15+
int force = 0;
1516
unsigned long lastUpdate = 0; // Last read of data
1617
String lastValue = "";
1718

@@ -61,8 +62,13 @@ class MqttEntry {
6162
lastUpdate = time;
6263
String value = inFunction();
6364
if (value != "") {
64-
publish(value);
65-
lastValue = value;
65+
if(value != lastValue || force >= 10) {
66+
publish(value);
67+
lastValue = value;
68+
force = 0;
69+
} else {
70+
force++;
71+
}
6672
}
6773
}
6874
}

0 commit comments

Comments
 (0)