Skip to content

Commit 8e1faa5

Browse files
bapowelluser2684
authored andcommitted
Added new sensor: SensorWaterLeak (#490)
1 parent 768b2ba commit 8e1faa5

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,3 +518,9 @@ jobs:
518518
- sed -r -i 's/\/\/(#include <sensors\/SensorGSM.h>)/\1/' $SKETCH
519519
- eval $OTA_CONFIGURATION
520520
- eval $COMPILE
521+
- name: "SensorWaterLeak"
522+
script:
523+
- sed -r -i 's/\/\/(SensorWaterLeak .+)/\1/' $SKETCH
524+
- sed -r -i 's/\/\/(#include <sensors\/SensorWaterLeak.h>)/\1/' $SKETCH
525+
- eval $OTA_CONFIGURATION
526+
- eval $COMPILE

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ SensorLDR | 1 | LDR sensor, return the light level of an atta
9191
SensorRain | 1 | Rain sensor, return the percentage of rain from an attached analog sensor | -
9292
SensorSoilMoisture | 1 | Soil moisture sensor, return the percentage of moisture from an attached analog sensor | -
9393
SensorThermistor | 1 | Thermistor sensor, return the temperature based on the attached thermistor | -
94-
SensorTMP102 | 1 | Temperature sensor, return the temperature based on the TMP102 sensor | https://github.com/Yannicked/Sensor_TMP102
94+
SensorTMP102 | 1 | Temperature sensor, return the temperature based on the TMP102 sensor | https://github.com/Yannicked/Sensor_TMP102
9595
SensorML8511 | 1 | ML8511 sensor, return UV intensity | -
9696
SensorACS712 | 1 | ACS712 sensor, measure the current going through the attached module | -
9797
SensorDigitalInput | 1 | Generic digital sensor, return a pin's digital value | -
@@ -147,6 +147,7 @@ SensorPN532 | 1 | PN532 NFC RFID Module
147147
SensorCCS811 | 1 | CCS811 gas/Air Quality sensor. Measure VOC and eCO2 | https://github.com/adafruit/Adafruit_CCS811
148148
SensorMPR121 | 1 | MPR121-based capacitive touch control sensor | https://github.com/adafruit/Adafruit_MPR121
149149
SensorGSM | 1 | Send SMS through an attached serial modem (e.g. SIM900) | -
150+
SensorWaterLeak | 1 | Water leak sensor; via an interrupt, wake up the board and report when a leak is detected | -
150151

151152
Those sensors requiring a pin to operate would take it as an argument in the constructor.
152153
NodeManager automatically creates all the child_ids, assigning an incremental counter. If you need to set your own child_id, pass it as the last argument to the constructor
@@ -643,7 +644,7 @@ Each sensor class may expose additional methods.
643644
void toggleStatus(int value);
644645
~~~
645646
646-
* SensorInterrupt / SensorDoor / SensorMotion
647+
* SensorInterrupt / SensorDoor / SensorMotion / SensorWaterLeak
647648
~~~c
648649
// [105] Invert the value to report. E.g. if FALLING and value is LOW, report HIGH (default: false)
649650
void setInvertValueToReport(bool value);

examples/Template/Template.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ NodeManager. Just uncomment the settings you need and the sensors you want to ad
370370
//#include <sensors/SensorGSM.h>
371371
//SensorGSM gsm(6,7);
372372

373+
//#include <sensors/SensorWaterLeak.h>
374+
//SensorWaterLeak waterLeak(3);
375+
373376
/***********************************
374377
* Main Sketch
375378
*/

keywords.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,5 @@ SensorDSM501A KEYWORD1
219219
SensorPN532 KEYWORD1
220220
SensorCCS811 KEYWORD1
221221
SensorMPR121 KEYWORD1
222-
SensorGSM KEYWORD1
222+
SensorGSM KEYWORD1
223+
SensorWaterLeak KEYWORD1

sensors/SensorWaterLeak.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The MySensors Arduino library handles the wireless radio link and protocol
3+
* between your home built sensors/actuators and HA controller of choice.
4+
* The sensors forms a self healing radio network with optional repeaters. Each
5+
* repeater and gateway builds a routing tables in EEPROM which keeps track of the
6+
* network topology allowing messages to be routed to nodes.
7+
*
8+
* Created by Henrik Ekblad <[email protected]>
9+
* Copyright (C) 2013-2017 Sensnology AB
10+
* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
11+
*
12+
* Documentation: http://www.mysensors.org
13+
* Support Forum: http://forum.mysensors.org
14+
*
15+
* This program is free software; you can redistribute it and/or
16+
* modify it under the terms of the GNU General Public License
17+
* version 2 as published by the Free Software Foundation.
18+
*/
19+
#ifndef SensorWaterLeak_h
20+
#define SensorWaterLeak_h
21+
22+
/*
23+
* SensorWaterLeak
24+
*/
25+
26+
#include "SensorInterrupt.h"
27+
28+
class SensorWaterLeak: public SensorInterrupt {
29+
public:
30+
SensorWaterLeak(int8_t pin, uint8_t child_id = 0): SensorInterrupt(pin, child_id) {
31+
_name = "WATER_LEAK";
32+
children.get()->setPresentation(S_WATER_LEAK);
33+
children.get()->setType(V_TRIPPED);
34+
children.get()->setDescription(_name);
35+
};
36+
};
37+
#endif

0 commit comments

Comments
 (0)