summaryrefslogtreecommitdiff
path: root/include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h')
-rw-r--r--include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h b/include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h
new file mode 100644
index 0000000..7b28afc
--- /dev/null
+++ b/include/pio/libs/mqtt_module_temphum/homekit/mqtt/module/temphum.h
@@ -0,0 +1,28 @@
+#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 onConnect(Mqtt& mqtt) override;
+ void tick(Mqtt& mqtt) override;
+};
+
+}
+
+#endif //HOMEKIT_LIB_MQTT_MODULE_TEMPHUM_H