Announcement

Collapse
No announcement yet.

Data from comm port

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

    Data from comm port

    Can vbscript extract data from a comm port.

    I have a device that produces data in an ascii format but I need to access it via the comm port.

    Any help would be appreciated.

    Thanks


    Greg

    #2
    Look in Homeseer help for hs.OpenCommPort. There are related functions that allow reading and writing to the port.

    Comment


      #3
      more info

      Hi

      Thanks for the point in the right direction. I looked at the help file but it is pretty sparce. I could use a code example to get me going.

      That is one of my big qualms about the help files in HS. If you know what you are doing they are fine but for a newbie they are a little lacking.

      Thanks

      Comment


        #4
        Add this to the startup.txt script (in the Homeseer/scripts folder):


        '*****Set Com port *****
        e=hs.OpenComPort(2,"9600,n,8,1",1,"Mydata.txt","main")
        if e<> "" then
        hs.writelog "Error opening COM2",e
        else
        hs.writelog "COM2", "Com port setup complete"
        end if

        Change the com port number (in red) to the one you are using.

        Next, save this script as Mydata.txt and place it in the Homeseer/scripts library:

        Sub main(Getdata)
        hs.writelog "Comport data",Getdata
        end sub

        Reboot Homeseer.

        Each time data is sent to the com port, you should now see it written in the Homeseer log.
        Jon

        Comment


          #5
          Thanks

          That is exactly the help I needed. I now have my script running the way I wanted.

          Thanks very much

          Greg

          Comment

          Working...
          X