Page 1 of 1

Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Fri Jan 30, 2009 9:25 am
by nicb
Over time my setup has been increasing reliant on motion sensors to trigger events, but one thing that has plagued the effectiveness of this has been the batteries dying in the motion sensors – When things stop working I don’t immediately know what has gone wrong and with some motion sensors only being tripped by exception I never knew if those ones are working.

Until I was reminded of the dawn/dusk feature of the MS13s in a thread on these forums. My MS13s had been set up in the default mode which only trigger on motion. There are other modes and the interesting one is mode 3 – in this mode motion is triggered AND dawn/dusk on unit code+1. And I use this to check the battery health of the units.

First I had to re-unit code all my motion sensors and change them to mode 3. I chose even unit codes for motion and then the odd unit code is the dawn/dusk. I created new devices for the dawn/dusk codes and a variable per unit. Then defined an X10 recieved trigger action each of the dawn/dusk codes and write date & time to the variable each time its triggered. Finally I have a timed action which occurs once a day and checks the state of each of the variables and if it is today. By exception it emails me that the batteries need changing in a given unit.

I’m sure this logic may already be apparent to some, but I’m posting it here in case it is useful to others. The AppleScript that this uses is all pretty rudimentary (and my coding skills are poor) but I’ll happily post the scripts if anyone is interested.

-Nic

PostPosted: Fri Jan 30, 2009 11:53 am
by macpro
Please post the script.
I'm using a lot of MS13's in my setup and I too have the problem of batteries running out of power.

PostPosted: Fri Jan 30, 2009 12:08 pm
by nicb
No probs -

The trigger action for any command on the dawn/dusk unit code is embedded AppleScript

Code: Select all
set value of variable "Battery_Status_Lobby" to (current date) as string


And then the daily timed action is again embedded AppleScript

Code: Select all
# Read back the variable
set bsLobby to value of variable "Battery_Status_Lobby"

# Get todays day of the week
set t to (current date) as string
set AppleScript's text item delimiters to {","}
set dow to text item 1 of t

# Lobby - get the day of the last update
set ud to text item 1 of bsLobby

if ud = dow then
    log "MD Lobby battery seems OK"
else
    send email to "user@domain.com" with subject "MD Lobby batteries need replacing"
end if


Thats about it. At the moment I run that last block for every unit. My code could be optimised to define an array of the variable names and then loop through them, but I haven't done that yet.

Good luck.

PostPosted: Fri Jan 30, 2009 3:05 pm
by anode
Anyone add a supercap to the MS1xxs? gonna try it someday. Hopefully it will avoid the reprogramming it after each battery change.
(Also looking into making a small 3V regulator and bypass the whole battery issue)

Scheduled script to detect no signal for a long time

PostPosted: Wed Feb 25, 2009 12:10 pm
by DougK
Coming in late again on this thread…

I have a script, that Indigo schedules daily, which loops through all my motion detector and checks for the condition of 'no signal from' for a specified period of time. It has proven its worth for years.

My motion detectors have MS12, MS13, MS14, whatever in their description field, which the script keys in on to identify them. The 'every' statement to begin the loop might have to be redesigned for your setup, such as:
Code: Select all
   set MotionDetectors to every device whose name contains "Motion Detector"


or whatever standards you've chosen.

Here's the script:
Code: Select all
property AlertTime : 2 -- in days. Since I might be gone for a weekend, I tolerate no signals from a device for a couple of days (the battery might not be dead)

set Now to current date
set Q to "\"" -- a backslash character

tell application "IndigoServer"
   set MotionDetectors to every device whose description starts with "MS1" -- {"MS12A","MS13A","MS14A"}
   repeat with EachDetector in MotionDetectors
      set LastChanged to last changed of EachDetector
      if year of LastChanged is 1904 then ¬
         set LastChanged to GetTimeStampForDevice(name of EachDetector)
      
      if LastChanged is "Unknown" then
         set SUT to value of variable "StartUpTime" -- as date fails
         -- construct a date class variable
         set LastChanged to run script "date " & Q & SUT & Q
      end if
      
      set ElapsedTime to Now - LastChanged
      if ElapsedTime is greater than AlertTime * days then
         set ElapsedDays to ElapsedTime div (1 * days)
         set DetectorName to name of EachDetector
         if DetectorName ends with "Dusk" then
            --ignore; one notification per device, should be enough!
         else
            set DetectorAddr to address of EachDetector
            set IdleMsg to DetectorName & " Detector at address " & DetectorAddr & " has not sent a signal for " & ElapsedDays & " days."
            log IdleMsg
            say IdleMsg
         end if
      end if
   end repeat
