Jump to content

Understanding a simple program.


Stagehand

Recommended Posts

Posted

Hello,

I have been using the following program to keep an update on the battery status of my Insteon Leak Sensor 2852-222 by blind faith since 2018.

I trust that the program logic is correct because I have seen postings of similar programs, but I just don't understand it. I would be grateful if someone could explain it in terms a simpleton like me can understand. The following is the program.

Control 'Sensor-Heartbeat' is Switched On

Then

Wait 25 hours

Send notification 'low battery'

 

It seems to me that I should get a "low Battery" notification every 25 hours and if the Heartbeat is not On, then the battery is actually low and I will get no notification. By the way, I do not get a "low battery" notification every 25 hours.

Thank you

 

 

 

Posted

A leak sensor sends a heartbeat signal once every 24 hours. When the signal is received, the program executes the Then clause and starts waiting. After waiting 25 hours, it sends a notification that the battery must be low. If it had received another heartbeat the 25 hour wait would start over.

This is more of a hint because often times the rf signal is simply missed so I don’t look unless it misses for 2 days.

  • Like 1
Posted (edited)

To put it another way: Program timers are retriggerable and each heartbeat received retriggers the Wait 25 hours timer so the notification line never executes.

I add a loop on my heartbeat watchdog programs at the bottom, so they test again in 25 hours. My notification states that it may be a low battery or just a missed signal so as not to cause any panic. My LD under my dishwasher has missed heartbeats about once per year. If I never get the second one, I just ignore it.

BTW: Most use two lines to trigger
If
    heartbeat is switched ON
      OR
   heartbeat is switched OFF

Some LDs (maybe all?) send alternating signals every 24 hours.

Edited by larryllix
Posted

The program logic is as described by @hart2hart I would however make a suggested improvement to your program.  Add one line to loop back to the then block of the same program.  The problem with the current program is the notification is only sent once.    If you forget that it arrived or for some reason the notification gets lost on the way you are never notified again.  To solve the problem add one more line to restart the THEN block meaning that every 25 hours the notification will repeat until a new heartbeat is received.

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

If
        'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched On
 
Then
        Wait  25 hours
        Resource 'NotificationNS.DoorTrouble.BarnOHD'
        Run Program 'hb.BarnOHD' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 

 

 

  • Like 1
Posted
If
        'Door Switches / Barn OHD / Barn OHD-Heartbeat' is switched On
 
Then
        Wait  25 hours
            repeat every 6 hours
            Resource 'NotificationNS.DoorTrouble.BarnOHD'
 
Else
   - No Actions - (To add one, press 'Action')

@MrBill

An alternative way to do it that allows your notifications to come on a different schedule than every 25 hours once a failed heartbeat triggers it.

Guest
This topic is now closed to further replies.

×
×
  • Create New...