No announcement yet.

Plugin to monitor Z-Wave battery device Health - CLOSED

  • Filter
  • Time
  • Show
Clear All
new posts

    Plugin to monitor Z-Wave battery device Health - CLOSED

    Edit - This thread is now closed refer to the sub-forum for new information

    Edit - Current version is attached to message #241 of this thread(page 13)

    If anybody is interested I've written a Health Plugin to monitor Z-Wave battery powered devices and report when they lose contact. It'll be free as it's primarily written for my own use, but if anyone thinks it might be useful then reply here and I will post the plugin.

    I find battery reporting pretty hit and miss for Z-Wave devices and the level at which they die is inconsistent. Up until now I had been using a log monitor plugin to check for wakeup calls but this required 2 events and a timer setting up for each device, with each configured for the particular wakeup period of that device. The purpose of the Health plugin is to automate the process and only require 1 event in total for all notifications whilst adapting automatically to any additions or changes to devices.

    When it first runs, the plugin creates a Parent device for monitoring. The plugin then monitors wake up calls in the log and each time a new device wakes up a child device is created and added to the group. The sleep period is set by subsequent wakeups of the device and from then on the plugin can watch for missed wakeups. There is no user intervention required although there are various parameters that can be tweaked.

    Any failed wakeups are reported to the parent device so all devices found can be monitored by a single event triggered by the Parent device. The Parent Device string shows the device that has failed so this can be reported in say an email or pushover message. I’ve replaced 11 timers and 22 events by a single event in my system.

    The attached screen shot shows part of my group with a failed device shown.

    Attached Files
    Last edited by SteveMSJ; September 30, 2017, 04:51 AM.

    Hi Steve,

    I'm very interested.

    Regards, Fischi


      Hi Steve,
      Nice idea. I'm interested too.


        Yes, this looks very nice. Please post plugin


          yep me to.

          Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
          X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
          Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
          Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
          Scripts =


            Ok. I'll post it in the morning.


              *UPDATE* 11/03/17
              More advanced beta version added at message #192 of this thread

              *UPDATE* 13/02/17
              Latest version (
              Bug Fix - Error message in log when more than one wakeup message within refresh interval.

              *UPDATE* 12/02/17
              Latest version ( attached to this message. Now can handle devices such as ZSmokes which don't send wakeup, can't be polled but send a Heartbeat. I say 'such as ZSmokes' but so far these are the only devices I have come across that send a Heartbeat so it may or may not work with similar devices. Thanks to TechFan for testing and feedback on this feature.

              Release notes for (since
              -Minor and major bug swatting.
              -Heartbeat monitoring added. Plugin now supports three methods of monitoring that a ZWave battery device is alive or dead>
              a) Monitoring wakeup messages - Automatic
              b) Polling of battery devices that don't send wakeups - Devices need to be selected from a list of Available Devices
              c) Monitoring Heartbeats - Automatic (if option set to True)
              -Location and/or Location2 can optionally be included in the displayed name of monitored devices to make them easier to identify, depending on your naming convention.
              -The Location and/or Location2 defaults can be set to blank in which case when a monitoring child is created it will adopt the locations of the device it is monitoring rather than a defined value. There are also buttons to rebuild the child devices so that ones that have already been created can be relocated.
              -The displayed information in the Health Root device can be configured by control buttons to Status Only, Short Report or Full Report. Anything other than Status Only may not fit in the web page display but work well when included in an email, notification message or HSTouch textbox.
              I have updated the instructions in this message below.
              I am now working on a more fully featured version of the plug-in which should add battery level, discharge rate and life monitoring as well as adding the ability to override settings for individual monitoring devices where required.

              *UPDATE* 13/01/17
              Update - Latest version ( now attached to this message, handles multiple networks and can monitor listening (non sleeping) battery devices by simulating wake-ups.
              *UPDATE* 02/01/17
              Multiple network version coming soon.
              *UPDATE* 31/12/16
              NOTE the current version only works with single networks. It won't work with multiple networks with duplicate node numbers at the moment.
              *UPDATED* 30/12/16
              OK. I’ve attached a zip file with the latest version

              **NOTE – This should be treated as a beta so backup your full HS3 installation before installing it. There shouldn’t be any damage it can do but it’s always wise to be safe.**

              Installation only requires ‘HSPI_SDJHealth.exe’ putting in the root folder of your HS3 installation. You should then be able to enable the plugin from the Plug-Ins>Manage page. No other files are required. It will create an INI file in the ‘Config’ folder but there is also a Config page in the plugin for tweaking parameters.
              To update, disable the plugin then replace the HSPI_SDJHealth.exe file with the new version and re-enable the plugin.

              IMPORTANT – It is also necessary to have ‘Log Poll and Wake-up Messages’ checked in ‘Plugins>Z-Wave>Z-Wave Network and Options’. I haven’t found anyway of detecting Z-Wave wakeups other than by monitoring the log.

              Shortly after enabling, the plugin will create a parent device called ‘Health Root’. This is the device to use as a trigger for any notification events you want to create.

              For ZWave battery powered devices that normally sleep, the plugin monitors the log and as wake-up notifications are reported child devices are created, grouped with the ‘Health Root’ parent. Initially the status of the device will show as ‘Waiting’. The second time a device wakes the sleep period will be set and the status will change to ‘Ok’. Over time a full set of child devices will be created corresponding to all Z-Wave devices in your system that report wake-ups. If you add devices to your system the plugin will pick them up the first time they wake. If you remove a device from your system the corresponding child will be removed on a restart of the plugin or you can delete the child manually.

              The sleep period is updated on every wakeup, so if you change the sleep settings for a device the plugin will adapt.

              At regular intervals the plugin checks the status of all the child devices and if any have missed a wakeup, by more than a set amount, the status of the child will change to ‘Wakeup Missed!’ The status of the parent ‘Health Root’ will also be set and the device that failed will be shown in the status string. The information that is displayed in the Root Device can be changed by the control buttons on the root device:
              Status Only - This just gives the number of devices monitored and how many are in each state.
              Short Report - Global Status plus a report on each device that is showing an alert.
              Full Report - Global Status plus a report on each monitored device.

              To report, trigger an event on the ‘Health Root’ device using ‘This device has a value set to..’ ‘Missed Wakeup’. If you include the replacement variable $$DTR:###: (change ### to the Ref of your ‘Health Root’ device) the full text string of the root device, formatted as Status Only, Short Report or Full Report can be included in an email or pushover notification. You can also display this information in an HSTouch scrolling textbox. Remember that you can swap between the different formats of report from event actions as well as manually.

              The plugin can also monitor battery devices that are 'Listening', i.e. don't sleep and don't therefore send wake-up notifications. These devices have to be manually selected but the plugin will then poll them at regular intervals and log a simulated wake-up notification if they are alive. They will then be monitored the same way as 'Non Listening' devices.

              The plugin can also monitor battery devices that don't send wakeups, aren't pollable but send Heartbeats, e.g. ZSmokes. Note this has only been tested on ZSmokes. You need to set MonitorHeartbeats to True to start this. The plugin will monitor device changes and if it detects an 'Alarm Heartbeat' it will create a monitoring child device. Device Callback are such that HS3 only notifies the plugin if a devices value changes, not if it is set to the same value. The ZSmokes don't reset the 'Alarm Heartbeat' value and therefore the plugin creates a new Status Pair (11.355,Heartbeat Acknowledged) as long as there is not already a status pair set for this value. Each time the plugin detects an 'Alarm Heartbeat' it sets the value to 'Heartbeat Acknowledged' so that it will get a callback when the ZSmoke sends the next 'Alarm heartbeat'.

              Parameters that can be set from the ‘Config’ page of the plugin:

              RefreshInterval – (default 120 seconds, i.e. 2 minutes) The interval in seconds that the plugin runs a check on the status of all the monitored devices. The plugin doesn’t have much overhead but there is little point in setting this very short.

              MissedWakeFactor - (default 0) If you want to allow 1 or more missed wakeups set this to 1 or more.

              OverRun – (default 60 minutes) The time in minutes beyond a scheduled wakeup before a ‘Missed Wakeup’ is triggered.
              If MissedWakeFactor>0 then the actual time allowed before a 'Missed Wakeup' is triggered is (The Last Sleep Period) x (MissedWakeupFactor+1) + Overrun.

              NameDeviceBy - Use the name of the 'Root' or 'Battery' child device when reporting on and naming monitoring devices.

              Location and Location2 – defaults used when the plugin creates new monitoring devices. Select blank for either of these values if you want the monitoring child to adopt the Location and or Location2 of the devices it is monitoring.

              There are buttons to Rebuild and Rename any child monitoring devices that have already been created.

              IncludeLocInNames - Ticking this will include the Location of the monitored device in the reports.
              IncludeLoc2InNames - Ticking this will include the Location2 of the monitored device in the reports.

              ShowDeviceAddress - Controls whether the device Technology Address is shown in addition to the name in the reports. Depending on your particular naming convention and use of floors, rooms, etc it may or may not be helpful to display the address as well. Originally this was On but now that you can incorporate Location and or Location2 in the name it isn't usually necessary.

              MinWakePeriod – (default 10 secs) It maybe a bug in HS3 but I sometimes get multiple wakeups reported in the log for a device,
              usually all on the same second. This ignores them otherwise the plugin will think the device has a very short SleepPeriod.

              LogLevel – (default 1) Setting to 0 will reduce log reporting to Errors only. Setting to 2 will produce a lot of log messages useful for debugging.

              ForceBackToRoot – (default False) I find that for some devices the root loses its ‘Parent’ status which is changed to ‘Standalone’ on reboots of HS3 (or restarts of the ZWave plugin). This may be an HS3 bug or a device firmware issue. I used to notice it on my StellaZ radiator valves but I have noticed it on one or two other devices as well. Normally the only effect is that the parent doesn’t show grouped with its children in the ‘Device Management’ page. This plugin monitors root devices even if they have incorrectly had their status set to 'Standalone' so there is no need to use this parameter. However, if you set ‘ForceBackToRoot’ to true then once a device is being monitored the Plugin will change its relationship status to ‘Parent_Root’ even if HS3 reboots and changes it back to ‘Standalone’. The benefit is that the Parent and Child devices will show correctly grouped in the 'Device Management' window. HOWEVER, I don't know whether there are any other implications with changing this status, so use at your own risk.

              Devices Require Polling - This section is used if you need/want to monitor battery devices that are always listening and don't therefore raise wake-up notifications. An example is my Everspring Siren and many locks. Click on the 'Select Devices' button and a selector widget opens with a list of devices on the left which can be added. This list is made up of all root devices which have a battery child that claims to be pollable. 'Non Listening' devices shouldn't appear in the list as they should report as non-pollable. You definitely don't want to add a 'Non Listening' device to be polled by the plug-in. There are many devices that can be battery powered or usb powered and these will be in the list even if they are running from usb power. You don't want to add these to 'selected devices', although you can if you like and they will be monitored. I can't determine whether they are running on batteries or not so they are all in the list. Move devices into the 'Selected Items' list that you want to monitor by polling, then press the 'Submit' button. The devices should then show in a list next to the 'Select Devices' button. This is all a bit clunky and I've struggled with some issues with the HS jQuery controls but it works of a fashion. One day I will revisit this and clean it all up.

              PollingInterval - This is affectively the simulated wake-up period. From my experience polling with Z-Wave takes a couple of seconds, if a device is awake, or up to 10 seconds if the device is dead. I don't know what the impact is on the system but it's best to keep polling fairly infrequent. If you have selected several devices their polling will be spread out over the polling interval so they aren't all polled at the same time. For example if the PolingInterval is 60 minutes and you have 4 devices selected each will be staggered by 15 minutes.

              When a device is successfully polled it is processed by the plugin in a similar way to a wakeup.

              NOTE A child monitoring device will not be created until the first successful poll so if you select 1 device and a PollingInterval of 60 minutes it will be 60 minutes before the device is polled and a monitoring child created. Be patient.

              MonitorHeartbeats - If you tick this then the plugin will register with HS3 for callbacks on device value changes. Firstly it checks through all ZWave devices for any that have a status of "Alarm Heartbeat". For any that are found the value is changed so that when the device sets a new 'Alarm Heartbeat' a devicevalue change is called. The Plugin then watches for devicevalue changes to 'Alarm Heartbeat' and these are processed in a similar way to a wakeup. A child monitoring device will not be created until after the first Heartbeat is received. On ZSmokes the value for Alarm heartbeat' is 11.255. After detecting as heartbeat the plugin sets the displayed value to 11.355 so it can detect the next Heartbeat. It uses this value rather than 0-'No Notifications' so that it doesn't intefear with any events you may have set up for your device which alert you when a real alarm event has ended. As long as there is no existing status pair for 11.355 then the plugin will set one up with a status of 'Heartbeat Acknowledged'.

              My system is windows 10 based but I briefly tested the plugin on linux and it appears to run with no problems.

              Feedback welcomed.

              Attached Files
              Last edited by SteveMSJ; March 11, 2017, 04:23 AM. Reason: Updated version


                Thanks Steve. I will work to get this installed today.


                  Would love to see other battery devices (non - Z-wave) added.
                  RJ_Make On YouTube


                    Just installed on Linux. Waiting for devices to report in but installation was simple. Thanks for sharing this. Very helpful.


                      Thanks for posting Steve! Have it running for a few hours and it's picked up about half my battery powered devices so far. Are there any issues with renaming the child devices the plugin has created?

                      HS 1990 Devices 1172 Events
                      Z-Wave 126 Nodes on one Z-Net


                        Originally posted by sparkman View Post
                        Thanks for posting Steve! Have it running for a few hours and it's picked up about half my battery powered devices so far. Are there any issues with renaming the child devices the plugin has created?

                        You can rename child devices as you like. The plugin keeps track based on the reference ID only.



                          Originally posted by ServiceXp View Post
                          Would love to see other battery devices (non - Z-wave) added.
                          That might be a possibility but it would depend on whether the devices issue some kind of regular signal/heart beat that a plugin could react to.



                            Steve do you have the status icons available?
                            The green heart or red exclamation point?


                              Cool plugin...thank you!

                              All my Insteon door sensors report.