Announcement

Collapse
No announcement yet.

Script issue on 3.0.0.312

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script issue on 3.0.0.312

    I just switched from windows homeseer to linux on v3.0.0.312. I have a script that runs every 30 seconds but after a while it stops running claiming it's already running. I have 4 copies of this script with slight differences and they all show this behavior. Eventually they stop working. Any ideas? I tried to enable script debugging but nothing shows up in the Debug Logs folder.

    Code:
    2017-03-11 04:10:45	Warning	Not running script since its already running: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb Single instance option enabled in event properties
    2017-03-11 04:10:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:10:15	Warning	Not running script since its already running: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb Single instance option enabled in event properties
    2017-03-11 04:10:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:09:45	Warning	Not running script since its already running: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb Single instance option enabled in event properties
    2017-03-11 04:09:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:09:15	Warning	Not running script since its already running: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb Single instance option enabled in event properties
    2017-03-11 04:09:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:08:45	Warning	Not running script since its already running: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb Single instance option enabled in event properties
    2017-03-11 04:08:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:08:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:07:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:07:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:06:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:06:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:05:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:05:15	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")
    2017-03-11 04:04:45	Event	Running script in background: /home/chris/HomeSeer/scripts/SNMP_PDUx.vb("Main",​"null")

    #2
    Maybe post a copy of one of the scripts.


    Sent from my Phone using Tapatalk
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      It maybe because the script is taking longer to run on Linux and you have reached the limit of concurrent scripts running?
      Jon

      Comment


        #4
        I'm only running 4 scripts concurrently so I don't know why there'd be a limit. All I am doing is polling a SNMP device:

        Code:
        Imports System.Collections.Generic 
        Imports System.Net
        Imports System.IO
        Imports System.Collections
        Imports System.Core
        Imports System.Xml.Linq
        Imports System.Array
        
        
        Public Const LogColor As String = "#6600FF"
        Public Const ScriptName As String = "SNMP Script"
        Public Const AddressPrefix As String = "SNMP_"
        Public Const Logging As Integer = 0 '1=on 0=Off
        
        
        Dim Results As String
        Dim DevExists As Long
        
        
        Sub Main(ByVal Input As String)
        hs.DebugMode = 1
        
        Dim i As Integer = 0
        
        Dim itemList(20) as SNMPParms
        
        'Transfer Switch Power
        itemList(0).Description = "Transfer Switch Power"
        itemList(0).IP = "192.168.0.10"
        itemList(0).Community = "public"
        itemList(0).OID = ".1.3.6.1.4.1.3808.1.1.5.5.2.4.1.5.1"
        itemList(0).DeviceAddress = AddressPrefix & "ATS_Power"
        itemList(0).DeviceTypeString = "SNMP Device"
        itemList(0).FirstDeviceLocation = "Server Rack"
        itemList(0).SecondDeviceLocation = "Transfer Switch Status"
        itemList(0).RootDeviceAddress = "SNMP ATS"
        itemList(0).GraphicsPairFunction = "Panamax_Wattage"
        itemList(0).StatusOnlyFlag = TRUE
        
        'Transfer Switch Input A Voltage
        itemList(1).Description = "Transfer Switch Input A Voltage"
        itemList(1).IP = "192.168.0.10"
        itemList(1).Community = "public"
        itemList(1).OID = ".1.3.6.1.4.1.3808.1.1.5.2.2.2.1.5.1"
        itemList(1).DeviceAddress = AddressPrefix & "ATS_A_Voltage"
        itemList(1).DeviceTypeString = "SNMP Device"
        itemList(1).FirstDeviceLocation = "Server Rack"
        itemList(1).SecondDeviceLocation = "Transfer Switch Status"
        itemList(1).RootDeviceAddress = "SNMP ATS"
        itemList(1).GraphicsPairFunction = "Panamax_Voltage"
        itemList(1).StatusOnlyFlag = TRUE
        
        'Transfer Switch Input B Voltage
        itemList(2).Description = "Transfer Switch Input B Voltage"
        itemList(2).IP = "192.168.0.10"
        itemList(2).Community = "public"
        itemList(2).OID = ".1.3.6.1.4.1.3808.1.1.5.2.2.2.1.5.2"
        itemList(2).DeviceAddress = AddressPrefix & "ATS_B_Voltage"
        itemList(2).DeviceTypeString = "SNMP Device"
        itemList(2).FirstDeviceLocation = "Server Rack"
        itemList(2).SecondDeviceLocation = "Transfer Switch Status"
        itemList(2).RootDeviceAddress = "SNMP ATS"
        itemList(2).GraphicsPairFunction = "Panamax_Voltage"
        itemList(2).StatusOnlyFlag = TRUE
        
        'Get SNMP Results
        
         For i = 0 To 2
        
        
        
        
        
         Results = SimpleSNMPGet(itemList(i).IP, itemList(i).Community, itemList(i).OID)
        'Correct Numeric - Divide by 10
        Results = (Val(Results)/10).ToString
        
        
        
        ' Confirm/Create Homeseer Devices
        		DevExists = hs.DeviceExistsAddress(itemList(i).DeviceAddress, FALSE)
        		If DevExists = -1 Then ' If it doesn't exist create it  
        			'Define Device Creation Array Variables
        			Dim InputParms(7) As String 
        			InputParms(0) = itemList(i).DeviceAddress
        			InputParms(3) = itemList(i).Description
        			InputParms(7) = itemList(i).GraphicsPairFunction
        			InputParms(1) = itemList(i).FirstDeviceLocation
        			InputParms(2) = itemList(i).SecondDeviceLocation
        			InputParms(4) = itemList(i).DeviceTypeString
        			InputParms(5) = itemList(i).RootDeviceAddress
        			If (itemList(i).StatusOnlyFlag) Then
        				InputParms(6) = "Y"
        			Else If (NOT itemList(i).StatusOnlyFlag) Then
        				InputParms(6) = "N"
        			End If
        			hs.RunScriptFunc("CreateDevices.vb","CreateDevice",InputParms,TRUE,FALSE)
        			DevExists = hs.DeviceExistsAddress(itemList(i).DeviceAddress,FALSE)
        		End If
        
        'Set Device Value
        
        			If hs.DeviceValueEx(DevExists) <> Results
        				hs.SetDeviceValueByRef(DevExists, Results, TRUE)
        				hs.SetDeviceLastChange(DevExists, Now())
        			End If
        	
        
        
        
        If Logging = 1 Then
        hs.WriteLogDetail(ScriptName, itemList(i).Description & " is " & Results, LogColor, 98, "SNMP Script", 0)
        End If
         Next
        
        	
        	
        End Sub
        
        
        Function SimpleSNMPGet(ByVal ip As String, ByVal community As String, ByVal oid As String) As String
                Dim snmp1 As String
                Dim snmp2 As String
                Dim receiver As New System.Net.IPEndPoint(System.Net.IPAddress.Parse(ip), 161)
                Dim snmp_response As Lextm.SharpSnmpLib.Variable
        		
                Try
                    Dim oidvar As New Lextm.SharpSnmpLib.Variable(Lextm.SharpSnmpLib.ObjectIdentifier.Convert(oid))
                    Dim varList As New System.Collections.Generic.List(Of Lextm.SharpSnmpLib.Variable)()
                    varList.Add(oidvar)
                    snmp_response = Lextm.SharpSnmpLib.Messaging.Messenger.Get(Lextm.SharpSnmpLib.VersionCode.V1, receiver, New Lextm.SharpSnmpLib.OctetString(community), varList, 10000)(0)
                    snmp1 = snmp_response.Id.ToString().Trim()
                    snmp2 = snmp_response.Data.ToString().Trim()
                    If snmp2 = "NoSuchInstance" Then
                        Return (Nothing)
                    Else
                        hs.TimerReset("Updates-SNMP-Transfer-Switch")
                        Return (snmp2)
                    End If            
                Catch e As Exception
                         hs.WriteLogDetail(ScriptName, "ERROR---SIMPLE-GET", LogColor, 98, ScriptName, 0)
                         hs.WriteLogDetail(ScriptName, "Source: " & e.Source.ToString(), LogColor, 98, ScriptName, 0)
                         hs.WriteLogDetail(ScriptName, "Message: " & e.ToString(), LogColor, 98, ScriptName, 0)
        				 'hs.WriteLogDetail(ScriptName, "Message: " & e.Message.ToString(), LogColor, 98, ScriptName, 0)
                    Return (Nothing)
                End Try
        End Function
        
        
        
        
        Structure SNMPParms
                Dim Description As String
        	Dim IP As String
        	Dim Community As String
        	Dim OID As String
        	Dim ResultType As String
        	Dim Divider As Integer
        	Dim DeviceAddress As String
        	Dim DeviceTypeString  As String
        	Dim FirstDeviceLocation  As String
        	Dim SecondDeviceLocation  As String
        	Dim RootDeviceAddress  As String
        	Dim StatusOnlyFlag As Boolean
        	Dim GraphicsPairFunction  As String
        End Structure

        Comment


          #5
          You have the event set up to only allow a single instance of the script. You can change that in the event, but there's some risk to that if for some reason it gets triggered often. As Jon said, the scripts could be taking longer to execute on linux. How often are you triggering each script? You can see all the scripts that are running by going to Tools - Control Panel and paste this into the Immediate Script command field:

          Code:
          &nhs.writelog("Scripts",hs.ScriptsRunning)
          Then check the HS log to see what is running. Perhaps the scripts are not terminating properly. Trigger the script once, and then use the above command to check how long it takes for it to finish.

          Cheers
          Al
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Thanks guys. This is helpful. I'll update once the problem is solved.

            Comment

            Working...
            X