Announcement
Collapse
No announcement yet.
Using Timers in Scripts
Collapse
X
-
Originally posted by waynehead99 View Post
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
-
Originally posted by waynehead99 View PostI 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.
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
-
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
-
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
Comment