Jump to content

1st Programming Attempt - Leak Sensor


Go to solution Solved by MrBill,

Recommended Posts

Posted

Hi all,

Feedback needed from the pros. I just completed a water leak sensor - heartbeat program in IoP by following a very detailed description posted back in 2019. I provided a pic from the directions and also a pic of what I produced. Please review and confirm I didn’t miss anything. I wasn’t sure I needed the 2 parentheses at the bottom of the “If” section. 

 

 

805BDACE-CF23-4972-B59D-1F8D5AD59B07.jpeg

C0DBF375-44F4-4D32-B992-6FD5511E3616.jpeg

Posted (edited)

Your missing an AND set of parenthesis.  You need it....  

the "and" button is right next to the "or" button. image.png.82dddf989b4ca80a2d8a2418eee757fe.png

Actually it looks like you didn't find the OR button either..  it may be off the screen to the right, try maximizing your admin console window.

also to paste programs from the admin console, save programs, then right click the program name and choose the bottom entry "Copy to clipboard" and then paste into the forum.

It's much easier to give help with pasted programs (this case it doesn't matter, but sometime I cut and paste from users programs to reply.)

Edit to add second screenshot:

image.thumb.png.8d808db268154293a4da2bb37adf4ca0.png

Edited by MrBill
  • Like 1
Posted

@MrBillThank you for the feedback. Sorry for the crude screenshots. I was posting from my phone.

I'll add the 2 parentheses, but not sure where I missed "Or". I did just notice that "And ("  needs to move up one line.

This is the first time I have programmed anything, so appreciate the patience. 

Now I am unable to find the Program to edit for changes. This type of controller is a whole new world for me.

  • Like 1
  • Solution
Posted
18 minutes ago, FloridaGary said:

@MrBillThank you for the feedback. Sorry for the crude screenshots. I was posting from my phone.

I'll add the 2 parentheses, but not sure where I missed "Or". I did just notice that "And ("  needs to move up one line.

This is the first time I have programmed anything, so appreciate the patience. 

Now I am unable to find the Program to edit for changes. This type of controller is a whole new world for me.

Since you have this line image.png.29fb0beaceee2385045bb6e39bf8cc7a.png entered as a comment, you're missing part of the logic... maybe that's your goal.  

The heartbeat program I use is much simpler:

hb.BarnOHD - [ID 0063][Parent 0072]

If
        'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched On
     Or 'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched Off
 
Then
        Wait  25 hours
        $iDoor.BarnOHD.HBmissed += 1
        $iDoor.BarnOHD.HBmissed Init To $iDoor.BarnOHD.HBmissed
        Wait  2 seconds
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
        Run Program 'hb.BarnOHD' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')

This one only nags every 25 hours, some people at a repeat every 6 hours just above the notification line (which is the "Resource....." line).... in that case you would drop the last line which just repeats the Then block.

There's about 100 differnt ways to do anything with an ISY....
 

 

  • Like 1
Posted

Once again, thank you for the information @MrBill. When you spend hours trying to learn something new, I had to chuckle when you stated "you're missing part of the logic." From a lay perspective (me) there is no logic in programming, much like someone trying to learn the English language with all its nuance etc. However, I'll get there eventually. I just hope my house doesn't flood while learning to program these sensors. haha 

  • Haha 1
Posted
11 minutes ago, FloridaGary said:

Once again, thank you for the information @MrBill. When you spend hours trying to learn something new, I had to chuckle when you stated "you're missing part of the logic." From a lay perspective (me) there is no logic in programming, much like someone trying to learn the English language with all its nuance etc. However, I'll get there eventually. I just hope my house doesn't flood while learning to program these sensors. haha 

lol.... just ask when you need help... we've all been there.  ISY/Event style programming is also a bit different than most programing languages.

  • Like 3
  • Thanks 1
Posted (edited)

@MrBillOk, I finally got my to-do list completed and now back to programming. You previously suggested I should maximize my screen in the program, which it already was. Please review this when you have a chance and let me know if I am the Bill Gates of ISY programming yet. lol

