From 28480adb1527d9d26fa502c5dbb20b266109c360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=85=E7=95=99=E3=83=A1=E8=9A=8A=E5=AD=90?= Date: Mon, 17 Feb 2020 11:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=8A=B6=E6=80=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8retained?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/extensions.json | 12 ++++++------ lib/esp_framework/src/Mqtt.cpp | 6 +++--- platformio.ini | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 272828b..e80666b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,7 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ] -} \ No newline at end of file + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} diff --git a/lib/esp_framework/src/Mqtt.cpp b/lib/esp_framework/src/Mqtt.cpp index 8d27461..521c948 100644 --- a/lib/esp_framework/src/Mqtt.cpp +++ b/lib/esp_framework/src/Mqtt.cpp @@ -31,7 +31,7 @@ bool Mqtt::mqttConnect() Debug::AddInfo(PSTR("client mqtt not connected, trying to connect to %s:%d Broker"), globalConfig.mqtt.server, globalConfig.mqtt.port); mqttClient.setServer(globalConfig.mqtt.server, globalConfig.mqtt.port); - if (mqttClient.connect(UID, globalConfig.mqtt.user, globalConfig.mqtt.pass, getTeleTopic(F("availability")).c_str(), 0, false, "offline")) + if (mqttClient.connect(UID, globalConfig.mqtt.user, globalConfig.mqtt.pass, getTeleTopic(F("availability")).c_str(), 0, true, "offline")) { Debug::AddInfo(PSTR("successful client mqtt connection")); if (connectedcallback != NULL) @@ -58,7 +58,7 @@ void Mqtt::doReportHeartbeat() void Mqtt::availability() { - publish(getTeleTopic(F("availability")), "online", false); + publish(getTeleTopic(F("availability")), "online", true); } void Mqtt::perSecondDo() @@ -99,7 +99,7 @@ void Mqtt::loop() { doReportHeartbeat(); } - if (perSecond % 309 == 0) + if (perSecond % 3609 == 0) { availability(); } diff --git a/platformio.ini b/platformio.ini index 0a4d3a1..c92e4c6 100644 --- a/platformio.ini +++ b/platformio.ini @@ -51,7 +51,7 @@ extra_scripts = scripts/strip-floats.py lib_deps = PubSubClient - Nanopb@0.3.9.2 + Nanopb=https://github.com/nanopb/nanopb.git#nanopb-0.3.9.5 [env:dc1] lib_deps = ${env.lib_deps}