2021-11-02 17:51:55 +00:00
|
|
|
#ifndef SENSOR_DHT22_H
|
|
|
|
#define SENSOR_DHT22_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "sensordata.h"
|
2021-11-02 19:13:38 +00:00
|
|
|
#include <Homie.h>
|
|
|
|
|
|
|
|
#include <Adafruit_Sensor.h> //required for dht library
|
|
|
|
#include <DHT.h>
|
|
|
|
|
2021-11-02 17:51:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Sensor_DHT22
|
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
|
|
|
DHT *dht;
|
|
|
|
HomieNode *sensorNode; //reference to HomieNode
|
|
|
|
|
|
|
|
struct sensordata dataDHT22_temperature; //struct values are changed in setup()
|
|
|
|
struct sensordata dataDHT22_humidity; //struct values are changed in setup()
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
Sensor_DHT22(int pin);
|
|
|
|
|
|
|
|
void loop_DHT22_temperature();
|
|
|
|
void loop_DHT22_humidity();
|
|
|
|
|
|
|
|
void init();
|
|
|
|
void setSettings_Temperature(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
|
|
void setSettings_Humidity(float minchange, unsigned long senddelaymax, unsigned long readdelay);
|
|
|
|
void advertise(HomieNode& p_sensorNode);
|
|
|
|
void sensorloop();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|