script runs as .vb but no population of q3 or q4.
no log error from script
/8/2006 8:50:17 AM Info Event Trigger "System Uptime"
3/8/2006 8:50:17 AM Info Running script in background: HomeSeerUpTime.vb
script;
'
' define q3 and q4 as status type
'
' Option Explicit
Const bDEBUG As Boolean = False
Const strCurUpTimeHCUC As String = "q3"
Const strMaxUpTimeHCUC As String = "q4"
Function stripTime (str As String) As String
Dim strTemp As String
strTemp = str
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "stripTime Input: '" & strTemp & "'")
End If
strTemp = Replace(str, "Days ", "")
strTemp = Replace(strTemp, "Day ", "")
strTemp = Replace(strTemp, "Hours ", "")
strTemp = Replace(strTemp, "Hour ", "")
strTemp = Replace(strTemp, "Minutes ", "")
strTemp = Replace(strTemp, "Minute ", "")
strTemp = Replace(strTemp, "Seconds", "")
strTemp = Replace(strTemp, "Second", "")
strTemp = Trim(strTemp) & " "
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "stripTime Output: '" & strTemp & "'")
End If
Return strTemp
End Function
Function timeSecs(str As String) As Integer
Dim iDays As Integer
Dim iHours As Integer
Dim iMinutes As Integer
Dim iSeconds As Integer
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iDays = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
iHours = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iMinutes = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iSeconds = Cint(Mid(str, 1, Instr(str, " ")-1))
timeSecs = ((iDays * 24 + iHours) * 60 + iMinutes) * 60 + iSeconds
End Function
Sub main (strArg As String)
Dim strUpTime As String
Dim iUpTimeSecs As Integer
Dim iMaxUpTimeSecs As Integer
Dim strMaxUpTime As String
strUpTime = hs.SystemUpTime()
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:main", "strUpTime: '" & strUpTime & "'")
End If
iUpTimeSecs = timeSecs(stripTime(strUpTime))
Call hs.SetDeviceString (strCurUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strCurUpTimeHCUC, Now)
strMaxUpTime = hs.DeviceString (strMaxUpTimeHCUC)
If Not Instr(Trim(Ucase(strMaxUpTime)), "UNKNOWN") And _
strMaxUpTime <> "" Then
iMaxUpTimeSecs = timeSecs(stripTime(strMaxUpTime))
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "MaxUpTime: '" & iMaxUpTimeSecs.ToString & "'")
Call hs.WriteLog("HomeSeerUpTime", "UpTime: '" & iUpTimeSecs.ToString & "'")
End If
If iUpTimeSecs > iMaxUpTimeSecs Then
Call hs.SetDeviceString (strMaxUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strMaxUpTimeHCUC, Now)
End If
Else
Call hs.SetDeviceString (strMaxUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strMaxUpTimeHCUC, Now)
End If
End Sub
no log error from script
/8/2006 8:50:17 AM Info Event Trigger "System Uptime"
3/8/2006 8:50:17 AM Info Running script in background: HomeSeerUpTime.vb
script;
'
' define q3 and q4 as status type
'
' Option Explicit
Const bDEBUG As Boolean = False
Const strCurUpTimeHCUC As String = "q3"
Const strMaxUpTimeHCUC As String = "q4"
Function stripTime (str As String) As String
Dim strTemp As String
strTemp = str
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "stripTime Input: '" & strTemp & "'")
End If
strTemp = Replace(str, "Days ", "")
strTemp = Replace(strTemp, "Day ", "")
strTemp = Replace(strTemp, "Hours ", "")
strTemp = Replace(strTemp, "Hour ", "")
strTemp = Replace(strTemp, "Minutes ", "")
strTemp = Replace(strTemp, "Minute ", "")
strTemp = Replace(strTemp, "Seconds", "")
strTemp = Replace(strTemp, "Second", "")
strTemp = Trim(strTemp) & " "
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "stripTime Output: '" & strTemp & "'")
End If
Return strTemp
End Function
Function timeSecs(str As String) As Integer
Dim iDays As Integer
Dim iHours As Integer
Dim iMinutes As Integer
Dim iSeconds As Integer
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iDays = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
iHours = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iMinutes = Cint(Mid(str, 1, Instr(str, " ")-1))
str = Mid(str, Instr(str, " ")+1)
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:timeSecs", "str: '" & str & "'")
End If
iSeconds = Cint(Mid(str, 1, Instr(str, " ")-1))
timeSecs = ((iDays * 24 + iHours) * 60 + iMinutes) * 60 + iSeconds
End Function
Sub main (strArg As String)
Dim strUpTime As String
Dim iUpTimeSecs As Integer
Dim iMaxUpTimeSecs As Integer
Dim strMaxUpTime As String
strUpTime = hs.SystemUpTime()
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime:main", "strUpTime: '" & strUpTime & "'")
End If
iUpTimeSecs = timeSecs(stripTime(strUpTime))
Call hs.SetDeviceString (strCurUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strCurUpTimeHCUC, Now)
strMaxUpTime = hs.DeviceString (strMaxUpTimeHCUC)
If Not Instr(Trim(Ucase(strMaxUpTime)), "UNKNOWN") And _
strMaxUpTime <> "" Then
iMaxUpTimeSecs = timeSecs(stripTime(strMaxUpTime))
If bDEBUG Then
Call hs.WriteLog("HomeSeerUpTime", "MaxUpTime: '" & iMaxUpTimeSecs.ToString & "'")
Call hs.WriteLog("HomeSeerUpTime", "UpTime: '" & iUpTimeSecs.ToString & "'")
End If
If iUpTimeSecs > iMaxUpTimeSecs Then
Call hs.SetDeviceString (strMaxUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strMaxUpTimeHCUC, Now)
End If
Else
Call hs.SetDeviceString (strMaxUpTimeHCUC, strUpTime)
Call hs.SetDeviceLastChange (strMaxUpTimeHCUC, Now)
End If
End Sub
Comment