[BT] Regular BLE system parameter pub (#1422)

Publish BT config parameter at start so as to update the switch statuses in the controller
Also publish regularly in case of controller restart
Also move btqsum, btqsnd and btqavg to BTtoMQTT topic instead of SYStoMQTT as they are more relevant here
This commit is contained in:
Florian authored and GitHub committed 2023-01-26 08:18:44 -06:00
1 parent 150603555c
commit a64acab7c8
2 files changed
+53 -34

No files matched your search

+3 -9
View File
@@ -1492,6 +1492,9 @@ void loop() {
if (now > (timer_sys_measures + (TimeBetweenReadingSYS * 1000)) || !timer_sys_measures) {
timer_sys_measures = millis();
stateMeasures();
# ifdef ZgatewayBT
stateBTMeasures(false);
# endif
}
#endif
#ifdef ZsensorBME280
@@ -1562,12 +1565,7 @@ void loop() {
if (disc)
launchBTDiscovery(publishDiscovery);
# endif
# ifndef ESP32
if (BTtoMQTT())
Log.trace(F("BTtoMQTT OK" CR));
# else
emptyBTQueue();
# endif
#endif
#ifdef ZgatewaySRFB
SRFBtoMQTT();
@@ -1705,10 +1703,6 @@ void stateMeasures() {
# ifdef ZgatewayBT
# ifdef ESP32
SYSdata["lowpowermode"] = (int)lowpowermode;
SYSdata["btqblck"] = btQueueBlocked;
SYSdata["btqsum"] = btQueueLengthSum;
SYSdata["btqsnd"] = btQueueLengthCount;
SYSdata["btqavg"] = (btQueueLengthCount > 0 ? btQueueLengthSum / (float)btQueueLengthCount : 0);
# endif
SYSdata["interval"] = BTConfig.BLEinterval;
SYSdata["scanbcnct"] = BTConfig.BLEscanBeforeConnect;