47 lines
987 B
C++
47 lines
987 B
C++
#ifndef Sensor_SHT31_H
|
|
#define Sensor_SHT31_H
|
|
|
|
#include "sensordata.h"
|
|
#include <Homie.h>
|
|
|
|
#include <Wire.h>
|
|
#include "Adafruit_SHT31.h"
|
|
|
|
#define SHT31_HUMIDITY_HEATERON 95
|
|
#define SHT31_HUMIDITY_HEATEROFF 85
|
|
|
|
class Sensor_SHT31
|
|
{
|
|
|
|
private:
|
|
Adafruit_SHT31 *sht31;
|
|
|
|
HomieNode *sensorNode; //reference to HomieNode
|
|
|
|
struct sensordata data_temperature; //struct values are changed in setup()
|
|
struct sensordata data_humidity; //struct values are changed in setup()
|
|
|
|
bool init_ok;
|
|
|
|
bool last_sent_heaterstatus;
|
|
|
|
|
|
public:
|
|
Sensor_SHT31();
|
|
|
|
void loop_SHT31_temperature();
|
|
void loop_SHT31_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();
|
|
|
|
void checkHeater(float humidity);
|
|
|
|
};
|
|
|
|
#endif
|
|
|