#pragma once #include "Device.h" #include #include // https://github.com/adafruit/DHT-sensor-library class DeviceDht : public Device { public: inline DeviceDht(byte dhtPin, byte dhtType):dht(dhtPin, dhtType) { pin = dhtPin; type = dhtType; } virtual void deviceSetup(); virtual void deviceRegister(); virtual void deviceLoop(); private: byte pin; byte type; DHT dht; const int INTERVAL_DHT = 60; unsigned long lastSentDHT = 0; float humidity, temperature; // raw values from the sensor float heatindex; // computed value from the sensor HomieNode humidityNode{"humidity", "humidity"}; HomieNode temperatureNode{"temperature", "temperature"}; HomieNode heatindexNode{"heatindex", "heatindex"}; };