Every once in a while, I've disabled a plugin for troubleshooting or upgrade purposes and have forgotten to turn it back on. A few hours/days/etc. later, I may notice that something is not happening that should have and then realize that I've done so. Since I'm getting older and more forgetful, I'm guessing this will happen more and more over time
, so I created a script that I run on a regular schedule that compares what I've defined as should be running to what is actually running and if there's a plugin that is not active, it will send me a Pushover alert. If you don't use Pushover, you should
, but you could replace that portion of the script with another notification method. Hope this helps others in the over 50 crowd
. To set it up for your plugins, just edit the line Dim RequiredPlugins() As String to list the plugins that you use. Note that the name must be exactly as it appears in the PLUG-INS - MANAGE HS page, followed by a colon. Add as many as you have. Also, if you use Pushover, edit the line CO(0) to define the Pushover devices you want to send the message to, and the subsequent lines can be customized as well for the sound you want, etc.



Code:
Sub Main(ByVal Parms As String) Dim RequiredPlugins() As String = {"Plugin1:","Plugin2:","Z-Wave:"} Dim Debug As Boolean = False Dim logName As String = "Plugin Check" Dim NonRunningPlugins As String Try Dim RunningPlugins As Object = hs.GetPluginsList If RunningPlugins IsNot Nothing AndAlso RunningPlugins.Length > 0 Then ' loop thru required list For index As Integer = 0 To RequiredPlugins.Length - 1 ' search running list for this required For Each RunningPlugin As String In RunningPlugins If RequiredPlugins(index) = RunningPlugin Then ' this plugin is running, so no longer required! RequiredPlugins(index) = Nothing Exit For End If Next Next ' format & pretty up the list NonRunningPlugins = String.Join("", RequiredPlugins).Replace(":", ", ").Trim() If NonRunningPlugins.Length > 0 Then NonRunningPlugins = Left(NonRunningPlugins,NonRunningPlugins.Length - 1) If Debug Then hs.WriteLog(logName,"***" & NonRunningPlugins & "***") If NonRunningPlugins > "" Then 'Do Something 'Send Pushover Message Dim CO(8) As Object CO(0) = "All Clients" 'must be matched with a device name already in the plugin or 'All Clients' CASE SENSITIVE CO(1) = NonRunningPlugins 'message body CO(2) = "Plugins Not Running" 'message subject CO(3) = "normal" 'low/normal/high/emergency CO(4) = "pushover" 'message sound from list: pushover,bike,bugle,cashregister,classical,cosmic,falling,gamelan,incoming,intermission,magic,mechanical,pianobar,siren,spacealarm,tugboat,alien,climb,persistent,echo,updown,none CO(5) = Nothing CO(6) = Nothing CO(7) = Nothing CO(8) = Nothing hs.PluginFunction("Pushover 3P", "", "Pushscript", CO) Else 'All Good If Debug Then hs.WriteLog(logName,"All required plugins are running") End If Else hs.WriteLog(logName,"Nothing to see here. Move along.") End If Catch ex As Exception hs.WriteLogEx(logname, "Exception " & ex.ToString, "#ff0000") End Try End Sub
Comment