end tell

PostPosted: Wed Feb 25, 2009 1:23 pm
by macpro
Thanks for the script Doug.
I tested it and have 2 additions to your post:

1. Your script makes use of the GetTimeStampForDevice function. This means the attachment "time stamp attachment" has to be present in the attachments folder of Indigo. I had moved that script to the "attachments (disabled)" folder and got AppleScript errors because of that.
2. To get your script running the variable StartUpTime needs te be defined manually.

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Sat Oct 20, 2012 8:55 pm
by Ericbo
Looking at the best option to monitor the batteries of my sensors, I was wondering if any of you would use the heartbeat monitor and, if you do, how you would have implemented that ? Much appreciated !

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Sun Oct 21, 2012 7:47 am
by bschollnick2
Ericbo wrote:
Looking at the best option to monitor the batteries of my sensors, I was wondering if any of you would use the heartbeat monitor and, if you do, how you would have implemented that ? Much appreciated !


Take a look at Switchboard...

It automatically tracks, and will notify you on a timeout situation on the heartbeat (which is generally due to battery failure...)

The next version will have an option for an email notification on Heartbeat time out...

- Benjamin

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Sun Oct 21, 2012 4:35 pm
by Ericbo
bschollnick2 wrote:
Ericbo wrote:
Looking at the best option to monitor the batteries of my sensors, I was wondering if any of you would use the heartbeat monitor and, if you do, how you would have implemented that ? Much appreciated !


Take a look at Switchboard...

It automatically tracks, and will notify you on a timeout situation on the heartbeat (which is generally due to battery failure...)

The next version will have an option for an email notification on Heartbeat time out...

- Benjamin


Thank you Benjamin ... I am starting to implement your Switchboard for the house alarm .. read already quite a lot but did not see the heartbeat details, is the current version just giving a log warning on missing heartbeat ? Much appreciated Eric

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Sun Oct 21, 2012 7:04 pm
by bschollnick2
Ericbo wrote:
Thank you Benjamin ... I am starting to implement your Switchboard for the house alarm .. read already quite a lot but did not see the heartbeat details, is the current version just giving a log warning on missing heartbeat ? Much appreciated Eric


Yes, it will log the missing heart beat currently... The next version will offer the option of emails on the missing heart beat...

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Mon Nov 19, 2012 2:30 pm
by Ericbo
bschollnick2 wrote:
Ericbo wrote:
Thank you Benjamin ... I am starting to implement your Switchboard for the house alarm .. read already quite a lot but did not see the heartbeat details, is the current version just giving a log warning on missing heartbeat ? Much appreciated Eric


Yes, it will log the missing heart beat currently... The next version will offer the option of emails on the missing heart beat...


Much appreciated ! ... One comment about KR10A's, these do not have a heartbeat, so it would be nice to be able to avoid the heartbeat alarm/log when setting up the device (i have 3 of them so get the 3 log warnings for each trigger) .. Definitely not an urgent one .. :)

Re: Battery Status of X10 Motion Sensors (MS13s)

PostPosted: Mon Nov 19, 2012 3:35 pm
by bschollnick2
Ericbo wrote:
bschollnick2 wrote:
Ericbo wrote:
Thank you Benjamin ... I am starting to implement your Switchboard for the house alarm .. read already quite a lot but did not see the heartbeat details, is the current version just giving a log warning on missing heartbeat ? Much appreciated Eric


Yes, it will log the missing heart beat currently... The next version will offer the option of emails on the missing heart beat...


Much appreciated ! ... One comment about KR10A's, these do not have a heartbeat, so it would be nice to be able to avoid the heartbeat alarm/log when setting up the device (i have 3 of them so get the 3 log warnings for each trigger) .. Definitely not an urgent one .. :)


v0.76 is being worked on right now, and it'll have that option....

I'm just trying to understand the bug / issue I ran into with the updating of the device fields... before I come up with a resolution. I expect it'll be ready tomorrow or wednesday....

- Benjamin