Announcement

Collapse
No announcement yet.

Writing variables to a file?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Writing variables to a file?

    I vaguely recall that someone had some code, either in Starglish or VBScript, that would write HVAC runtime data to an Excel or text file.

    I have the daily runtime in a variable. How do I do write this to a file?

    Mark
    Mark

    #2
    Mark,
    I'm not aware of the script, but I'm sure something like it exists. On the other hand, creating a script to write data to a file is not terribly involved.

    What do you want to do? Are you adding a small amount of data periodically to an existing file, or are you creating a new file frequently?
    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
      I want to add to a file so I have a running record of daily runtimes for heat and cooling. Just something I can review from time to time to look for energy reduction opportunities.

      Mark
      Mark

      Comment


        #4
        Hi,
        this script adds the date time and alarm-disarmed line to
        the file datalog.txt when my alarm is shut off.
        Stuart

        sub main()
        set fso = CreateObject("Scripting.FileSystemObject")
        set f1 = fso.OpenTextFile("D:\program files\homeseer 2\datalog.txt",8,true)
        f1.writeline date & " "& time & " Alarm-disArmed"
        f1.close
        end sub

        Comment


          #5
          Thanks Stuart. That works great.

          That script will probably do me fine. But is there a version to write to an Excel file? Just in case I get nerdy and want to graph it.

          Mark
          Mark

          Comment


            #6
            I generally create comma delimited log files, and they import into Excel great. Just open them in excel, select comma delimited, and the rest is usually automatic.

            Dim fso,file 'for HVAC log routine
            dim HVACinfo 'string to write to file for HVAC log

            Const OpenFileForReading = 1 'for HVAC log routine
            Const OpenFileForWriting = 2 'for HVAC log routine
            Const OpenFileForAppending = 8 'for HVAC log routine
            Const HVAClogpath = "c:\Program Files\Homeseer 2\HVACLOG.log" 'for HVAC log routine

            HVACinfo = date & "," &_
            time & "," &_
            hs.GetVar("Global_Indoor_Temp") & "," &_
            UpstairsTemp & "," &_
            hs.DeviceValue("[1") & "," &_
            hs.DeviceValue("[72") & "," &_
            hs.DeviceValue("[73") & "," &_
            hs.DeviceValue("[71") & "," &_
            hs.DeviceValue("[82") & "%"
            Set fso = CreateObject("Scripting.FileSystemObject")
            Set file = fso.OpenTextFile(HVAClogpath, OpenFileForAppending,True)
            file.WriteLine(HVACinfo)
            file.Close

            Comment


              #7
              Thanks, Tim. The Excel conversion works very well.

              Out of curiosity, is there any reason for using a .log extension vs. a .txt?

              Mark
              Mark

              Comment


                #8
                no reason. i have other things that generate .log files so i just named it that without thinking.

                tim

                Comment

                Working...
                X