#ifndef SENSOR_DHT22_H
#define SENSOR_DHT22_H


#include "sensordata.h"
#include <Homie.h>

#include <Adafruit_Sensor.h> //required for dht library
#include <DHT.h>







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