Jump to content

Leak Sensors - Another (Suggested) Complete Program Package


rabbit1543

Recommended Posts

I appreciate your help.

I've taken this thread off topic I hope a moderator can split it, my apologies.

 

Can't get to PLM until tonight.

My setup is tiny, have not looked at table.

The sensors appear to be doing everything they should if setup manually....

 

Hello Mango,

 

Just start a new thread in the Questions and Answers and just reference this thread for a high level over view.

Link to comment

Teken, sorry for the late reply I have been unable to get to the PLM to check the stickers. I think I will put this one to bed and leave as-is.

The sensors work as they should with the caveat of requiring manual setup as well as do not report version number through console.

Link to comment

I'm having trouble with my leak sensor program...

 

My "Leak Startup Alert" seems to fire whenever my $sLeakXXXnHB STATE variable changes from 1 to 0 (which happens when my "WET#x-xxx-HeartbeatMissed" program runs for 25hours (temp 5 min to test) and falls down to where $sLeakXXXnHB=0 is set.  This seems to then cause "Leak Startup Alert" to re-evaluate(ok), but runs the ELSE section (proven by putting a notification diagnostic in that section), thus re-running my "WET#x-xxx-HeartbeatMissed" in the "ELSE" section (why?) when $iStartup is still 1 (ISY is FULLY up...) so I don't understand), which then sets my $sLeakXXXnHB back to 1, thus waiting another 25 hours, and looping through this cycle, and never keeping $sLeakXXXnHB=0 when I have the battery pulled from one of the sensors (thus never announcing a problem).

 

With the wait set to 5 minutes, instead of 25 hours, i watched the variable $sLeakXXXnHB and i saw it quickly flip to 0, then immediatly back to 1, and i received a diagnostic email, telling me that "Leak Startup Alert" had triggered in the ELSE section!

 

My understanding was that the way this IF statement reads, that if a state variable 'changes'  value, and that variable is referenced in the IF statement, it would re-evaluate... that's ok... but I'm puzzled why it triggers to ELSE section... I thought that if the AND were FALSE, that the WHOLE program would not run.

 

I'm assuming this whole program works for other people, so I'm not sure how this works for anyone if this is true (or do I have something wrong in my program?)  I'm to the point I'm just spinning this in circles.

 

/fred

 

 

 

 

 

 

Code sections follow:

===== ===== ===== ===== =====

 

Leak Startup Alert - [iD 000F][Parent 000E][Run At Startup]

If
        $iStartup is 0
    And (
             $sLeakWET1 is 1
          Or $sLeakWET2 is 1
          Or $sLeakWET3 is 1
          Or $sLeakWET4 is 1
          Or $sLeakWET1HB is 0
          Or $sLeakWET2HB is 0
          Or $sLeakWET3HB is 0
          Or $sLeakWET4HB is 0
        )
 
Then
        Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Startup Alert'
        Wait  10 seconds
        Run Program 'WET#1-BsmtEnt-HeartbeatMissed' (Then Path)
        Run Program 'WET#2-Laundry-HeartbeatMissed' (Then Path)
        Run Program 'WET#3-SumpRm-HeartbeatMissed' (Then Path)
        Run Program 'WET#4-BsmtOffice-HeartbeatMissed' (Then Path)
        Wait  30 seconds
        $iStartup  = 1
 
Else
        Send Notification to 'DIAG01distList' content 'Leak Sensor Startup DIAG'
        Run Program 'WET#1-BsmtEnt-HeartbeatMissed' (Then Path)
        Run Program 'WET#2-Laundry-HeartbeatMissed' (Then Path)
        Run Program 'WET#3-SumpRm-HeartbeatMissed' (Then Path)
        Run Program 'WET#4-BsmtOffice-HeartbeatMissed' (Then Path)
        Wait  30 seconds
        $iStartup  = 1
 
 

===== ===== ===== ===== =====

WET#1-BsmtEnt-HeartbeatMissed - [iD 0010][Parent 000E]

If
        Control 'ZZZ1-DO-NOT-USE / LEAK-SENSORS / HEARTBEAT / WET#1-BsmtEnt-Heartbeat' is switched On
     Or Control 'ZZZ1-DO-NOT-USE / LEAK-SENSORS / HEARTBEAT / WET#1-BsmtEnt-Heartbeat' is switched Off
 
Then
        $iLeakTHISSensorNumber  = 1
        Run Program 'WET#ALL-NotifyOfHeartbeatChange' (Then Path)
        $sLeakWET1HB  = 1
        $sLeakWET1HB Init To $sLeakWET1HB
        Wait  25 hours (currently set to 5 minutes to test!)
        $sLeakWET1HB  = 0
        $sLeakWET1HB Init To $sLeakWET1HB
        Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Heartbeat Alert - Level 1'
        Send Notification to 'ALL FREDS Email Addresses' content 'Leak Sensor Heartbeat Alert - Level 1'
        Wait  12 hours
        Repeat Every  12 hours
           Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Heartbeat Alert - Level 2'
           Send Notification to 'ALL FREDS Email Addresses' content 'Leak Sensor Heartbeat Alert - Level 2'
 
Else
   - No Actions - (To add one, press 'Action')

 

===== ===== ===== ===== =====

 

 

 

 

Link to comment

Fred,

I can look into this one but my isy is out of commission for the next few days. It's possible that there is a bug in this particular program. It has been quite a while since I set this up and my memory is a bit foggy in the details. I can say that I did get a missed heartbeat message once that I rectified in the same day. I will try to review the program and get back to you.

 

Sent from my SM-G920V using Tapatalk

Link to comment

I'm having trouble with my leak sensor program...

 

My "Leak Startup Alert" seems to fire whenever my $sLeakXXXnHB STATE variable changes from 1 to 0 (which happens when my "WET#x-xxx-HeartbeatMissed" program runs for 25hours (temp 5 min to test) and falls down to where $sLeakXXXnHB=0 is set.  This seems to then cause "Leak Startup Alert" to re-evaluate(ok), but runs the ELSE section (proven by putting a notification diagnostic in that section), thus re-running my "WET#x-xxx-HeartbeatMissed" in the "ELSE" section (why?) when $iStartup is still 1 (ISY is FULLY up...) so I don't understand), which then sets my $sLeakXXXnHB back to 1, thus waiting another 25 hours, and looping through this cycle, and never keeping $sLeakXXXnHB=0 when I have the battery pulled from one of the sensors (thus never announcing a problem).

 

With the wait set to 5 minutes, instead of 25 hours, i watched the variable $sLeakXXXnHB and i saw it quickly flip to 0, then immediatly back to 1, and i received a diagnostic email, telling me that "Leak Startup Alert" had triggered in the ELSE section!

 

My understanding was that the way this IF statement reads, that if a state variable 'changes'  value, and that variable is referenced in the IF statement, it would re-evaluate... that's ok... but I'm puzzled why it triggers to ELSE section... I thought that if the AND were FALSE, that the WHOLE program would not run.

 

I'm assuming this whole program works for other people, so I'm not sure how this works for anyone if this is true (or do I have something wrong in my program?)  I'm to the point I'm just spinning this in circles.

 

/fred

 

 

 

 

 

 

Code sections follow:

===== ===== ===== ===== =====

 

Leak Startup Alert - [iD 000F][Parent 000E][Run At Startup]

 

If

        $iStartup is 0

    And (

             $sLeakWET1 is 1

          Or $sLeakWET2 is 1

          Or $sLeakWET3 is 1

          Or $sLeakWET4 is 1

          Or $sLeakWET1HB is 0 < -----------------always runs else every time it changes

          Or $sLeakWET2HB is 0

          Or $sLeakWET3HB is 0

          Or $sLeakWET4HB is 0

        )

 

Then

        Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Startup Alert'

        Wait  10 seconds

        Run Program 'WET#1-BsmtEnt-HeartbeatMissed' (Then Path)

        Run Program 'WET#2-Laundry-HeartbeatMissed' (Then Path)

        Run Program 'WET#3-SumpRm-HeartbeatMissed' (Then Path)

        Run Program 'WET#4-BsmtOffice-HeartbeatMissed' (Then Path)

        Wait  30 seconds

        $iStartup  = 1

 

Else

        Send Notification to 'DIAG01distList' content 'Leak Sensor Startup DIAG'

        Run Program 'WET#1-BsmtEnt-HeartbeatMissed' (Then Path) <-------cancels any notification in progress

        Run Program 'WET#2-Laundry-HeartbeatMissed' (Then Path)

        Run Program 'WET#3-SumpRm-HeartbeatMissed' (Then Path)

        Run Program 'WET#4-BsmtOffice-HeartbeatMissed' (Then Path)

        Wait  30 seconds

        $iStartup  = 1

 

 

===== ===== ===== ===== =====

WET#1-BsmtEnt-HeartbeatMissed - [iD 0010][Parent 000E]

 

If

        Control 'ZZZ1-DO-NOT-USE / LEAK-SENSORS / HEARTBEAT / WET#1-BsmtEnt-Heartbeat' is switched On

     Or Control 'ZZZ1-DO-NOT-USE / LEAK-SENSORS / HEARTBEAT / WET#1-BsmtEnt-Heartbeat' is switched Off

 

Then

        $iLeakTHISSensorNumber  = 1

        Run Program 'WET#ALL-NotifyOfHeartbeatChange' (Then Path)

        $sLeakWET1HB  = 1

        $sLeakWET1HB Init To $sLeakWET1HB

        Wait  25 hours (currently set to 5 minutes to test!)

        $sLeakWET1HB  = 0 <---------------------------- retriggers startup program

        $sLeakWET1HB Init To $sLeakWET1HB

        Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Heartbeat Alert - Level 1'

        Send Notification to 'ALL FREDS Email Addresses' content 'Leak Sensor Heartbeat Alert - Level 1'

        Wait  12 hours

        Repeat Every  12 hours

           Send Notification to 'FCJforwarderOnly' content 'Leak Sensor Heartbeat Alert - Level 2'

           Send Notification to 'ALL FREDS Email Addresses' content 'Leak Sensor Heartbeat Alert - Level 2'

 

Else

   - No Actions - (To add one, press 'Action')

 

===== ===== ===== ===== =====

I followed your logic and your analysis looks correct. It seems you have been doing a lot of troubleshooting and have a good grip on what is happening.

 

The  "Leak Startup Alert" program, having all the logic lines will always cancel the alarm notifications.

Any time any one of those variables change, it's Then or Else section will run, and restart all the programs called.

WET#1-BsmtEnt-HeartbeatMissed can never notify you or even enter it's 12 hour loop.

 

 

Running another program will stop it where it is at and cancel any further lines of program code.

 

Therefore,

The Heartbeat monitor notification system cannot work as is. It self cancels.

Link to comment

Thanks Larry... since I know you understand Interrupt Driven programming, that's increases my confidence that this code appears busted.

 

If that is the case (we'll wait to see what rabbit1543 comes back with), it would be prudent to get this code fixed asap, and/or put a huge disclaimer pinned up top, so people relying on such an important thing (flood sensing) won't be shocked when their batteries quietly die, or devices go out of range for some reason.

 

Fred

Link to comment

Thanks Larry... since I know you understand Interrupt Driven programming, that's increases my confidence that this code appears busted.

 

If that is the case (we'll wait to see what rabbit1543 comes back with), it would be prudent to get this code fixed asap, and/or put a huge disclaimer pinned up top, so people relying on such an important thing (flood sensing) won't be shocked when their batteries quietly die, or devices go out of range for some reason.

 

Fred

Luckily those batteries are claimed to last ten years in LS usage. :)

 

I have one report missing a heartbeat but it healed again. Now I have modified my programs to not say "Battery" and made a self reset to continue to test the next day.

Link to comment

I have been using the original setup of these programs from:

http://forum.universal-devices.com/topic/11566-leak-sensors-a-suggested-complete-program-package/?p=93722

 

and suggested modifications based on the newer leak sensors

http://forum.universal-devices.com/topic/11566-leak-sensors-a-suggested-complete-program-package/?p=127646

 

and they have worked perfectly for me.  

Link to comment

I have been using the original setup of these programs from:

http://forum.universal-devices.com/topic/11566-leak-sensors-a-suggested-complete-program-package/?p=93722

 

and suggested modifications based on the newer leak sensors

http://forum.universal-devices.com/topic/11566-leak-sensors-a-suggested-complete-program-package/?p=127646

 

and they have worked perfectly for me.  

 

 

Gollllllleeeeeeeeyyyyy Jeeee...

 

New and Improved!... ya!

 

i wish i had seen that and not gone down this rabbit hole!... waste of time!

 

oh well... time to re-do this top down... grrrrr!!!!

 

Thanks!

Link to comment

I got my isy back up and running after the power supply failed. I ran some test and there is a bug in this particular program. It was intended to notify you at isy startup if there was a leak or missed heartbeat and the isy had lost power or rebooted during one of these conditions. I had run a test by leading the battery out of one of my sensors and then powered up the isy after it had been off for almost a week. After 24 hours I got two emails. First email was a notification that the heartbeat was missed and the shortly after that it was repaired. I left things as they were for another 24 hours and got the same two emails. While this is not the intended behavior it's didn't appear to be completely broken. Heartbeats are being detected and notifications are being sent but they are self healing when they shouldn't. Im going to muck around a bit see where I went wrong. I'm terribly sorry to anyone using this setup but for now it might make sense to disable the startup program and perform a test of missed heartbeat. Disabling this program should allow everything else to run as intended but you will certainly not have any notification if your isy reboots during a leak or missed heartbeat

 

Sent from my SM-G920V using Tapatalk

Link to comment

I appreciate you working on a fix, thankyou rabbit1543.

Missing heartbeat aside, your code works to discover leaks which is the main thing.

Checking heartbeat status can be easily done through the ISY manually for anyone wanting to check in the interim.

The faulty code wasn't really a ball breaker in my opinion.

Link to comment

Hey, rabbit1543, I appreciate you and all others that offer up their hard work, don't misinterpret me!

 

I, on the other hand, am too busy for pulling info from my many systems, so I rely heavily on push notifications.

 

So in my case, it could be disasterous, so people need to be informed when a bug appears... some might not care, and that's everyone's own decision!

 

Again, thanks.

Link to comment

After running some tests i believe i have found the issue and come up with 2 options to fix the missed heartbeat self repair issue. The error lies simply in the else statement of the "Leak Startup Alert" program. I believe that i overlooked a real life test and was simulating missed heartbeats by modifying the variables. While the program worked for startup detection it had a flaw that would repair a missed heartbeat once one was detected. I was trying to minimize the amount of programs needed for this and was trying to initiate the missed heartbeat detection on start and wrongly included this in the else statement of the "Leak Startup Alert" program.

 

I urge anyone that uses the set of programs to run tests of their own to ensure everything is working as expected.

Please let me know if you run see any other bugs.

 

Again I apologize for any inconvenience this may have caused anyone.

 

 

FIX 1 (dirty fix not recommended)

 

This fix assumes that your leak sensors are in working order and will rely on a heartbeat of the sensor which will start the process of missed heartbeat after a reboot. 

 

Simply remove the else statement from the Leak Startup Alert program.

Missed heartbeat detection will not be started after a reboot of ISY until a heartbeat is received from the leak sensor

 

FIX 2 (best option)

 

Step 1 modify leak startup alert program to look similar to this and enable to "Run At Startup"

Leak Startup Alert - [ID 0083][Parent 008A][Run At Startup]

If
        $iStartup is 0
    And (
             $sLeakHotWaterTank is 1
          Or $sLeakDishwasher is 1
          Or $sLeakMasterBathSink is 1
          Or $sLeakWashingMachine is 1
          Or $sLeakHotWaterTankHB is 0
          Or $sLeakMasterBathSinkHB is 0
          Or $sLeakDishwasherHB is 0
          Or $sLeakWashingMachineHB is 0
        )
 
Then
        Send Notification to 'Default' content 'Leak Sensor Startup Alert'
 
Else
   - No Actions - (To add one, press 'Action')
 
Enable this to run at startup.
If a leak or missed heartbeat is detected at startup an alert will be sent
No further notifications will be sent for pre-existing leaks until the devices send a heartbeat status update

Step 2

Create new program for ISYstartup as follows and enable "Run At Startup"

ISYStartup - [ID 0086][Parent 008A][Run At Startup]

If
        $iStartup is 0
 
Then
        Wait  2 minutes 
        $iStartup  = 1
 
Else
   - No Actions - (To add one, press 'Action')
 
Enable this to run at startup.
This will give your ISY time to boot up and prevent false repairs of missed heartbeats at boot

Step 3 

Create new program to start missed heartbeat detection on bootup and enable "Run At Startup"

Leak Startup Heartbeat - [ID 0084][Parent 008A][Run At Startup]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Wait  15 seconds
        Run Program 'HotWaterTank - Heartbeat Missed' (Then Path)
        Run Program 'Dishwasher - Heartbeat Missed' (Then Path)
        Run Program 'MasterBathSink - Heartbeat Missed' (Then Path)
        Run Program 'WashingMachine - Heartbeat Missed' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 
Enable this to run at startup.
This will kick off missed heartbeat detection at ISY start up
If a heartbeat is sent the detection restarts otherwise Missed heartbeat will be sent out 25 hours post startup
The wait is needed to allow the isy to boot up and populate the variables. 
Without the wait the startup alert may not contain the information of the leak sensors status
Depending on your ISY the wait period may need to be changed but should remain lower that the wait period specified in the ISY startup program
Link to comment
  • 5 months later...

This is response to question asked by dierwin

 

 johnstonf,

deirwin has just posted a reply to a topic that you have subscribed to titled "Leak Sensors - Another (Suggested) Complete Program Package".

Thank you for doing this!  I am unable to find the "Add And (..)" button.  I've googled and read and searched...  Even Wiki, doesn't tell me how to access it, just how to use it.

 

 

post-7355-0-06638100-1500227491_thumb.pngFirst add an AND statement, then you'll see the AND.. OR..

 

See attached screenshot...

Link to comment

Thanks to everyone that created and fine-tuned this!  I also added a program to verbally announce the leak through my ELK M1G system.  Works perfectly as far as I can see and tested.  I assume announcements could be announced through Alexa, Sonos, or Audio System also.

Link to comment
  • 2 weeks later...

Adding my Thanks.

 

To calm my panic if not home when an email arrives on my phone I added a line to the emails so I know if the water is shut off :

 

Water Shutoff Valve Status
Water Valve shutoff relay is: ${sys.node.XX XX XX 2.ST}
On = Water valve is closed. Water to the house is shut off

 

Since the leaks sensors have to be manually reset I added a line to the Leak repaired program to turn the water valve back on.

 

ISY shuts off the water when a leak sensor reports wet. These programs keep me informed of leaks and sensor health. And when I reset a leak sensor after testing or an actual leak is repaired the water is turned back on.

Link to comment

Adding my Thanks.

 

To calm my panic if not home when an email arrives on my phone I added a line to the emails so I know if the water is shut off :

 

Water Shutoff Valve Status

Water Valve shutoff relay is: ${sys.node.XX XX XX 2.ST}

On = Water valve is closed. Water to the house is shut off

 

Since the leaks sensors have to be manually reset I added a line to the Leak repaired program to turn the water valve back on.

 

ISY shuts off the water when a leak sensor reports wet. These programs keep me informed of leaks and sensor health. And when I reset a leak sensor after testing or an actual leak is repaired the water is turned back on.

I used a KPL, that I used for my security system code.

 

I have installed detection for several different codes to reset my well pump and washing machine as well as toggling my security system programs.

 

For the washing machine leak, and well shut off, I send the reset code with the notification.

 

'Well pump shut off. After checking basement for leaks, reset the pump by pressing code AAAA on the laundry room keypad.

 

For the washing machine BBBB.

 

 

 

Sent from my SGH-I257M using Tapatalk

Link to comment
  • 3 weeks later...

Rabbit:

 

I do greatly appreciate your time and efforts in sharing this programming with us in the forum.  I've put it into place in my system.  (for interest sake:  I'm using my system to detect rain water leaking into my basement.)

 

I have a simple question:  how do I "repair" a leak?  Does this happen when a leak sensor gets dried out (or dried off by me) or is it necessary to press the button on top of the unit?

Link to comment

Someguy,

 

Glad you found this useful. I still give most the credit to Belias who came up with the original programs. Without his work I don't think I could have come up with these programs on my own.

 

First, there are two types of leak sensors. Early generations would automatically return to dry if a leak were to dry up while later generations always need to be reset manually after a leak is detected. This is done by making sure the sensor is dry and pressing the button on the top of the sensor. Personally I don't have any of the early generations that would reset on their own so I can't say if or how well this set of programs work with these types of sensors. I would like to think that everything would work fine with the early gen sensor but cant confirm. Considering that these are designed to help mitigate water damage to your home, I highly recommend that everyone test, test and test again. There is alot going on with these programs and one simple mistake in the program can be detrimental if a leak went unnoticed.

 

Sent from my SM-G920V using Tapatalk

Link to comment
  • 5 months later...

Rabbit:

 

I've followed your instructions and have my first sensor basically working.  I've got a few questions though.

 

Eventually, I'll have something like 14 leak sensors.  At the very least, each sensor has a line like "$variableHB init to $variableHB" to preserve the state variable across reboots.  With 14 sensors doing a heartbeat at different times of the day, this is a number of accesses to non-volatile memory each day.  Is there a reliability issue with this long term?

 

Also, you have a comment that "the Leak Detection" state for each sensor is only reported once at re-boot, and then only after a heartbeat.  Is there a reason that you do not check if a sensor Leak detector has remembered a leak and re-trigger the Leak Detected program for that sensor if it was last detected in Leak State?

 

Thanks,

 

Sean

Link to comment

 With 14 sensors doing a heartbeat at different times of the day, this is a number of accesses to non-volatile memory each day.  Is there a reliability issue with this long term?

 

I've had 15 sensors in use for nearly two years now, with no apparent issues in reliability.

Link to comment
  • 2 months later...

First let me thank Rabbit for all the work and time he has put in on this programming.  I have implemented two leak sensors including the January "FIX 2" and I have a couple of observations/questions for anyone using this technique.

1. Looking at the sensor status on the main page I see what I would expect:  Dry = ON, Heartbeat = ON, and Wet = OFF . I assume Heartbeat = ON means heartbeat received.  Does anyone know how often a heartbeat is sent?

2. On the Program Summary page both of my "Heartbeat Missed" programs are running 'Then' (for the last 4 days).  Should these run all the time?

3.I'm far from accomplished on the ISY programming technique, and I'm shaky on how the variables interact with the programs, even after reading the explanations of them, but I can't see a way to exit the "Sensorname" - Heartbeat Missed program.  After the 25 hour wait, the HB variable is set to 0 which is just the opposite of what I would expect given my current heartbeat status of  "ON".  Then it looks like it enters a continuous 12 hour repeat loop with no exit!  Maybe I need to read up on the effect of the "Control" command. 

Can anyone help clarify any of this?

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...