Jump to content

Motion Low Battery notification program


gfrancis0

Recommended Posts

I searched and searched and finally gave up looking for the proper programming format for a program to send an email when a low battery notification is received from a motion sensor. I've attached what I'm trying, is it correct? Is there an detailed online programming reference manual? Thanx for the help.

 

 

Insteon Low Battery program.jpg

Link to comment
I searched and searched and finally gave up looking for the proper programming format for a program to send an email when a low battery notification is received from a motion sensor. I've attached what I'm trying, is it correct? Is there an detailed online programming reference manual? Thanx for the help.
 
 
423702692_InsteonLowBatteryprogram.jpg.6710d61d82271fb51543d58b2f162d88.jpg
Yes. That is exactly the way to do it.
Most don't find the lowbatt signal always reliable.

When batteries get low you should see a multiple flash for every motion detected.

Sent from my SM-G930W8 using Tapatalk

Link to comment

I have a program for each MS that sets a variable to 1 when the Low Battery Control happens. Then I have another program that runs twice a day and if the variable is not 0, then it sends me a notification. I use this method because if a notification is only sent once, it may not get delivered for what ever reason, and I keep getting reminded twice a day until I replace the battery and then zero the variable.

 

Link to comment
40 minutes ago, jca001 said:

I have a program for each MS that sets a variable to 1 when the Low Battery Control happens. Then I have another program that runs twice a day and if the variable is not 0, then it sends me a notification. I use this method because if a notification is only sent once, it may not get delivered for what ever reason, and I keep getting reminded twice a day until I replace the battery and then zero the variable.

 

Can you please provide your actual code for those programs?

 

Link to comment

gfrancis0:

There is a program like this for each MS. When this program runs because the MS sent the Low Battery Event, it increments a variable and then initializes it so if the ISY is rebooted, maybe because of a Power Failure the Low Battery status will not be lost.

FD MS Low Battery On - [ID 0024][Parent 0060]

If
        'Front Door / Front Door-Sensor / Front Door-Low Bat' is switched On
 
Then
        $Int_FD_MS_Battery_Low += 1
        $Int_FD_MS_Battery_Low Init To $Int_FD_MS_Battery_Low
 
Else
   - No Actions - (To add one, press 'Action')
=======================================================

There is a program like this for each MS. When the State variable is changes by the program below this one and the Low Battery variable for the MS is non-zero it will send a notification.

FD MS Low Battery Check - [ID 0026][Parent 0060]

If
        $State_Check_MS_Low_Battery > 0
    And $Int_FD_MS_Battery_Low > 0
 
Then
        Wait  10 seconds (Random)
        Send Notification to 'Home and Work' content 'FD MS Low Battery'
 
Else
   - No Actions - (To add one, press 'Action')
=======================================================

When this program runs it will cause the above program to run the then if the MS has caused the MS_Battery_Low to be non-zero.

Check MS Low Battery - [ID 0023][Parent 0001]

If
        Time is  7:15:00AM
     Or Time is  7:15:00PM
 
Then
        $State_Check_MS_Low_Battery  = 1
        Wait  30 seconds
        $State_Check_MS_Low_Battery  = 0
 
Else
   - No Actions - (To add one, press 'Action')
=======================================================

Let me know if you have any questions about the above programs.

 

Link to comment

LarryM:

That sets the initial value of the variable. By default all variables are initialized to 0 when the ISY is rebooted. If you look at the variable tab you will see a column "Init" and it will be 0 for each variable unless you manually change the value or do it in a program like I did. The statement is setting the variable's init value to its current value. Therefore if the ISY reboots for whatever reason, the variable will still indicate the MS has a low battery and I will still get a notification 2 times a day.

Link to comment

@jca001, thank you.

Quote

Therefore if the ISY reboots for whatever reason, the variable will still indicate the MS has a lobattery and I will still get a notification 2 times a day.

 

Since I started with this stuff 3 weeks ago still struggling with the acronyms/terminology/jargon.

Or maybe it’s has to do with old age. ;)

 

Link to comment

So you get the message and put a new battery in the MS.

-    How does     $Int_FD_MS_Battery_Low      get set back to zero?

 

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

