summaryrefslogtreecommitdiff
path: root/platformio
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-06-06 17:19:24 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-06-06 17:19:24 +0300
commit940d88d301b3f4fca51f5958b4c7562d977e1905 (patch)
tree5c200fb9d445b2308e78079c3544fd24ca2ae585 /platformio
parentea5cc50729acfd306a9b025fd7ca8e621facdfae (diff)
mqtt fix in esp8266 code
Diffstat (limited to 'platformio')
-rw-r--r--platformio/common/libs/mqtt/homekit/mqtt/module.h4
-rw-r--r--platformio/common/libs/mqtt/homekit/mqtt/mqtt.cpp13
-rw-r--r--platformio/common/libs/mqtt/library.json2
3 files changed, 12 insertions, 7 deletions
diff --git a/platformio/common/libs/mqtt/homekit/mqtt/module.h b/platformio/common/libs/mqtt/homekit/mqtt/module.h
index e4a01f8..abf7d94 100644
--- a/platformio/common/libs/mqtt/homekit/mqtt/module.h
+++ b/platformio/common/libs/mqtt/homekit/mqtt/module.h
@@ -39,6 +39,10 @@ public:
initialized = true;
}
+ inline void unsetInitialized() {
+ initialized = false;
+ }
+
inline short getTickInterval() {
return tickInterval;
}
diff --git a/platformio/common/libs/mqtt/homekit/mqtt/mqtt.cpp b/platformio/common/libs/mqtt/homekit/mqtt/mqtt.cpp
index 16f4675..0e58833 100644
--- a/platformio/common/libs/mqtt/homekit/mqtt/mqtt.cpp
+++ b/platformio/common/libs/mqtt/homekit/mqtt/mqtt.cpp
@@ -53,11 +53,12 @@ Mqtt::Mqtt() {
if (module->receiveOnDisconnect) {
module->handleOnDisconnect(reason);
}
+ module->unsetInitialized();
}
- reconnectTimer.once(2, [&]() {
- reconnect();
- });
+ reconnectTimer.once(2, [&]() {
+ reconnect();
+ });
});
client.onSubscribe([&](uint16_t packetId, const SubscribeReturncode* returncodes, size_t len) {
@@ -126,8 +127,8 @@ void Mqtt::disconnect() {
void Mqtt::loop() {
client.loop();
for (auto& module: modules) {
- if (module->getTickInterval() != 0)
- module->tick(*this);
+ if (module->getTickInterval() != 0)
+ module->tick(*this);
}
}
@@ -157,7 +158,7 @@ void Mqtt::addModule(MqttModule* module) {
void Mqtt::subscribeModule(String& topic, MqttModule* module, uint8_t qos) {
moduleSubscriptions[topic] = module;
- subscribe(topic, qos);
+ subscribe(topic, qos);
}
}
diff --git a/platformio/common/libs/mqtt/library.json b/platformio/common/libs/mqtt/library.json
index d1ad420..2712fb8 100644
--- a/platformio/common/libs/mqtt/library.json
+++ b/platformio/common/libs/mqtt/library.json
@@ -1,6 +1,6 @@
{
"name": "homekit_mqtt",
- "version": "1.0.9",
+ "version": "1.0.10",
"build": {
"flags": "-I../../include"
}