image.thumb.png.07b92ff54e1753bee9a762f7a8c50f15.png

 

Edited by FloridaGary
Posted (edited)
45 minutes ago, FloridaGary said:

@MrBillOk, I finally got my to-do list completed and now back to programming. You previously suggested I should maximize my screen in the program, which it already was. Please review this when you have a chance and let me know if I am the Bill Gates of ISY programming yet. lol

image.thumb.png.ca48dc6a7e914d5585db9ffb27a253d3.png

Much easier to read if you right click on the program in the program tree and select "copy to clipboard" then paste it into your post using the '<>' tool.

BTW: I dissembled some of Bill Gates code back in the 70s. He was not a good code writer.

Edited by larryllix
Posted

Thank you @larryllix . MrBill suggested the same re: copy/paste, but I thought this looked better. 
 

Interesting info re: you and Bill Gates. So, what I am hearing is that I am as good as he was before you had to disassemble his code? Lol. 

  • Haha 1
Posted

@FloridaGary

Keep in mind the Green Statements as you've entered them are comments.  The ISY doesn't do anything with a comment, the statement is not executed as code, it's just a note that appears on the screen.  Effectively your program does nothing, because the only thing in Then is a comment.

image.png.ac9823a675209b7bfdbc279b593a3c82.png

Posted (edited)

Ok. This screen is difficult to navigate and it seemed like the only way to match the format from the publication I am using. Back to the drawing board. Thanks again for the feedback. 

Edited by FloridaGary
Posted
16 minutes ago, FloridaGary said:

Ok. This screen is difficult to navigate and it seemed like the only way to match the format from the publication I am using. Back to the drawing board. Thanks again for the feedback. 

Add all the lines in order.  Then add the Or and And parenthesis from the top down. 

It is difficult to work with multiple levels of parenthesis in your example, which is one reason i mentioned there is more than one way to skin the cat.

Posted
7 minutes ago, MrBill said:

Add all the lines in order.  Then add the Or and And parenthesis from the top down. 

It is difficult to work with multiple levels of parenthesis in your example, which is one reason i mentioned there is more than one way to skin the cat.

I’ll give that a try or reconsider the example you provided. #ChallengeAccepted ?

  • Like 1
Posted

@MrBillI went to the Program Details page to address the following “Comment” I added……

// $sLeakPoolBathSink is not 3

The only options I have to maintain the format it’s in is to use “Comment”. 
 

I looked at Status, Control, Program, X10, Variable and Module. None will give me the option to enter this command. So, I looked back at the Program Summary page and it shows the Pool Bath Sink-Heartbeat program ran today at 12:15. Isn’t this proof that it’s working and I am indeed the next Bill Gates? 

Posted

It's Variable.  Note that you need to have a line in the IF block selected.  Variable if a line in the THEN or ELSE block is selected will be differnt.

image.png.4b1185296d72001e348580f0dd7a7fa2.png

7 minutes ago, FloridaGary said:

So, I looked back at the Program Summary page and it shows the Pool Bath Sink-Heartbeat program ran today at 12:15.

The program ran indeed, but if this is your Then block:

image.png.8c2cdc42320a700a679b5f5312eac5b8.png

it didn't actually do anything.

Posted
13 minutes ago, MrBill said:

It's Variable.  Note that you need to have a line in the IF block selected.  Variable if a line in the THEN or ELSE block is selected will be differnt.

image.png.4b1185296d72001e348580f0dd7a7fa2.png

The program ran indeed, but if this is your Then block:

image.png.8c2cdc42320a700a679b5f5312eac5b8.png

it didn't actually do anything.

Ok. If it’s running as expected with 1 less line of code, I can’t complain. At least now I feel like I’m headed in the right direction. I’ll take the win! Thanks again. Some day I may actually understand what I did. ?

Posted
1 minute ago, FloridaGary said:

Ok. If it’s running as expected with 1 less line of code, I can’t complain.