-    Seems like something like the following might replace the last two programs, however, I probably am missing something.

If

(
        Time is  7:15:00AM
     Or Time is  7:15:00PM

)
 And $Int_FD_MS_Battery_Low > 0

Then
        Send Notification to 'Home and Work' content 'FD MS Low Battery'

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

 

 

 

 

 

Link to comment
3 hours ago, LarryM said:

@jca001 

In ‘FD MS Low Battery On - [ID 0024][Parent 0060]’ , what is the function of:

    $Int_FD_MS_Battery_Low Init To $Int_FD_MS_Battery_Low

 

 

Saves the latest state to the "init to" portion of the variable, that ISY transfers  into the variable when booting up.

When ISY boots up the variable will look as if nothing happened.

Link to comment
38 minutes ago, LarryM said:

So you get the message and put a new battery in the MS.

-    How does     $Int_FD_MS_Battery_Low      get set back to zero?

 

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

-    Seems like something like the following might replace the last two programs, however, I probably am missing something.

If

(
        Time is  7:15:00AM
     Or Time is  7:15:00PM

)
 And $Int_FD_MS_Battery_Low > 0

Then
        Send Notification to 'Home and Work' content 'FD MS Low Battery'

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

 

I have been told that the battLow reset when ISY does a MS query via a program. I am not sure if this is true (haven't proven it to myself) but I have a separate query only program for each MS.

Again, many of us have given up on the lowBatt actually working. Some of my 12 units work sometime, some never work, and some may work all the time, some work while the battery has a few more months of energy left. Mant techniques have been tried only to leave users with...

...."just replace the battery when the light stops working". See many other previous threads for the same result.

I have written logging software to record the last four LowBatt signals in a variable. Interesting as it remebers who sent me a lowBatt signal while on holidays. Partially  a waste of time.

 

Here are some MS quirks:

  • tap the link button to send a MS motion detected On/Off alternately
  • tap the link button once to reset the lowBatt signal
  • tap the link button 7 times quickly to force the send of Dark On/Off signal without 5 minutes of delay. (testing sensing levels?)
Link to comment
1 hour ago, LarryM said:

@jca001, thank you.

 

Since I started with this stuff 3 weeks ago still struggling with the acronyms/terminology/jargon.

Or maybe it’s has to do with old age. ;)

 

My MS units are over 4 years old and they work fine yet. :)

Seriously though...we lost the post numbering in this new forum software but the linking button on the top right of each post can indicate the exact post if you copy'n paste it.

Link to comment
1 hour ago, LarryM said:

So you get the message and put a new battery in the MS.

-    How does     $Int_FD_MS_Battery_Low      get set back to zero?

 

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

-    Seems like something like the following might replace the last two programs, however, I probably am missing something.

If

(
        Time is  7:15:00AM
     Or Time is  7:15:00PM

)
 And $Int_FD_MS_Battery_Low > 0

Then
        Send Notification to 'Home and Work' content 'FD MS Low Battery'

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

 

 

 

 

 

You have to go the the Variable Tab and manually change the init and current value to 0. and then click save at the bottom.

 

Link to comment

The old MS sends the Low Battery Control Event only once. The program is using the Control Event, not checking the status of the Low Battery node. Again if the ISY reboots for whatever reason, that node will be incorrect because the MS does not send the Battery status with each motion detection on and off. So that was my reason to write the program to set a variable and  its init value, then check the variable twice a day.

 

If you do not want to replace the battery until the MS does not work any more, then you could check the status of the Dusk-Dawn to see if it is on when you know it is dark where ever the MS is located. Like mine at the Front Door, I could check it at 11PM every night. But there have been some reports that when the Battery gets real low, the MS sends the Control On Event over and over. The mileage on the Battery is going to depend on how often the MS detects motion and has to transmit a message.

Link to comment
9 hours ago, jca001 said:

The old MS sends the Low Battery Control Event only once. The program is using the Control Event, not checking the status of the Low Battery node. Again if the ISY reboots for whatever reason, that node will be incorrect because the MS does not send the Battery status with each motion detection on and off. So that was my reason to write the program to set a variable and  its init value, then check the variable twice a day.

 

