#ifndef NODE_TEST_H #define NODE_TEST_H #include #include "patrix/Node.h" #include "patrix/sensor/Dallas.h" #include "patrix/sensor/DallasSensor.h" #include "patrix/sensor/DHT22.h" class NodeTest final : public Node { const unsigned long MAX_AGE_SECONDS = 10; const unsigned long OVERDUE_SECONDS = 60; Dallas dallas; DallasSensor test; DHT22 testraum; public: NodeTest() : dallas(27), test(dallas, 0xC90417C1C5C0FF28, "test/ds18b20", 1.0, MAX_AGE_SECONDS, OVERDUE_SECONDS), testraum(26, "test/dht22", 0.5, 2, 1, MAX_AGE_SECONDS, OVERDUE_SECONDS) { // }; void setup() override { // TODO } void loop() override { dallas.loop(); test.loop(); testraum.loop(); if (test.isDue() || testraum.isDue()) { JsonDocument json; toJson(json); if (mqttPublish(WiFiClass::getHostname(), json)) { test.markSent(); testraum.markSent(); } } } void toJson(JsonDocument& json) override { test.toJson(json); testraum.toJson(json); } }; #endif