It's running but not as expected for the suite of programs that you're trying to replicate. 

Honestly I scrolled thru that article when you linked it in another thread a few days ago... it's good, and it's advanced.  You should start with beginner stuff tho....  You've moved straight to the Diamond slopes without going to Ski School.  Start with some more basic programs and learn how the ISY Programming language works.. then build on that until you reach this advanced state that you're trying to replicate and not having luck with because you don't understand what it's doing, or for that matter what it means when a program "runs".

  • Like 1
Posted
8 minutes ago, MrBill said:

It's running but not as expected for the suite of programs that you're trying to replicate. 

Honestly I scrolled thru that article when you linked it in another thread a few days ago... it's good, and it's advanced.  You should start with beginner stuff tho....  You've moved straight to the Diamond slopes without going to Ski School.  Start with some more basic programs and learn how the ISY Programming language works.. then build on that until you reach this advanced state that you're trying to replicate and not having luck with because you don't understand what it's doing, or for that matter what it means when a program "runs".

Great advice and much appreciated. By the way, I see what you mean about using “Variable”. That made the difference.
 

You are right, I was not aware this was not the bunny slopes. I was trying to blindly follow directions that were laid out well. Up until now, it has not been difficult to get all devices up and running on IoP except for the 2450 module that I couldn’t read with glasses on. However, the rubber hits the road when it comes to programming. Clearly out of my league. 

Posted

@MrBillTo close out this thread, I'll leave you with the result of your guidance and patience. Also, your suggestion about starting with basic programming is a good one and I plan to follow through. I have been very fortunate to retire early 4 years ago and although I stay busy with personal interests, learning how to program will be something I pursue locally. As they say, you're never too old to learn something new. ?

image.thumb.png.83bb7c62510adf33b0aa8b046fd52196.png

  • Like 2
Posted
6 minutes ago, FloridaGary said:

@MrBillTo close out this thread, I'll leave you with the result of your guidance and patience. Also, your suggestion about starting with basic programming is a good one and I plan to follow through. I have been very fortunate to retire early 4 years ago and although I stay busy with personal interests, learning how to program will be something I pursue locally. As they say, you're never too old to learn something new. ?

Keep in mind.... That program by itself isn't notifying you of anything.. it's just setting a variable to 1 under certain conditions.

Posted
1 hour ago, MrBill said:

Keep in mind.... That program by itself isn't notifying you of anything.. it's just setting a variable to 1 under certain conditions.

I have also completed the programming for “Timeout” and “Wet” in addition to “Heartbeat”. I am currently reviewing all 27 programs and will review again tomorrow with a fresh set of eyes. I haven’t spent this much time on a laptop in 4 years. 

  • 3 weeks later...
Posted

I'm also having issues with Leak Sensors. Now that Insteon product has hit a dead end, I've stockpiled all sorts of sensors and product. What's different about this product though is that much of it has probably been sitting on shelves for quite some time. Batteries might be suspect, and older versions may be dusted off and sold to those who still want to use Insteon product. 

Yes, I've read the "Leak Sensor and Heartbeat Messaging", and although this software probably works great once one confirms that everything works, it's not very good at seeing and testing the signaling that's supposed to be happening. Thus, Instead of going that route, I created 3 simple programs, each triggered by an On OR Off for each of the 3 'outputs'. I DID NOT create State Variables since I'm not doing any triggering off of those variables. Instead, I'm just using Integer variables to keep track of how many times a trigger has occurred.

Installation should be as simple as any other RF sensor, holding the set button until if flashes, and then adding the device with the Address and providing a name. I always turn on the Event Viewer on Level 3 to ensure communication flows regularly. 

The typical test for each of these signals is shown here:

TypicalTest.thumb.jpg.b1803732f03b8149482b98c3d95067bf.jpg

For this 'test', I'm just looking for anything that happens with the heartbeat. From this thread:

