Announcement

Collapse
No announcement yet.

Enhanced Maximum Uptime Script

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

  • Wadenut
    replied
    Posted v2.13.1
    Very pleased with this.

    Leave a comment:


  • Wadenut
    replied
    V2.6 is posted.
    It will fix problems with the Current Uptime device status.
    This version adds optional color to the selected device strings.

    If desired, simply copy the new Script into the \Scripts directory.
    The additional keys in the INI file can be added manually, while Homeseer continues to run. In this case existing data will be retained, but the colors may not take effect in all devices until the associated data is updated.
    In addition, if this method is used, depending on the previous version of the script (other than 2.5 or 2.5.1), the results may be unpredictable as several configuration settings may have changed from previous versions.

    For a fresh installation:
    - Disable the Maximum Uptime event.
    - Delete the existing Maximum Uptime devices.
    - Extract all files from the archive into the proper Homeseer folders.
    - READ the new documentation and configure the INI as desired.
    - Restart Homeseer & re-enable the event.

    I've left v2.5.1 in place for the time being in case problems with 2.6 are discovered.

    Leave a comment:


  • Pete
    replied
    Updated both scripts in vivo with HS running.

    I left the old INI files in place. That is what you meant by:

    so long as the file isn't deleted.
    I am guessing I should be OK now?

    Here are my current HS Pro variables. (in vivo)

    0 Days 0 Hours 16 Minutes 56 Seconds Virtual - Performance Current Up Time Y40 Status Only Today 9:38:41 AM
    0 Days 0 Hours 16 Minutes 1 Second Virtual - Performance Previous Up Time Y41 Status Only Today 9:08:05 AM
    4 Days 15 Hours 30 Minutes 29 Seconds Virtual - Performance Maximum Overall Up Time Y42 Status Only 8/31/2012 9:09:38 PM
    4 Days 15 Hours 30 Minutes 29 Seconds Virtual - Performance Maximum No Fault Up Time Y43 Status Only 8/31/2012 9:09:38 PM
    4 Days 15 Hours 30 Minutes 29 Seconds Virtual - Performance Maximum Faulted Up Time Y44 Status Only 8/31/2012 9:09:38 PM
    0 Days 17 Hours 0 Minutes 27 Seconds
    and my current HSPro INI file:

    [Configuration]
    CurrentDC = Y40
    PreviousDC = Y41
    MaxOverallDC = Y42
    MaxNoFaultDC = Y43
    MaxFaultDC = Y44
    MeanTimeDC = Y45
    EnableHSLog = False
    EnableHistLog = True
    RunsToAverage = 5
    MinSaveTime = 180
    EnableTime = 5
    RunningMean = True

    [Data]
    HSVersion=2.5.0.60
    CurrentTime=10/6/2012 9:38:41 AM
    Faulted =True
    Current=0 Days 0 Hours 16 Minutes 56 Seconds
    MaxOverall=4 Days 15 Hours 30 Minutes 29 Seconds
    MaxNoFault=4 Days 15 Hours 30 Minutes 29 Seconds
    MaxFAULT =4 Days 15 Hours 30 Minutes 29 Seconds
    MeanUpTime =0 Days 17 Hours 22 Minutes 16 Seconds
    NumRuns =47
    Wow; just called the landscaper to cut the grass early today about 20 minutes ago and he is already cutting the grass. I have to clear the sprinkler lines today. Fast service.

    Leave a comment:


  • Wadenut
    replied
    Maximum No Fault Time was being updated dynamically whan the current uptime exceeded it. I realized that in the cse of HS being shut down unexpectedly, this could cause the Max No Fault Time to be equal to the Maximum Faulted Time. The No Fault Time is now updated only on restart and only when necessary.

    Leave a comment:


  • Wadenut
    replied
    The new version, posted today should deal with such instances, so long as the file isn't deleted.

    Leave a comment:


  • Pete
    replied
    The error above on Box #2 was related to me deleting the base variables in the INI file. Not sure when I did this though. I put them back in there and all is well with box #2.

    Leave a comment:


  • Pete
    replied
    Greg,

    Getting a wierd VB script error on box #2. Not sure why. I started it from scratch a couple of times. Right now I have it disabled.

    9/10/2012 5:16:06 AM Error Scripting runtime error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --- System.InvalidCastException: Conversion from string "" to type 'Double' is not valid. --- System.FormatException: Input string was not in a correct format. at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDoub le(String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble( String Value, NumberFormatInfo NumberFormat) --- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble( String Value, NumberFormatInfo NumberFormat) at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble( String Value) at scriptcode4.scriptcode4.MakeString(String[] Parts) at scriptcode4.scriptcode4.Main(Object Parm) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.VsaScriptHost.Invoke(String ModuleName, String MethodName, Object[] Arguments)
    Current INI file shows:

    [Configuration]
    CurrentDC = Y40
    PreviousDC = Y41
    MaxOverallDC = Y42
    MaxNoFaultDC = Y43
    MaxFaultDC = Y44
    MeanTimeDC = Y45
    EnableHSLog = False
    EnableHistLog = True
    MeanRunsUsed = 0
    MinRunTime = 300
    HSVersion=2.5.0.58

    [Shutdown]
    Intentional =True

    [Times]
    Current =1 Day 4 Hours 39 Minutes 57 Seconds
    MaxOverall =
    MaxNoFault =
    MaxFAULT =
    NumRuns =0
    MeanUpTime =

    Leave a comment:


  • Wadenut
    replied
    Sure. You'll have your device updating every 15 mins, that's all.
    I've played with this. Early on when trying to find the cause of HS going south, I'd reduced the frequency of many events drasticly to try to recuce the load. On this one, I'm back from 10 mins to 15 secs. It hasn't had any effect one way or the other. Sometimes, I add code to long scripts to measure the execution time [hs.writelog("test,now) to beggining and end]. This one, despite it's size, is still under 1 second on the Atom.

    Leave a comment:


  • Pete
    replied
    Greg,

    In the beginning of the script you mention running the script periodically:

    You also need an event to run the script periodically with no parameters to update the devices (ie every 15 seconds)
    I am running it every 15 minutes. Is this OK?

    Leave a comment:


  • Wadenut
    replied
    Updated to 2.1

    When I looked closely at the script, I noticed several improvements that could be made.

    Some of the changes made:
    - Simplified making Devices optional by using the empty string to exclude them.
    - Moved the configuration to the INI configuration file.
    - Fixed "current version" in History log file. This would show the previous Homeseer version. If an upgrade was done, the version would have shown the previous version on startup. Now records the version associated with the previous run correctly.
    - Selected Devices and the History log are automatically created on first run if selected and they don't already exist.
    - Replaced a sixteen step Case statement with four short If/Then statements.
    - Consolidated and cleaned up several subroutines.
    - Cleaned up extraneous code.

    The result is a smaller file and quicker execution.

    If you've been using a previous version: Populate the devices and options in the new Uptime.ini file, copy your uptime data to the new file (optional) and replace the existing file. You should be good to go.

    The complete documentation can still be found at the beginning of the script.
    Last edited by Wadenut; January 9, 2013, 11:50 AM.

    Leave a comment:


  • Wadenut
    started a topic Enhanced Maximum Uptime Script

    Enhanced Maximum Uptime Script

    V2.x is a complete re-write of the original script and is one third the size of the original.
    Functions, options, etc. are described in the included documentation.


    Discussion here please:
    http://board.homeseer.com/showthread...845#post991845

    NOTE: v2.5.1 is functionally identical to v2.5 but will work with earlier versions of Homeseer which did not support the hs.Transmitfunction.
    Future versions will use hs.ExecX10until this function is fully removed from current versions of Homeseer.

    v2.6
    Incorporates the ExecX10 modification from 2.5.1
    Fixes a problem with the Device Status of the Current UpTime device.
    Adds optional color to the device strings of all configured devices. Description in the included documentation.

    v2.7
    There is a Homeseer option to store logs in the HS root directory. This version takes that into account.

    2.8
    Fixed a bug where the main routine might run via the event before HS has completed running the Startup.txt script, resulting in corruption of the existing data.
    Added optional device for MTBF (Mean Time Between Failure). This is the average of faulted run times and is separate from the Average RunTime Device.
    This script can be copied to the \Scripts directory without restarting HS if you are currently running v2.6 or later.
    If you want to use the MTBF device simply add the key MTBFDC to the configuration section of the INI (description is in the documentation). The device will be created on the next restart.

    2.9
    Added some protection against the data section of the configuration being edited incorrectly.

    HS3 Version HS3 v1.1
    Conversion to HS3
    Dec 01/2014 There was an error in the documentation. Corrected.

    2.91 HS2 & HS3
    Minor changes to the script.
    In HS3, if using the Uptime History log, a date wasn't being updated.
    Synchronized version numbers for both HS2 & HS3
    Removed the data from the CurrentTime field in the config file. This might have caused problems on initial run of the script after a fresh install on some systems. My bad.
    Converted the Doc file to PDF.

    2.92 HS2 & HS3 2014-12-13
    Added optional device graphics.
    Run event is now automatically created, alleviating some of the installation confusion. See the Read Before Running text in the ZIP root.
    HS3 Devices are now associated with one another, providing grouping on the Device Management page.

    2.12.2
    Device and Event creation are optional. See the PDF documentation.

    2.12.5
    Added an option to display times in devices in short form. D HH:MM:SS
    To upgrade:
    - Replace the VBEN file in the scripts folder.
    - Add parameter ShortTime to Configuration, and set to True to use the short form, or False to use the original Long form.

    2.13.1
    See Discussion thread.

    No other changes.
    Times will be converted when the individual devices are updated. Instructions in the Doc if immediate conversion is preferred.
    Attached Files
    Last edited by Wadenut; December 16, 2019, 03:49 PM.
Working...
X