Announcement

Collapse
No announcement yet.

HS3 has humbled me again this time hs.timervalue

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

    HS3 has humbled me again this time hs.timervalue

    In an ASP page I add this instruction hs.timervalue("HVAC Cool Runtime") and I wrap around html like this:

    Code:
    <td class="RegRowCntr"><%=hs.timervalue("HVAC Cool Runtime")%></td>
    The timer name exists and when the page loads it vomits up this helpful message:

    "Script error: Type mismatch: 'Cstr'

    response.write Cstr( hs.timervalue("HVAC Cool Runtime"))

    Adding Cstr to the instruction does NOT change the result so I wonder what I’m doing wrong now…"
    Last edited by rmorton27; June 14, 2017, 01:47 PM.
    -Rick

    #2
    I suspect you are getting the error because hs.TimerValue returns a time span and your statement is expecting a string input. (CStr is the function that converts other data types to the string data type.)
    Does adding the CStr function give you what you want?
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      To piggy back on what Mike stated, see if any of this helps you. These you can convert to string.

      Code:
      Sub Main(ByVal Parm As Object)
      
          Dim ts As TimeSpan = hs.TimerValue("Kitchen Ceiling Lights")
      
          hs.writelog("tSpan", "Total Hours: " & ts.TotalHours)
          hs.writelog("tSpan", "Total Minutes: " & ts.TotalMinutes)
          hs.writelog("tSpan", "Total Seconds: " & ts.TotalSeconds)
          hs.writelog("tSpan", "Days: " & ts.Days)
          hs.writelog("tSpan", "Hours: " & ts.Hours)
          hs.writelog("tSpan", "Minutes: " & ts.Minutes)
          hs.writelog("tSpan", "Seconds: " & ts.Seconds)
      End Sub

      Comment


        #4
        Code:
        Sub Main(ByVal Parm As Object)
        
            Dim ts As TimeSpan = hs.TimerValue("Kitchen Ceiling Lights")
        
            hs.writelog("tSpan", "Total Hours: " & ts.TotalHours)
            hs.writelog("tSpan", "Total Minutes: " & ts.TotalMinutes)
            hs.writelog("tSpan", "Total Seconds: " & ts.TotalSeconds)
            hs.writelog("tSpan", "Days: " & ts.Days)
            hs.writelog("tSpan", "Hours: " & ts.Hours)
            hs.writelog("tSpan", "Minutes: " & ts.Minutes)
            hs.writelog("tSpan", "Seconds: " & ts.Seconds)
        End Sub

        This looks like VB.net and is beyond me. This makes me wonder can hs.timervalue be only supportable with VB.net?

        -r
        -Rick

        Comment


          #5
          Instead of using the timer itself, you could try using the device string of the associated HS device. You will need to enable the device creation in Setup if you haven't already.
          Attached Files
          Mike____________________________________________________________ __________________
          HS3 Pro Edition 3.0.0.548, NUC i3

          HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

          Comment


            #6
            Cool, didn't see the devices when I first went looking... Thanks!
            -Rick

            Comment

            Working...
            X