No announcement yet.

Jon00 Uptime Log Write Combination

  • Filter
  • Time
  • Show
Clear All
new posts

    Jon00 Uptime Log Write Combination


    I was able to configure the Uptime Log (thank you for creating it) but I would like to write values to a file. I have the Zee S2 so my options are limited. I'm posting on here as I'm hoping you'll be able to provide the insight to extract the information I'm looking for.

    My goal is to write the daily total of a device's uptime. Preferably in minutes or hours.

    I came across this post which is a little script to write to a file.

    PHP Code:
    Sub Main(Parms as Object)

    Dim sw as System.IO.StreamWriter
    sw = New System.IO.StreamWriter("/usr/local/HomeSeer/Data/HVACTimers.txt",True)
    sw.WriteLine("EF HVAC" "," Now().ToString("MM-dd-yyyy") & "," hs.TimerValue(742))
    ex as Exception
    Not sw Is Nothingthen sw.Close()
    End Try

    End Sub 

    The Device looks like the following:

    Click image for larger version

Name:	Device.png
Views:	97
Size:	17.5 KB
ID:	1410392

    "East Furnace Runtime" is as follows:

    Click image for larger version

Name:	Device info.png
Views:	37
Size:	43.6 KB
ID:	1410393

    When I try with hs.TimerValue, I get:
    EF HVAC,08-11-2020,00:00:00

    When I tried with hs.DeviceValue(742), I got:
    EF HVAC,08-11-2020,315

    At some point, I got the following:
    EF HVAC,08-11-2020,<span style="white-space:nowrap; vertical-align:middle;"><span style="white-space:nowrap; display:-moz-inline-box; display:inline-block; vertical-align:middle; width:auto;"><img src="/images/Devices/jon00/uptime/on.png" border="0" ></span>
    <span style='white-space:nowrap; display:-moz-inline-box; display:inline-block; vertical-align:middle; padding:3px;'>0 days 5 hrs 15 mins 30 secs</span></span>

    I'm hoping it's something quick and easy.

    Thank you again for all of your efforts!
    Thom K.

    You must have done something wrong as hs.DeviceValue(742) cannot return as String. It has to be an integer.

    Try this:

    In Jon00UptimeHS3.ini, under [DeviceX] (where X is the number you are configuring), make sure that DeviceValueUnit=3

    That will set the device value to Total Minutes.

    I've modified the script slightly to show the device value in the HS Log:

    Sub Main(Parms As Object)
    Dim sw As System.IO.StreamWriter = Nothing
    hs.WriteLog("Value", hs.DeviceValueEx(742).ToString)
    sw = New System.IO.StreamWriter("/usr/local/HomeSeer/Data/HVACTimers.txt", True)
    sw.WriteLine("EF HVAC" & "," & Now().ToString("MM-dd-yyyy") & "," & hs.DeviceValueEx(742).ToString)
    Catch ex As Exception
    hs.writeLog("WriteHVACTimersToFile", ex.message)
    If (Not sw Is Nothing) Then sw.Close()
    End Try
    End Sub
    See if that works.


      Uhhh.. yeah... Of course that works!

      I was trying things with .ToString but I was ignorant of hs.DeviceValueEx and completely over my head on the other tweaks you did.

      Thank you again for helping me with this: My script-fu isn't strong.

      Have a great one!

      Thom K.