diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-09-27 00:54:57 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-09-27 00:54:57 +0300 |
commit | d3a295872c49defb55fc8e4e43e55550991e0927 (patch) | |
tree | b9dca15454f9027d5a9dad0d4443a20de04dbc5d /platformio/common/libs/mqtt_module_temphum | |
parent | b7cbc2571c1870b4582ead45277d0aa7f961bec8 (diff) | |
parent | bdbb296697f55f4c3a07af43c9aaf7a9ea86f3d0 (diff) |
Merge branch 'master' of ch1p.io:homekit
Diffstat (limited to 'platformio/common/libs/mqtt_module_temphum')
3 files changed, 0 insertions, 62 deletions
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 82f1d74..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::init(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<uint8_t*>(&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 5c41cef..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 <homekit/mqtt/module.h> -#include <homekit/temphum.h> - -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 init(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 9bb8cf1..0000000 --- a/platformio/common/libs/mqtt_module_temphum/library.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "homekit_mqtt_module_temphum", - "version": "1.0.9", - "build": { - "flags": "-I../../include" - }, - "dependencies": { - "homekit_mqtt": "file://../common/libs/mqtt", - "homekit_temphum": "file://../common/libs/temphum" - } -} |