HomeWaterLeaksDetection
HighLeakDetection Class Reference

#include <HighLeakDetection.h>

Public Member Functions

 HighLeakDetection (PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
 Constructor of the class. More...
 
 ~HighLeakDetection ()
 Descrutor of the class. More...
 
void update () override
 Updates the algorithm. More...
 
void reset () override
 Resets the algorithm. More...
 
String getFormatOfSettingsToSave () override
 Returns the current settings of the algorithm. More...
 
float getPercentLeakDetectionReset () const
 Returns percentage information about how close a high-water leak is from being detected. More...
 
float getPercentLeakDetected () const
 Returns percentage information about how close the algorithm is from being reset. More...
 
const String getRow (int row) const override
 Returns the content of the row given as a parameter. More...
 
const String getHTMLData (const int id) const override
 Since this class is registered as a source of data for the HTML content, it needs return the appropriate value according to the id given as a parameter. More...
 
- Public Member Functions inherited from ALeakDetectable
 ALeakDetectable (PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
 Constructor of the class. More...
 
virtual ~ALeakDetectable ()
 Destructor of the class. More...
 
int isActive () const
 Returns a flag whether of not a leak has been detected and the bypass is off. More...
 
void changeStateOfHomeAlarm (bool state)
 Changes the state of the home alarm. More...
 
LeakDetectionConfig_t getAlarmConfig ()
 Returns the current alarm config. More...
 
LeakDetectionConfig_t getNormalConfig ()
 Returns the current normal config. More...
 
void updateNormalConfig (LeakDetectionConfig_t newNormalConfig)
 Updates the normal settings. More...
 
void updateAlarmConfig (LeakDetectionConfig_t newAlarmConfig)
 Updates the alarm settings. More...
 

Protected Member Functions

void testActiveLeak () override
 Tests if a high-water leak has occurred, and if so, it will set the appropriate variables and flags. More...
 
void testResetLeak () override
 Tests if the high-water the algorithm should be reset based on inactivity of pulse on the input pin. More...
 
- Protected Member Functions inherited from ALeakDetectable
void applyNewConfig ()
 Applies the new config configuration. More...
 
String getType () const
 Returns the type of the water leak detection algorithm. More...
 

Protected Attributes

int pulseCount
 number of pulses detected so far More...
 
std::map< int, String(*)(const HighLeakDetection &highLeakDetection)> htmlData
 A map of different values (keys) and their associated functions which returns the appropriate values. More...
 
- Protected Attributes inherited from ALeakDetectable
PulseCounterpulseCounter
 instance of a pulse counter (input of the system) More...
 
LeakDetectionConfig_t normalConfig
 normal configuarion for when the house is occupied More...
 
LeakDetectionConfig_t alarmConfig
 alarm configuration for when there's nobody in the house More...
 
LeakDetectionConfig_tconfig
 pointer to the current configuration More...
 
int bypass
 bypass pin More...
 
int oldBypassValue
 old bypass value (used for sending e-mails) More...
 
int active
 indication if a leak has been detected + bypass is off More...
 
int stateOfHomeAlarm
 the current state of the home alarm More...
 
bool detected
 indication if a leak has been detected More...
 
int resetWhenDetected
 the reset value (%) when a leak was detected More...
 
String timeOfDetection
 time when the leak has been detected More...
 
Type type
 the type of the water leak detection algorithm More...
 
LeakDetectionConfig_t newNormalConfig
 new parameters of the normal config when the user changes them More...
 
LeakDetectionConfig_t newAlarmConfig
 new parameters of the alarm config when the user changes them More...
 
int requestUpdateNormalConfig
 flag if the new normal config should be applied More...
 
int requestUpdateAlarmConfig
 flag if the new alarms config should be applied More...
 

Friends

String HTML_bypass (const HighLeakDetection &highLeakDetection)
 Associated function for returing information about the state of the bypass. More...
 
String HTML_detected (const HighLeakDetection &highLeakDetection)
 Associated function for returing information about a high-water leak being detected (1) More...
 
String HTML_detectedText (const HighLeakDetection &highLeakDetection)
 Associated function for returing information about a high-water leak being detected (2) More...
 
String HTML_detectedTime (const HighLeakDetection &highLeakDetection)
 Associated function for returing the detection time of a high-water leak. More...
 
String HTML_activePercentage (const HighLeakDetection &highLeakDetection)
 Associated function for returing the [%] information about how close a leak is from being detected. More...
 
String HTML_activePercentageColor (const HighLeakDetection &highLeakDetection)
 Associated function for returing a color according to [%] information about how close a leak is from being detected. More...
 
String HTML_resetPercentage (const HighLeakDetection &highLeakDetection)
 Associated function for returing the [%] information about how close the algorithm is from being reset. More...
 
String HTML_detectionLimit (const HighLeakDetection &highLeakDetection)
 Associated function for returing the limit (detection) in terms of the normal configuration. More...
 
String HTML_resetLimitDays (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (days) in the normal configuration. More...
 
String HTML_resetLimitHours (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (hours) in the normal configuration. More...
 
String HTML_resetLimitMins (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (mins) in the normal configuration. More...
 
String HTML_resetLimitSecs (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (secs) in the normal configuration. More...
 
String HTML_detectionLimitAlarm (const HighLeakDetection &highLeakDetection)
 Associated function for returing the limit (detection) in terms of the alarm configuration. More...
 
String HTML_resetLimitDaysAlarm (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (days) in the alarm configuration. More...
 
String HTML_resetLimitHoursAlarm (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (hours) in the alarm configuration. More...
 
String HTML_resetLimitMinsAlarm (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (mins) in the alarm configuration. More...
 
String HTML_resetLimitSecsAlarm (const HighLeakDetection &highLeakDetection)
 Associated function for returing the reset time (secs) in the alarm configuration. More...
 

Additional Inherited Members

- Public Types inherited from ALeakDetectable
enum  Type { Low, High, Total }
 The type of the water leak detection algorithm. More...
 
- Static Public Attributes inherited from HTMLDataSource
static const String UNDEFINED_DATA = String("UNDEFINED")
 string "UNDEFINED" More...
 

Detailed Description

Author
silhavyj A17B0362P

This class implements the high-water leak detection algorithm and everything that is associated with it.

Definition at line 13 of file HighLeakDetection.h.

Constructor & Destructor Documentation

◆ HighLeakDetection()

HighLeakDetection::HighLeakDetection ( PulseCounter pulseCounter,
Type  type,
LeakDetectionConfig_t  normalConfig,
LeakDetectionConfig_t  alarmConfig 
)

Constructor of the class.

Parameters
pulseCounterinstance of PulseCounter (input)
typeof the algorithm (high-water)
normalConfigdefault normal settings
alarmConfigdefault alarm settings

Definition at line 23 of file HighLeakDetection.cpp.

28  #ifdef WEB_SERVER
29  // functions providing data to the webserver
30  htmlData[0] = &HTML_bypass;
31  htmlData[1] = &HTML_detected;
37 
43 
49  #endif
50  reset(); // reset the algorithm
51 }

References HTML_activePercentage, HTML_activePercentageColor, HTML_bypass, HTML_detected, HTML_detectedText, HTML_detectedTime, HTML_detectionLimit, HTML_detectionLimitAlarm, HTML_resetLimitDays, HTML_resetLimitDaysAlarm, HTML_resetLimitHours, HTML_resetLimitHoursAlarm, HTML_resetLimitMins, HTML_resetLimitMinsAlarm, HTML_resetLimitSecs, HTML_resetLimitSecsAlarm, HTML_resetPercentage, htmlData, and reset().

◆ ~HighLeakDetection()

HighLeakDetection::~HighLeakDetection ( )
inline

Descrutor of the class.

Definition at line 52 of file HighLeakDetection.h.

52 {}

Member Function Documentation

◆ getFormatOfSettingsToSave()

String HighLeakDetection::getFormatOfSettingsToSave ( )
overridevirtual

Returns the current settings of the algorithm.

This method is called when storing data on the SD card so they can be loaded when the system reboots

Returns
the current settings in a string format

Implements ALeakDetectable.

Definition at line 63 of file HighLeakDetection.cpp.

63  {
64  return String(newNormalConfig.limitResetTime) + ";" +
65  String(newNormalConfig.limitPulseAction) + ";" +
66  String(newAlarmConfig.limitResetTime) + ";" +
67  String(newAlarmConfig.limitPulseAction) + ";";
68 }

References LeakDetectionConfig_t::limitPulseAction, LeakDetectionConfig_t::limitResetTime, ALeakDetectable::newAlarmConfig, and ALeakDetectable::newNormalConfig.

◆ getHTMLData()

const String HighLeakDetection::getHTMLData ( const int  id) const
overridevirtual

Since this class is registered as a source of data for the HTML content, it needs return the appropriate value according to the id given as a parameter.

Parameters
id- the id of the piece of data
Returns
If the class holds this piece of information, it will return it. Otherwise, "UNDEFINED" will be returned.

Implements HTMLDataSource.

Reimplemented in TotalLeakDetection.

◆ getPercentLeakDetected()

float HighLeakDetection::getPercentLeakDetected ( ) const

Returns percentage information about how close the algorithm is from being reset.

The particular value is worked out based on the current settings. This piece of information is then displayed to the user.

Returns
information about how close the algorithm is from being reset

Definition at line 142 of file HighLeakDetection.cpp.

142  {
143  float percentDetected = pulseCount / (float)config->limitPulseAction;
144  percentDetected *= 100;
145  return min(100, percentDetected);
146 }

References ALeakDetectable::config, LeakDetectionConfig_t::limitPulseAction, and pulseCount.

Referenced by DailyOverview::update().

◆ getPercentLeakDetectionReset()

float HighLeakDetection::getPercentLeakDetectionReset ( ) const

Returns percentage information about how close a high-water leak is from being detected.

The particular value is worked out based on the current settings. This piece of information is then displayed to the user.

Returns
information about how close a high-water leak is from being detected

Definition at line 148 of file HighLeakDetection.cpp.

148  {
149  if (active == HIGH)
150  return 0;
151 
152  time_t currentTime = millis();
153  time_t lastPulseTime = pulseCounter->getLastPulseTime();
154  time_t deltaTime = DELTA_TIME(currentTime, lastPulseTime);
155 
156  float percentReset = deltaTime / (float)config->limitResetTime;
157  percentReset *= 100;
158  return min(100, percentReset);
159 }

References ALeakDetectable::active, ALeakDetectable::config, DELTA_TIME, PulseCounter::getLastPulseTime(), LeakDetectionConfig_t::limitResetTime, and ALeakDetectable::pulseCounter.

Referenced by testActiveLeak().

◆ getRow()

const String HighLeakDetection::getRow ( int  row) const
overridevirtual

Returns the content of the row given as a parameter.

This class represents one page on the LCD display. Each of the 4 rows has different content identified by the number of the row.

Parameters
rownumber of the row
Returns
content to be displayed on that row of the LCD

Implements IDisplayable.

Reimplemented in TotalLeakDetection.

◆ reset()

void HighLeakDetection::reset ( )
overridevirtual

Resets the algorithm.

Implements ALeakDetectable.

Reimplemented in TotalLeakDetection.

Definition at line 53 of file HighLeakDetection.cpp.

53  {
54  active = LOW;
55  bypass = LOW;
56  detected = 0;
58  pulseCount = 0;
59  timeOfDetection = "";
60  ALeakDetectable::applyNewConfig(); // check if new settings should be applied
61 }

References ALeakDetectable::active, ALeakDetectable::applyNewConfig(), ALeakDetectable::bypass, ALeakDetectable::detected, pulseCount, ALeakDetectable::resetWhenDetected, and ALeakDetectable::timeOfDetection.

Referenced by HighLeakDetection(), and TotalLeakDetection::reset().

◆ testActiveLeak()

void HighLeakDetection::testActiveLeak ( )
overrideprotectedvirtual

Tests if a high-water leak has occurred, and if so, it will set the appropriate variables and flags.

Implements ALeakDetectable.

Reimplemented in TotalLeakDetection.

Definition at line 81 of file HighLeakDetection.cpp.

81  {
83 
84  if (detected) {
85  // store the reset % when a leak was detected
86  // if it has not been done yet
87  if (timeOfDetection == "") {
88  timeOfDetection = DateTime::getInstance()->getDateTimeStr(); // date time of detection
90 
91  // send e-mail to the user
92  #ifdef EMAIL_NOTIFICATION
93  sendEmailLeakDetected();
94  #endif
95  }
96  active = !bypass; // if the bypass is off, close the main valve
97  }
98  // indication LED
99  digitalWrite(HIGH_ILOCK_LED_PIN, detected);
100 }

References ALeakDetectable::active, ALeakDetectable::bypass, ALeakDetectable::config, ALeakDetectable::detected, DateTime::getDateTimeStr(), DateTime::getInstance(), getPercentLeakDetectionReset(), HIGH_ILOCK_LED_PIN, LeakDetectionConfig_t::limitPulseAction, pulseCount, ALeakDetectable::resetWhenDetected, and ALeakDetectable::timeOfDetection.

Referenced by update().

◆ testResetLeak()

void HighLeakDetection::testResetLeak ( )
overrideprotectedvirtual

Tests if the high-water the algorithm should be reset based on inactivity of pulse on the input pin.

Implements ALeakDetectable.

Reimplemented in TotalLeakDetection.

Definition at line 70 of file HighLeakDetection.cpp.

70  {
71  time_t currentTime = millis();
72  time_t lastPulseTime = pulseCounter->getLastPulseTime();
73  time_t deltaTime = DELTA_TIME(currentTime, lastPulseTime);
74 
75  if (deltaTime >= config->limitResetTime && !detected) {
76  pulseCount = 0;
78  }
79 }

References ALeakDetectable::applyNewConfig(), ALeakDetectable::config, DELTA_TIME, ALeakDetectable::detected, PulseCounter::getLastPulseTime(), LeakDetectionConfig_t::limitResetTime, pulseCount, and ALeakDetectable::pulseCounter.

Referenced by update().

◆ update()

void HighLeakDetection::update ( )
overridevirtual

Updates the algorithm.

Implements ALeakDetectable.

Definition at line 115 of file HighLeakDetection.cpp.

115  {
116  // read the bypass
117  bypass = digitalRead(config->bypassPin);
118 
119  // if the state of the bypass has changed
120  // send an e-mail to the user
121  #ifdef EMAIL_NOTIFICATION
122  if (oldBypassValue != bypass) {
124  String state = bypass ? "on" : "off";
127  getType() + " leak detection BYPASS",
128  "bypass is now " + state
129  );
130  }
131  #endif
132 
133  // if a pulse has been detected and a leak
134  // has not been detected, increment the counter
135  if (pulseCounter->isActive() && detected == LOW)
136  pulseCount++;
137 
138  testActiveLeak(); // test if a leak has occurred
139  testResetLeak(); // test if the algorithm should be reset
140 }

References EmailSender::BYPASS, ALeakDetectable::bypass, LeakDetectionConfig_t::bypassPin, ALeakDetectable::config, ALeakDetectable::detected, EmailSender::getInstance(), ALeakDetectable::getType(), PulseCounter::isActive(), ALeakDetectable::oldBypassValue, pulseCount, ALeakDetectable::pulseCounter, EmailSender::sendEmail(), testActiveLeak(), and testResetLeak().

Friends And Related Function Documentation

◆ HTML_activePercentage

String HTML_activePercentage ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the [%] information about how close a leak is from being detected.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
[%] information about how close a leak is from being detected

Referenced by HighLeakDetection().

◆ HTML_activePercentageColor

String HTML_activePercentageColor ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing a color according to [%] information about how close a leak is from being detected.

For instance, 0 - 59% -> gray 60 - 79% -> yellow 80 - 89% -> orange
90 - 100% ->red

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
color according to the state of the algorithm - detected [%]

Referenced by HighLeakDetection().

◆ HTML_bypass

String HTML_bypass ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing information about the state of the bypass.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
"OFF"/"ON" according to the current state of the bypass

Referenced by HighLeakDetection().

◆ HTML_detected

String HTML_detected ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing information about a high-water leak being detected (1)

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
"ON" if a high-water leak has occurred, "OFF" otherwise

Referenced by HighLeakDetection().

◆ HTML_detectedText

String HTML_detectedText ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing information about a high-water leak being detected (2)

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
"Detected" if a high-water leak has occurred, "Undetected" otherwise

Referenced by HighLeakDetection().

◆ HTML_detectedTime

String HTML_detectedTime ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the detection time of a high-water leak.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
the time of detection in a string format

Referenced by HighLeakDetection().

◆ HTML_detectionLimit

String HTML_detectionLimit ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the limit (detection) in terms of the normal configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
the limit (detection) in the normal configuration

Referenced by HighLeakDetection().

◆ HTML_detectionLimitAlarm

String HTML_detectionLimitAlarm ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the limit (detection) in terms of the alarm configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
the limit (detection) in the alarm configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitDays

String HTML_resetLimitDays ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (days) in the normal configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (days) in the normal configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitDaysAlarm

String HTML_resetLimitDaysAlarm ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (days) in the alarm configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (days) in the alarm configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitHours

String HTML_resetLimitHours ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (hours) in the normal configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (hours) in the normal configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitHoursAlarm

String HTML_resetLimitHoursAlarm ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (hours) in the alarm configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (hours) in the alarm configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitMins

String HTML_resetLimitMins ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (mins) in the normal configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (mins) in the normal configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitMinsAlarm

String HTML_resetLimitMinsAlarm ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (mins) in the alarm configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (mins) in the alarm configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitSecs

String HTML_resetLimitSecs ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (secs) in the normal configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (secs) in the normal configuration

Referenced by HighLeakDetection().

◆ HTML_resetLimitSecsAlarm

String HTML_resetLimitSecsAlarm ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the reset time (secs) in the alarm configuration.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
reset time (secs) in the alarm configuration

Referenced by HighLeakDetection().

◆ HTML_resetPercentage

String HTML_resetPercentage ( const HighLeakDetection highLeakDetection)
friend

Associated function for returing the [%] information about how close the algorithm is from being reset.

Parameters
highLeakDetection- the instance of the HighLeakDetection class
Returns
[%] information about how close the algorithm is from being reset

Referenced by HighLeakDetection().

Member Data Documentation

◆ htmlData

std::map<int, String (*)(const HighLeakDetection& highLeakDetection)> HighLeakDetection::htmlData
protected

A map of different values (keys) and their associated functions which returns the appropriate values.

Definition at line 114 of file HighLeakDetection.h.

Referenced by HighLeakDetection().

◆ pulseCount

int HighLeakDetection::pulseCount
protected

The documentation for this class was generated from the following files:
ALeakDetectable::alarmConfig
LeakDetectionConfig_t alarmConfig
alarm configuration for when there's nobody in the house
Definition: ALeakDetectable.h:67
ALeakDetectable::timeOfDetection
String timeOfDetection
time when the leak has been detected
Definition: ALeakDetectable.h:75
ALeakDetectable::type
Type type
the type of the water leak detection algorithm
Definition: ALeakDetectable.h:76
EmailSender::BYPASS
@ BYPASS
when a bypass changes
Definition: EmailSender.h:53
ALeakDetectable::getType
String getType() const
Returns the type of the water leak detection algorithm.
Definition: ALeakDetectable.cpp:84
ALeakDetectable::bypass
int bypass
bypass pin
Definition: ALeakDetectable.h:69
PulseCounter::getLastPulseTime
time_t getLastPulseTime() const
Return the time when the last pulse was detected.
Definition: PulseCounter.cpp:44
HighLeakDetection::htmlData
std::map< int, String(*)(const HighLeakDetection &highLeakDetection)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.
Definition: HighLeakDetection.h:114
HighLeakDetection::HTML_resetLimitSecsAlarm
friend String HTML_resetLimitSecsAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (secs) in the alarm configuration.
LeakDetectionConfig_t::limitResetTime
time_t limitResetTime
limit reset time e.g. 5 mins, 24h, ....
Definition: LeakDetectionConfig.h:18
LeakDetectionConfig_t::limitPulseAction
int limitPulseAction
limit action in pulses
Definition: LeakDetectionConfig.h:20
ALeakDetectable::resetWhenDetected
int resetWhenDetected
the reset value (%) when a leak was detected
Definition: ALeakDetectable.h:74
HIGH_ILOCK_LED_PIN
#define HIGH_ILOCK_LED_PIN
high-water leak LED (detected = on)
Definition: Pins.h:26
HighLeakDetection::getPercentLeakDetectionReset
float getPercentLeakDetectionReset() const
Returns percentage information about how close a high-water leak is from being detected.
Definition: HighLeakDetection.cpp:148
ALeakDetectable::config
LeakDetectionConfig_t * config
pointer to the current configuration
Definition: ALeakDetectable.h:68
ALeakDetectable::detected
bool detected
indication if a leak has been detected
Definition: ALeakDetectable.h:73
HighLeakDetection::HTML_activePercentage
friend String HTML_activePercentage(const HighLeakDetection &highLeakDetection)
Associated function for returing the [%] information about how close a leak is from being detected.
HighLeakDetection::reset
void reset() override
Resets the algorithm.
Definition: HighLeakDetection.cpp:53
LeakDetectionConfig_t::bypassPin
int bypassPin
number of the bypass pin
Definition: LeakDetectionConfig.h:21
HighLeakDetection::HTML_detectedTime
friend String HTML_detectedTime(const HighLeakDetection &highLeakDetection)
Associated function for returing the detection time of a high-water leak.
HighLeakDetection::testResetLeak
void testResetLeak() override
Tests if the high-water the algorithm should be reset based on inactivity of pulse on the input pin.
Definition: HighLeakDetection.cpp:70
HighLeakDetection::HTML_resetLimitMins
friend String HTML_resetLimitMins(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (mins) in the normal configuration.
ALeakDetectable::applyNewConfig
void applyNewConfig()
Applies the new config configuration.
Definition: ALeakDetectable.cpp:34
HighLeakDetection::pulseCount
int pulseCount
number of pulses detected so far
Definition: HighLeakDetection.h:26
DateTime::getInstance
static DateTime * getInstance()
Returns the instance of the class.
Definition: DateTime.cpp:26
HighLeakDetection::HTML_bypass
friend String HTML_bypass(const HighLeakDetection &highLeakDetection)
Associated function for returing information about the state of the bypass.
HighLeakDetection::HTML_resetPercentage
friend String HTML_resetPercentage(const HighLeakDetection &highLeakDetection)
Associated function for returing the [%] information about how close the algorithm is from being rese...
ALeakDetectable::newNormalConfig
LeakDetectionConfig_t newNormalConfig
new parameters of the normal config when the user changes them
Definition: ALeakDetectable.h:78
HighLeakDetection::HTML_detectionLimitAlarm
friend String HTML_detectionLimitAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the limit (detection) in terms of the alarm configuration.
time_t
unsigned long time_t
Referring to the data type unsigned long as time_t.
Definition: DateTime.h:20
HighLeakDetection::HTML_resetLimitHoursAlarm
friend String HTML_resetLimitHoursAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (hours) in the alarm configuration.
EmailSender::sendEmail
byte sendEmail(String subject, String data)
Sends an e-mail off to the smtp2go server.
Definition: EmailSender.cpp:93
HighLeakDetection::HTML_detectionLimit
friend String HTML_detectionLimit(const HighLeakDetection &highLeakDetection)
Associated function for returing the limit (detection) in terms of the normal configuration.
HighLeakDetection::HTML_resetLimitMinsAlarm
friend String HTML_resetLimitMinsAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (mins) in the alarm configuration.
DateTime::getDateTimeStr
String getDateTimeStr() const
Returns the current datatime in a string format.
Definition: DateTime.cpp:47
ALeakDetectable::active
int active
indication if a leak has been detected + bypass is off
Definition: ALeakDetectable.h:71
ALeakDetectable::newAlarmConfig
LeakDetectionConfig_t newAlarmConfig
new parameters of the alarm config when the user changes them
Definition: ALeakDetectable.h:79
PulseCounter::isActive
int isActive() const
Returns information if a pulse has been detected.
Definition: PulseCounter.cpp:40
HighLeakDetection::HTML_resetLimitDaysAlarm
friend String HTML_resetLimitDaysAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (days) in the alarm configuration.
HighLeakDetection::HTML_activePercentageColor
friend String HTML_activePercentageColor(const HighLeakDetection &highLeakDetection)
Associated function for returing a color according to [%] information about how close a leak is from ...
HighLeakDetection::HTML_detectedText
friend String HTML_detectedText(const HighLeakDetection &highLeakDetection)
Associated function for returing information about a high-water leak being detected (2)
ALeakDetectable::oldBypassValue
int oldBypassValue
old bypass value (used for sending e-mails)
Definition: ALeakDetectable.h:70
HighLeakDetection::testActiveLeak
void testActiveLeak() override
Tests if a high-water leak has occurred, and if so, it will set the appropriate variables and flags.
Definition: HighLeakDetection.cpp:81
HighLeakDetection::HTML_resetLimitDays
friend String HTML_resetLimitDays(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (days) in the normal configuration.
DELTA_TIME
#define DELTA_TIME(time1, time2)
Calculates the time difference between two times given as parameters.
Definition: DateTime.h:35
ALeakDetectable::pulseCounter
PulseCounter * pulseCounter
instance of a pulse counter (input of the system)
Definition: ALeakDetectable.h:65
HighLeakDetection::HTML_resetLimitSecs
friend String HTML_resetLimitSecs(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (secs) in the normal configuration.
HighLeakDetection::HTML_detected
friend String HTML_detected(const HighLeakDetection &highLeakDetection)
Associated function for returing information about a high-water leak being detected (1)
ALeakDetectable::normalConfig
LeakDetectionConfig_t normalConfig
normal configuarion for when the house is occupied
Definition: ALeakDetectable.h:66
ALeakDetectable::ALeakDetectable
ALeakDetectable(PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
Constructor of the class.
Definition: ALeakDetectable.cpp:3
EmailSender::getInstance
static EmailSender * getInstance()
Returns the instance of the class.
Definition: EmailSender.cpp:87
HighLeakDetection::HTML_resetLimitHours
friend String HTML_resetLimitHours(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (hours) in the normal configuration.