4#ifndef SRC_SUPLA_SENSOR_TEMPERATURE_DROP_SENSOR_H_
5#define SRC_SUPLA_SENSOR_TEMPERATURE_DROP_SENSOR_H_
7#include <supla/element.h>
9#include "virtual_binary.h"
10#include "therm_hygro_meter.h"
15#define MAX_TEMPERATURE_MEASUREMENTS 60
24 bool isDropDetected()
const;
25 int getBinarySensorChannelNo()
const;
46 int16_t getAverage(
int fromIndex,
int toIndex)
const;
47 bool detectTemperatureDrop(int16_t temperature, int16_t *average)
const;
49 uint32_t lastTemperatureUpdate = 0;
50 uint32_t filteringTimestamp = 0;
51 uint32_t dropDetectionTimestamp = 0;
52 uint32_t probeIntervalMs = 30000;
53 uint32_t dropDetectionDelayMs = 0;
55 int16_t measurements[MAX_TEMPERATURE_MEASUREMENTS] = {};
56 int measurementIndex = 0;
57 int16_t temperatureDropThreshold = -200;
58 int16_t averageAtDropDetection = INT16_MIN;
Base class for all elements of SuplaDevice.
Definition element.h:27
Definition temperature_drop_sensor.h:17
void setTemperatureDropThreshold(int16_t threshold)
Set temperature drop threshold detection.
Definition temperature_drop_sensor.cpp:128
void iterateAlways() override
Method called on each SuplaDevice iteration.
Definition temperature_drop_sensor.cpp:24
void onInit() override
Third method called on element in SuplaDevice.begin()
Definition temperature_drop_sensor.cpp:21
void setDropDetectionDelayMs(uint32_t delayMs)
Set drop detection delay.
Definition temperature_drop_sensor.cpp:132
Definition therm_hygro_meter.h:14
Virtual binary sensor with explicit logical state control.
Definition virtual_binary.h:21