From f29e139cbb7e4a4d539cba6e894ef4a6acd312d6 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 31 May 2023 09:22:00 +0300 Subject: WIP: big refactoring --- .../common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp | 2 +- .../common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h | 2 +- platformio/common/libs/mqtt_module_temphum/library.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'platformio/common/libs/mqtt_module_temphum') diff --git a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp index 82f1d74..409f38f 100644 --- a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp +++ b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp @@ -4,7 +4,7 @@ namespace homekit::mqtt { static const char TOPIC_TEMPHUM_DATA[] = "temphum/data"; -void MqttTemphumModule::init(Mqtt &mqtt) {} +void MqttTemphumModule::onConnect(Mqtt &mqtt) {} void MqttTemphumModule::tick(homekit::mqtt::Mqtt& mqtt) { if (!tickElapsed()) diff --git a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h index 5c41cef..7b28afc 100644 --- a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h +++ b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h @@ -19,7 +19,7 @@ private: public: MqttTemphumModule(temphum::Sensor* _sensor) : MqttModule(10), sensor(_sensor) {} - void init(Mqtt& mqtt) override; + void onConnect(Mqtt& mqtt) override; void tick(Mqtt& mqtt) override; }; diff --git a/platformio/common/libs/mqtt_module_temphum/library.json b/platformio/common/libs/mqtt_module_temphum/library.json index 9bb8cf1..068debd 100644 --- a/platformio/common/libs/mqtt_module_temphum/library.json +++ b/platformio/common/libs/mqtt_module_temphum/library.json @@ -1,11 +1,11 @@ { "name": "homekit_mqtt_module_temphum", - "version": "1.0.9", + "version": "1.0.10", "build": { "flags": "-I../../include" }, "dependencies": { - "homekit_mqtt": "file://../common/libs/mqtt", + "homekit_mqtt": "file://../common/libs/mqtt", "homekit_temphum": "file://../common/libs/temphum" } } -- cgit v1.2.3 From a6d8ba93056c1a4e243d56da447e241b2504fae2 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 10 Jun 2023 23:20:37 +0300 Subject: move files again --- .../homekit/mqtt/module/temphum.cpp | 23 ------------------ .../homekit/mqtt/module/temphum.h | 28 ---------------------- .../common/libs/mqtt_module_temphum/library.json | 11 --------- 3 files changed, 62 deletions(-) delete mode 100644 platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp delete mode 100644 platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h delete mode 100644 platformio/common/libs/mqtt_module_temphum/library.json (limited to 'platformio/common/libs/mqtt_module_temphum') diff --git a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp deleted file mode 100644 index 409f38f..0000000 --- a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "temphum.h" - -namespace homekit::mqtt { - -static const char TOPIC_TEMPHUM_DATA[] = "temphum/data"; - -void MqttTemphumModule::onConnect(Mqtt &mqtt) {} - -void MqttTemphumModule::tick(homekit::mqtt::Mqtt& mqtt) { - if (!tickElapsed()) - return; - - temphum::SensorData sd = sensor->read(); - MqttTemphumPayload payload { - .temp = sd.temp, - .rh = sd.rh, - .error = sd.error - }; - - mqtt.publish(TOPIC_TEMPHUM_DATA, reinterpret_cast(&payload), sizeof(payload)); -} - -} diff --git a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h b/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h deleted file mode 100644 index 7b28afc..0000000 --- a/platformio/common/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef HOMEKIT_LIB_MQTT_MODULE_TEMPHUM_H -#define HOMEKIT_LIB_MQTT_MODULE_TEMPHUM_H - -#include -#include - -namespace homekit::mqtt { - -struct MqttTemphumPayload { - double temp = 0; - double rh = 0; - uint8_t error = 0; -} __attribute__((packed)); - - -class MqttTemphumModule : public MqttModule { -private: - temphum::Sensor* sensor; - -public: - MqttTemphumModule(temphum::Sensor* _sensor) : MqttModule(10), sensor(_sensor) {} - void onConnect(Mqtt& mqtt) override; - void tick(Mqtt& mqtt) override; -}; - -} - -#endif //HOMEKIT_LIB_MQTT_MODULE_TEMPHUM_H diff --git a/platformio/common/libs/mqtt_module_temphum/library.json b/platformio/common/libs/mqtt_module_temphum/library.json deleted file mode 100644 index 068debd..0000000 --- a/platformio/common/libs/mqtt_module_temphum/library.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "homekit_mqtt_module_temphum", - "version": "1.0.10", - "build": { - "flags": "-I../../include" - }, - "dependencies": { - "homekit_mqtt": "file://../common/libs/mqtt", - "homekit_temphum": "file://../common/libs/temphum" - } -} -- cgit v1.2.3