Announcement

Collapse
No announcement yet.

Simple logging script

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

    Simple logging script

    I used this simple script in HSPRO to log a well pump. I have since moved on to HS3 and this script no longer works.

    Any thoughts about how to make this work in HS3?

    Thanks in advance!



    sub main(sensor)

    dim fso

    Const OpenFileForReading = 1
    Const OpenFielForWriting = 2
    Const OpenFileForAppending = 8

    Path = "C:\Program Files\HomeSeer HSPRO\Logs1\wellpump1.log"

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set file = fso.OpenTextFile(path, OpenFileForAppending, True)

    file.WriteLine ("Pump is OFF @ "& now &"")
    file.Close

    end sub

    #2
    Hi Chris,

    Do you get any errors in the log when you run it? I have a few scripts that use the same commands and they work fine. What type of HS3 system do you have? Are you running it as a vbscript file (.vbs or .txt) or vb.net (.vb)? If the latter, it would need to be converted to vb.net syntax. vbscript only works on HS3 on Windows.

    Cheers
    Al
    HS 3.0.0.548: 1990 Devices 1172 Events
    Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

    Comment


      #3
      Al,

      HS3 is running on windows 10 Pro.

      Script will not run as .txt or .vb.

      This is the error as .txt



      Jan-17 9:54:53 PM Error Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/WritepumpOffLog.txt0: in line 0 More info: Exception from HRESULT: 0x800A01C2 Jan-17 9:54:53 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/WritepumpOffLog.txt Jan-17 9:54:53 PM Event Event Trigger "Data Logging and Sending Notifications Log Well Pump" Jan-17 9:54:53 PM Event Event Data Logging and Sending Notifications Log Well Pump triggered by the event page 'Run' button.
      This is the error as a .vb

      Jan-17 9:58:45 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\WritepumpOffLog.vb: compiler initialization failed unexpectedly: The system cannot find the file specified. Jan-17 9:58:45 PM Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\WritepumpOffLog.vb: could not find library 'Scheduler.dll' Jan-17 9:58:45 PM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/WritepumpOffLog.vb

      Comment


        #4
        What is the sensor parameter used for in the "sub main" line? Are you passing a parameter to the script when you call it? I don't see it used in the script, so it should be changed to "sub main()" Another issue is that the Path variable is later used as "path". I don't think that vbscript is case sensitive, but they should have the same case.

        Cheers
        Al

        PS It will not run as .vb script without a bit of a rewrite.
        HS 3.0.0.548: 1990 Devices 1172 Events
        Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

        Comment


          #5
          Al,

          sub main () resolved the issue.

          Sometimes the simple things are overlooked.

          THANKS!!

          Comment


            #6
            Great, glad that fixed it.

            Cheers
            Al
            HS 3.0.0.548: 1990 Devices 1172 Events
            Z-Wave 3.0.1.262: 126 Nodes on one Z-Net

            Comment

            Working...
            X