Go Back   HomeSeer Message Board > Lighting & Primary Technology Plug-ins > Lighting & Primary Technology Discussion > HomeSeer Z-Wave Plug-in

HomeSeer Z-Wave Plug-in Discussions relating to the Z-Wave plug-in

Thread Tools Display Modes
Old November 21st, 2015, 07:06 AM
johnny_holden johnny_holden is offline
Seer Plus
Join Date: Aug 2013
Location: Wales, UK
Posts: 121
Notification when Battery Devices Fail

Which is the best way to configure events or a device to get a Root Error Status or notification when a battery operated device has failed to wake?
Reply With Quote
Old November 23rd, 2015, 11:32 AM
Sireone Sireone is offline
Seer Deluxe
Join Date: Apr 2013
Location: Florida
Posts: 411
I'm interested in this as well. Sometimes I have devices with 50% battery left, then all of a sudden, no update from these devices only to find out that the batteries died.

Sent from my XT1060 using Tapatalk
Reply With Quote
Old November 23rd, 2015, 12:13 PM
mrhappy mrhappy is offline
Join Date: Nov 2007
Location: W.Mids, UK
Posts: 7,342
I'm starting to think there is probably no one good way to do this, my Fibaro motion sensors started to send ghost motion signals when no one was in the room (the local exorcist couldn't find anything). The battery status devices have never worked right and the device would still send the temp/light just fine so it would not appear dead. Replacing the battery cures them and they are all starting to behave the same at installation+sixish months.

For monitoring some of the devices I use a script, there is another script out there that looks for anything with the device type of battery whereas I look at devices I am interested in and check when they last updated. If they last updated some time ago (18hrs) I just send myself a notification to check them.

Sub Main(ByVal Parm As Object)

        'careful with ref 33 as it might not change for days (front door sensor)
        Dim dvRefList() As Integer = {299, 300, 152, 151, 38, 39, 141, 142, 159, 160}

        For Each DeviceReference As Integer In dvRefList

            'hs.writelog("BatteryMonitor", "Device Name: " & DeviceReference & " Last Change Status: " & hs.DeviceLastChangeRef(DeviceReference))

            Dim dFrom As DateTime = hs.DeviceLastChangeRef(DeviceReference)
            Dim dTo As DateTime = DateTime.Now
            Dim TS As TimeSpan = dTo - dFrom

            'hs.writelog("BatteryMonitor", "Hours: " & TS.Hours) 'output 16 mins in format 00:16:00

            If TS.Hours > 18 Then
                'should capture all devices
                'warn about the devices but do not warn excessively
                'perhaps change a device value? 

                'if I get the reference from the global variable and trigger the event if the reference has changed then this should be good enough to warn of the last device?

                If hs.GetVar("BM-LastBatteryReference") <> DeviceReference Then

                    hs.writelog("BatteryMonitor", "Timer Elapsed - New Reference: " & DeviceReference)

                    Dim dv As Scheduler.Classes.DeviceClass
                    dv = hs.GetDeviceByRef(DeviceReference)

                    hs.saveVar("BM-LastBatteryReference", DeviceReference)
                    hs.saveVar("BM-LastBatteryName", dv.Location(Nothing) & " " & dv.Name(Nothing))
                    hs.triggerevent("Warn About Battery Status")

                End If

            End If


    Catch ex As Exception : hs.writelog("BatteryMonitor", "Exception: " & ex.message.tostring)
    End Try

End Sub

Sub CreateGVar(ByVal Parms As Object)

        hs.writelog("BatteryMonitor", "Creating Global Variables")
        hs.saveVar("BM-LastBatteryReference", 0)
        hs.saveVar("BM-LastBatteryName", "Awaiting Data")
    Catch ex As Exception : hs.writelog("BatteryMonitor", "Exception Creating Global Variables")
    End Try

End Sub
Reply With Quote


battery level, error

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Polling battery devices mikedr HomeSeer Z-Wave Plug-in 0 February 13th, 2015 04:05 PM
Plugin notification for deleted devices stipus HS3 Plug-In Development 0 April 6th, 2014 03:51 PM
Fed-Up with Z-Wave battery devices sooty HomeSeer Z-Wave Plug-in 4 February 22nd, 2014 08:57 PM
Notification when devices have not changed in x days? robert1 HomeSeer General Discussion Area 4 June 16th, 2007 03:51 PM

All times are GMT -4. The time now is 12:39 AM.

Copyright HomeSeer Technologies, LLC