Announcement

Collapse
No announcement yet.

Using Timers in Scripts

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

    Using Timers in Scripts

    http://www.homeseer.com/support/home...elp/timers.htm

    Any ideas?

    #2
    Originally posted by waynehead99 View Post
    If I was you I would just use the timer devices that Homeseer creates for you. That way the value of the device is the time in seconds so I am sure you could work it from there.

    Greig.
    Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
    Scripts =
    Various

    Comment


      #3
      I thought about that, but I try not to create timer device just because of the crazy amount of traffic they use with hstouch. I will try that and see how it works, but I still think I need to figure out a way to convert the time into decimal.

      Comment


        #4
        Originally posted by waynehead99 View Post
        I thought about that, but I try not to create timer device just because of the crazy amount of traffic they use with hstouch. I will try that and see how it works, but I still think I need to figure out a way to convert the time into decimal.
        But you do not have to create the device as Homeseer will do it for every timer you create and this device is handled in HSTouch so no need to worry. In your device manager page filter the device Type down to "Timers" and you will see what I mean or you are running a very old version of HS.

        Greig.
        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
        Scripts =
        Various

        Comment


          #5
          Yea I leave that box unchecked. If you look at the communication between the server and the touch clients, you will see an update going every second for every timer, even if you aren't using them in the client.

          I don't have the crash issues with hstouch that others do, and I suspect this is part of the problem.

          I can let it create this timer and uncheck it and delete the timer devices I don't want to use.

          Comment


            #6
            Ok, think I have this figured out. Didn't need to use a timer in a device, so I am happy with that.

            Here are the results in the logs for testing:

            Mar-27 9:10:00 PM Energy Timer Total kWh Hours: 0.04403333333333334

            Mar-27 9:10:00 PM Energy Timer Total Hours: 0.733888888888889


            Here is the script I mocked up and will build off of. I saw somewhere that you can use timespan in the script and this gave me what I needed... also had to change variables to "decimal" vs "integer" to get the entire value.

            Thanks to @mrhappy in this thread:

            http://board.homeseer.com/showthread.php?t=172579

            Code:
            Sub Main(ByVal Parm As Object)
            
            dim Lights as integer = hs.DeviceValue(33)
            dim kWh as decimal '= hs.DeviceValue(837)
            dim Watts as integer = hs.DeviceValue(836)
            Dim ts As TimeSpan = hs.TimerValue("Kitchen Ceiling Lights")
            Dim Total_Time as decimal
            
            Total_Time = ts.TotalHours
            
            kWh = (Total_Time*60)/1000
            
            hs.writelog("Energy Timer", "Total Hours: " & ts.TotalHours)
            hs.writelog("Energy Timer", "Total kWh Hours: " & kWh)
            
            End Sub

            Comment

            Working...
            X