If you do not want to replace the battery until the MS does not work any more, then you could check the status of the Dusk-Dawn to see if it is on when you know it is dark where ever the MS is located. Like mine at the Front Door, I could check it at 11PM every night. But there have been some reports that when the Battery gets real low, the MS sends the Control On Event over and over. The mileage on the Battery is going to depend on how often the MS detects motion and has to transmit a message.

Two points must be reset. The lowBatt signal inside the MS as well as the ISY program / variable.
Rebooting ISY may take care of the variable OK, but the MS will be locked on lowBatt and will never send it again. If you change the battery,  power cycling the MS, the lowBatt signal should be reset at that point.

I was hoping SH would have fixed/improved these MSes with the new version release. Already having 11-12 of the old ones it is not likely I will find out. :(

Link to comment

Let me try to clarify some things for LarryM since he is new to ISY.

Assume the programs I provided are in place and the ISY Variables are defined.

The MS sends the Low Battery Control message and the variable gets incremented. This will only happens once. Then twice a day a programs runs and checks the variable and sends a notification because the variable is greater than 0. It is Tuesday and you do not have time to replace the MS battery until Saturday because it requires you getting the big latter to reach MS. You will continue getting 2 notifications each day reminding you the MS battery is low.

On Thursday you have a power failure and the ISY reboots. Because the variable has an init value of 1 or greater, you still get the notifications.

On Saturday you change the MS battery, this resets the Low Battery indication in the MS itself, but does not change the On status of the Low Battery node for the MS in ISY because the MS does not send a Battery OK message. If the ISY did not reboot then you have to select that node in the device tree and then click query at the bottom which does not really query the MS, it just changes the status from On to Off. It does not matter if the ISY rebooted or not, you have to go the variable tab and zero the init and current values for the variable and click save at the bottom.

I chose to be notified twice a day, but you could change it to be just once a day. You could also change it to check multiple times on Saturday and Sunday or some other day when you know you are at home.

When the Low Battery message is first received it does not mean the battery is almost dead. I have put off changing a MS battery for weeks because I was out of town and it continued to work normally. I just got the notification twice a day. When I change the battery, I use a Volt  Meter to check the voltage and write it and the date on the battery. You can search the forum and there are several threads about the battery life of the MS. Some people have tracked, recorded how often the battery needed to be changed, the brand they used and the voltage before as I do, and when changed to try to determine what the Low Battery threshold is. There are some recommendation for specific brands.

Link to comment

@jca001   Much appreciated, thank you for putting that together.

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

Then
        $State_Check_MS_Low_Battery  = 1
        Wait  30 seconds
        $State_Check_MS_Low_Battery  = 0

Side note: from my readings, you are using a 'State' variable above to take advantage of the fact that when it changes 

then  FD MS Low Battery Check - [ID 0026][Parent 0060] will be run every time that variable changes.

 

It takes a bit of time getting use to 'Event driven programming'. ;)

 

 

Link to comment
11 minutes ago, LarryM said:

@jca001   Much appreciated, thank you for putting that together.

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

Then
        $State_Check_MS_Low_Battery  = 1
        Wait  30 seconds
        $State_Check_MS_Low_Battery  = 0

Side note: from my readings, you are using a 'State' variable above to take advantage of the fact that when it changes 

then  FD MS Low Battery Check - [ID 0026][Parent 0060] will be run every time that variable changes.

 

It takes a bit of time getting use to 'Event driven programming'. ;)

 

 

I use a pre-defined value for each room to populate one variable for 11 MSes. I use easy names to remember for these values like $cROOM.MBR, and $cROOM.MUDRM, etc..

One common program watches this variable for changes off 0 value and sends reports, memorises the value in a variable log, and then resets the variable, ready for the next room. When I get around to replacing batteries I have a list of rooms needing service.

BTW: The room constants defined also get used for other monitoring schemes, like Leak detection, motion during alarm sensing, etc.. I send a room chart with each notification of urgent involved texts.

In my Integer variables I predefine about 100 variable values that never change = constants. I make them like this $cXXXXXXXXX

Link to comment

Archived

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


×
×
  • Create New...