It was mentioned that I should be able to get things to trigger by pressing the SET button. But when doing so, ONLY the DRY sensor program triggers. When I look and read the data coming through on the Event Viewer, I only see the DRY being sent across the line. Thinking something might be wrong with that sensor, I installed a second...and this one does NOTHING, when pressing the button, even though the light flashes when I press the SET. I DID change batteries between the 2, thinking it might be a battery issue. Still, NOTHING from the Newer one, and ONLY a DRY trigger when using the first, regardless of which battery is used.

Unsure of what to try next. It's probably something stupid, which is typically the issue for me.

I HAVE also upgraded firmware to V5.3.4, and do not have any Z-Wave hardware installed. It's an old, but reliable box....but now have 3 spares in case something should fail.

Has anyone interrogated the device like this before assuming that all signals are firing the way they should be?

Steve

 

 

 

 

Posted

A better Heartbeat Program:

This is a door sensor, but the same applies for any of the Insteon Battery Devices that generate heartbeats.  The advantage here over what you've posted above is that you're only notified when the heartbeat is missed, your program is sending you a barrage of heartbeat notifications everyday.

First I create 3 integer variables for the device: Missed Heartbeats, Battery Days, and Total transmissions.  (Total Transmissions in fact isn't as useful as I thought it would be, but nonetheless it does help somewhat in deciding if the battery needs to be replaced or the sensor just needs a reboot (i.e. remove and re-install battery).

hb.BarnOHD - [ID 0063][Parent 0072]

If
        'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched On
     Or 'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched Off
 
Then
        Wait  25 hours
        $iDoor.BarnOHD.HBmissed += 1
        $iDoor.BarnOHD.HBmissed Init To $iDoor.BarnOHD.HBmissed
        Wait  2 seconds
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
        Run Program 'hb.BarnOHD' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')

Note: all the heartbeat programs are also run-then by a program that runs at startup, That program waits 10 minutes to start these... (my ISY struggles at startup due to the size of the insteon network and the query all that runs)
 

What happens here, is that when the heartbeat is received we jump right into a 25 hour loop to wait for the next heartbeat.   If the next heartbeat is received within that window the rest of the program never complete.... instead the wait starts over.  If the next heartbeat is missed, the integer variable is incremented, and a notification is sent in this case via a Network Resource and Pushover. (that line could also be changed to "Notify")  Finally the last line of the program starts the loop over again waiting for the next heartbeat.  (If that line was skipped, the program would end and we would never be reminded.)

It should be noted that some of the battery sensors are better about sending heartbeat than others.  Some need only need 24 hour waits (like the hidden door sensor) while some even need 26 hour, you just need to fine tune that.  It should also be noted that when heartbeats stop coming in the battery isn't actually dead yet, the sensor will still work for a number of days afterward.  Bottom line, failed heartbeat isn't an emergency, check the sensor at your convenience of the next day or so.  Sometimes the next heartbeat will just arrive, and sometimes you just need to pop the battery out and back in.   High battery day counts, and high transmission counts tell you when it's time to actually replace the battery.

For total transmission counts:

BarnOHD - [ID 0042][Parent 0033]

If
        'Door Switches / Barn OHD' is switched On
     Or 'Door Switches / Barn OHD' is switched Off
     Or 'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched On
     Or 'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched Off
 
Then
        $iDoor.BarnOHD.TransCount += 1
        $iDoor.BarnOHD.TransCount Init To $iDoor.BarnOHD.TransCount
 
Else
   - No Actions - (To add one, press 'Action')
 

For the battery days counts:

AddAge - [ID 003D][Parent 0034]

If
        Time is 12:12:12AM
 
Then
        $iDoor.BarnOHD.BatteryDays += 1
        $iDoor.BarnOHD.BatteryDays Init To $iDoor.BarnOHD.BatteryDays
        [Redacted about 30 other battery day variables that follow]
Else
   - No Actions - (To add one, press 'Action')


Then there's also a quick way to reset the 3 counters when a battery gets changed.  I run this program manually from a Home Assistant dashboard button, but it could be also run manually from the admin console.   The program actually does send 4 notifications so that I have the final counts in case I reset the wrong one (which has happened), I also used to keep the totals in a spreadsheet but the bottom line is I've got the feel of the system now and don't record them anymore.

BarnOHD.reset - [ID 01A1][Parent 01B5]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Resource 'NotificationNS.DoorTrouble._resetCountersBegin'
        Wait  1 second
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
        Wait  2 seconds
        $iDoor.BarnOHD.HBmissed  = 0
        $iDoor.BarnOHD.HBmissed Init To $iDoor.BarnOHD.HBmissed
        $iDoor.BarnOHD.BatteryDays  = 1
        $iDoor.BarnOHD.BatteryDays Init To $iDoor.BarnOHD.BatteryDays
        $iDoor.BarnOHD.TransCount  = 1
        $iDoor.BarnOHD.TransCount Init To $iDoor.BarnOHD.TransCount
        Wait  2 seconds
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
        Wait  1 second
        Resource 'NotificationNS.DoorTrouble._resetCountersComplete'
        Run Program 'hb.BarnOHD' (Then Path)
 
Else
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
 

 

 

 

Posted

Mr Bill, I'm hoping that the post above was intended for me. I'm pretty code savvy, and was only trying to get some feedback on what I might be doing wrong in regards to installation....

First sensor: ONLY get DRY trigger when pressing SET button.

Second sensor installed: NO HEARTBEAT, NO WET, NO DRY triggers when pushing the SET button.

I currently have 20 motion sensors installed at home, and initially spent a considerable time understanding its functions before installing at the home. Wanting to do the same for the Leak Sensor, but having mixed results when trying to test signals.

Just looking for a way to CONFIRM that all 3 outputs of the sensors work (DRY, WET, HEARTBEAT), and data comes back uniformly (I've read that when pressing SET, all 3 outputs should be triggered, but can't even make that work).

Yes, I agree that I'd get a barrage of email messages, but that's what I was counting on. I configured the sensor a day before a 1 week trip, and didn't get anything for the whole week I was gone....no heartbeat at all.

In addition, I wanted to understand how the alarm system worked, and whether it alerts just once, or repeated times. ANSWER: 9 or 10 alarms when the Wet sensor is triggered, approx. 15 seconds apart. After that, it goes silent. I'm just a geeky engineer who wants to thoroughly understand how a product works before installing a large deployment.

Can any of you think of a reason why pressing the SET button gives mixed results OR why I haven't seen a single heartbeat from either unit? - Steve

Posted
8 minutes ago, shunsader said:

Mr Bill, I'm hoping that the post above was intended for me. I'm pretty code savvy, and was only trying to get some feedback on what I might be doing wrong in regards to installation....

First sensor: ONLY get DRY trigger when pressing SET button.

Second sensor installed: NO HEARTBEAT, NO WET, NO DRY triggers when pushing the SET button.

I currently have 20 motion sensors installed at home, and initially spent a considerable time understanding its functions before installing at the home. Wanting to do the same for the Leak Sensor, but having mixed results when trying to test signals.

Just looking for a way to CONFIRM that all 3 outputs of the sensors work (DRY, WET, HEARTBEAT), and data comes back uniformly (I've read that when pressing SET, all 3 outputs should be triggered, but can't even make that work).

Yes, I agree that I'd get a barrage of email messages, but that's what I was counting on. I configured the sensor a day before a 1 week trip, and didn't get anything for the whole week I was gone....no heartbeat at all.

In addition, I wanted to understand how the alarm system worked, and whether it alerts just once, or repeated times. ANSWER: 9 or 10 alarms when the Wet sensor is triggered, approx. 15 seconds apart. After that, it goes silent. I'm just a geeky engineer who wants to thoroughly understand how a product works before installing a large deployment.

Can any of you think of a reason why pressing the SET button gives mixed results OR why I haven't seen a single heartbeat from either unit? - Steve

Heartbeats only come every 24 hours. You will just have to wait.

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.3k
×
×
  • Create New...