File tree Expand file tree Collapse file tree 3 files changed +8
-22
lines changed Expand file tree Collapse file tree 3 files changed +8
-22
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,10 @@ class EasyMqtt : public MqttEntry {
100
100
#endif
101
101
deviceId = String (ESP.getChipId ());
102
102
103
- setInterval (10 );
103
+ setInterval (60 );
104
+ setForce (10 );
104
105
105
- get (" system" ).setInterval (30 );
106
+ get (" system" ).setInterval (300 );
106
107
get (" system" )[" deviceId" ] << [this ]() {
107
108
return deviceId;
108
109
};
@@ -116,15 +117,15 @@ class EasyMqtt : public MqttEntry {
116
117
// Setup wifi diag
117
118
get (" system" )[" wifi" ][" rssi" ] << []() {
118
119
return String (WiFi.RSSI ());
119
- }
120
+ };
120
121
get (" system" )[" wifi" ][" quality" ] << []() {
121
122
int rssi = WiFi.RSSI ();
122
123
int quality = 0 ;
123
124
if (rssi <= -100 ) {
124
125
} else if (rssi >= -50 ) {
125
- rssi = 100 ;
126
+ quality = 100 ;
126
127
} else {
127
- quality = 2 * (RSSI + 100 );
128
+ quality = 2 * (rssi + 100 );
128
129
}
129
130
return String (quality);
130
131
};
@@ -156,19 +157,6 @@ class EasyMqtt : public MqttEntry {
156
157
debug (key + " = " + value);
157
158
}
158
159
159
- void debug (String msg) {
160
- #ifdef DEBUG
161
- Serial.println (msg);
162
- #endif
163
- if (mqttClient.connected ()) {
164
- get (" system/debug" ).publish (msg);
165
- }
166
- }
167
-
168
- void debug (String key, String value) {
169
- debug (key + " = " + value);
170
- }
171
-
172
160
String getDeviceId () {
173
161
return deviceId;
174
162
}
Original file line number Diff line number Diff line change @@ -39,8 +39,6 @@ class MqttEntry {
39
39
40
40
protected:
41
41
MqttEntry (const char * name, PubSubClient& mqttClient) {
42
- interval = 5 ;
43
- forceUpdate = 10 ;
44
42
client = &mqttClient;
45
43
setName (name);
46
44
}
@@ -53,7 +51,7 @@ class MqttEntry {
53
51
}
54
52
child = child->next ;
55
53
}
56
- return addChild (new MqttEntry (name, client));
54
+ return addChild (new MqttEntry (name, * client));
57
55
}
58
56
59
57
MqttEntry *getRoot () {
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ class WebPortal {
102
102
}
103
103
104
104
void handleRest () {
105
- MqttEntry* entry = &mqtt->get (webServer->uri ().substring (6 ));
105
+ MqttEntry* entry = &mqtt->get (webServer->uri ().substring (6 ). c_str () );
106
106
if (webServer->method () == HTTP_GET && entry->isIn ()) {
107
107
webServer->send (200 , " text/plain" , entry->getValue ());
108
108
} else if (webServer->method () == HTTP_POST && entry->isOut ()) {
You can’t perform that action at this time.
0 commit comments