Announcement

Collapse
No announcement yet.

export device values to use in a VB.net project

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

    export device values to use in a VB.net project

    I like to use a few device values from homeseer in a vb.net project.
    is it posible to load this values in project for further use.?

    i already use values from another program using XML, is this posible with homeseer?
    can i create a xml containing the values i need and load it by calling an http:// XML.file

    #2
    You could write them to a csv file and then read them with your project. Is that an option?
    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
      Originally posted by harrympower View Post
      I like to use a few device values from homeseer in a vb.net project.
      is it posible to load this values in project for further use.?

      i already use values from another program using XML, is this posible with homeseer?
      can i create a xml containing the values i need and load it by calling an http:// XML.file
      In your project you could reference all of the HomeSeer DLL's and call the hs.devicevalue commands from your project (HSCF.dll, HomeSeerAPI.dll and Scheduler.dll) or you could instead pull the devices values from the JSON interface (JSON?request=getstatus). There is no in built XML call but there used to be a XML script on the forum somewhere you could search for - I think it was by someone with the word 'red' in their username if I remember right.

      Comment


        #4
        I write my power values to a text file via a simple vb.net script. I then use excel to import the data and create a spreadsheet. I know excel very well and I find this approach much easier than trying to create a custom application to process the data.

        Steve Q


        Sent from my iPad using Tapatalk
        HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
        2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

        Comment


          #5
          thanks for all the surgestion, how i could do it.
          first i give it a few try's with XML.

          the code i use in my project uses the System.XML.
          example:
          Code:
          imports system.xml
           Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
                  'declare our xmlwritersettings object
                  Dim settings As New XmlWriterSettings()
          
                  'XmlTextWriter writer = new XmlTextWriter(path , null)
                  'lets tell to our xmlwritersettings that it must use indention for our xml
                  settings.Indent = True
          
                  'lets create the MyXML.xml document, the first parameter was the Path/filename of xml file
                  ' the second parameter was our xml settings
                  Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\\MyXML.xml", Nothing)
          
                  With XmlWrt
          
                      ' Write the Xml declaration.
                      .WriteStartDocument()
          
                      ' Write a comment.
                      .WriteComment("XML Database.")
          
                      ' Write the root element.
                      .WriteStartElement("Data")
          
                      ' Start our first person.
                      .WriteStartElement("Person")
          
                      ' The person nodes.
          
                      .WriteStartElement("FirstName")
                      .WriteString("Alleo")
                      .WriteEndElement()
          
                      .WriteStartElement("LastName")
                      .WriteString("Indong")
                      .WriteEndElement()
          
                      ' The end of this person.
                      .WriteEndElement()
          
                      ' Close the XmlTextWriter.
                      .WriteEndDocument()
          
                      .Close()
                  End With
              End Sub
          when i try to run it in a script on homeseer, i get the error

          12-7-2017 16:46:03 Error Script compile error: Het type XmlWriterSettings is niet gedefinieerd.on line 17

          12-7-2017 16:46:03 SCR Option Strict Offimports system.xmlimports Schedulerimports SystemPublic Module scriptcode56#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(parms As Object) 'declare our xmlwritersettings object Dim settings As New XmlWriterSettings() 'XmlTextWriter writer = new XmlTextWriter(path , null) 'lets tell to our xmlwritersettings that it must use indention for our xml settings.Indent = True 'lets create the MyXML.xml document, the first parameter was the Path/filename of xml file ' the second parameter was our xml settings Dim XmlWrt As XmlWriter = XmlWriter.Create("E:\\MyXML.xml", Nothing) With XmlWrt ' Write the Xml declaration. .WriteStartDocument() ' Write a comment. .WriteComment("XML Database.") ' Write the root element. .WriteStartElement("Data") ' Start our first person. .WriteStartElement("Person") ' The person nodes. .WriteStartElement("FirstName") .WriteString("Alleo") .WriteEndElement() .WriteStartElement("LastName") .WriteString("Indong") .WriteEndElement() ' The end of this person. .WriteEndElement() ' Close the XmlTextWriter. .WriteEndDocument() .Close() End With End SubEnd SubEnd Module
          i have added the system.xml dll to the homesseer folder, in the hope i could use the xml writer, but i gese this is not the way it works

          any tips on this ?

          Comment


            #6
            Originally posted by mrhappy View Post
            In your project you could reference all of the HomeSeer DLL's and call the hs.devicevalue commands from your project (HSCF.dll, HomeSeerAPI.dll and Scheduler.dll) or you could instead pull the devices values from the JSON interface (JSON?request=getstatus). There is no in built XML call but there used to be a XML script on the forum somewhere you could search for - I think it was by someone with the word 'red' in their username if I remember right.
            I am currently trying to do the same thing as the OP and have been trying to find resources on how to reference the DLL's. Do you have any links I can look at to understand how to do this? I am a VB noob still and trying to learn VS as I go.

            Comment


              #7
              (HSCF.dll, HomeSeerAPI.dll and Scheduler.dll)
              where can i find these dll's, i only can find the Scheduler.
              i use homeseer 2 pro do they have other names in this older version ?

              Comment


                #8
                You may need to add something like this to settings.ini in the [settings] section:

                Code:
                ScriptingReferences=System.Xml;System.Xml.dll
                Since the dll file should be registered as part of the .Net installs, you don't need to specify a path to it and you do not need to copy it to the HS folders.

                If you have a ScriptingReferences line already, append this to that line:

                Code:
                ,System.Xml;System.Xml.dll
                Cheers
                Al
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment


                  #9
                  i have now a differend error.
                  after adding the scripting refference.

                  13-7-2017 0:48:41 Event Event Trigger "test xml"

                  13-7-2017 0:48:41 Event Running script in background: xmltest - kopie.vb

                  13-7-2017 0:48:41 Error Script compile error: Het oplossen van de overbelasting is mislukt omdat er geen toegankelijke Create kan worden aangeroepen met deze argumenten: 'Public Shared Function Create(output As System.Xml.XmlWriter, settings As System.Xml.XmlWriterSettings) As System.Xml.XmlWriter': De waarde van het type String kan niet worden geconverteerd naar System.Xml.XmlWriter. 'Public Shared Function Create(output As System.Text.StringBuilder, settings As System.Xml.XmlWriterSettings) As System.Xml.XmlWriter': De waarde van het type String kan niet worden geconverteerd naar System.Text.StringBuilder. 'Public Shared Function Create(output As System.IO.TextWriter, settings As System.Xml.XmlWriterSettings) As System.Xml.XmlWriter': De waarde van het type String kan niet worden geconverteerd naar System.IO.TextWriter. 'Public Shared Function Create(output As System.IO.Stream, settings As System.Xml.XmlWriterSettings) As System.Xml.XmlWriter': De waarde van het type String kan niet worden geconverteerd naar System.IO.Stream.on line 25

                  13-7-2017 0:48:41 SCR Option Strict Offimports system.xmlimports Schedulerimports SystemPublic Module scriptcode25#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(parms As Object) 'declare our xmlwritersettings object Dim settings As New XmlWriterSettings() 'XmlTextWriter writer = new XmlTextWriter(path , null) 'lets tell to our xmlwritersettings that it must use indention for our xml settings.Indent = True 'lets create the MyXML.xml document, the first parameter was the Path/filename of xml file ' the second parameter was our xml settings Dim XmlWrt As XmlWriter = XmlWriter.Create("E:\\MyXML.xml", Nothing) With XmlWrt ' Write the Xml declaration. .WriteStartDocument() ' Write a comment. .WriteComment("XML Database.") ' Write the root element. .WriteStartElement("Data") ' Start our first person. .WriteStartElement("Person") ' The person nodes. .WriteStartElement("FirstName") .WriteString("Alleo") .WriteEndElement() .WriteStartElement("LastName") .WriteString("Indong") .WriteEndElement() ' The end of this person. .WriteEndElement() ' Close the XmlTextWriter. .WriteEndDocument() .Close() End With End SubEnd SubEnd Module

                  Comment


                    #10
                    Originally posted by waynehead99 View Post
                    I am currently trying to do the same thing as the OP and have been trying to find resources on how to reference the DLL's. Do you have any links I can look at to understand how to do this? I am a VB noob still and trying to learn VS as I go.
                    Look here and I posted an example that runs an event from a .net application - https://forums.homeseer.com/showthread.php?t=165591

                    The source code is in the zip file.

                    Comment


                      #11
                      Originally posted by mrhappy View Post
                      Look here and I posted an example that runs an event from a .net application - https://forums.homeseer.com/showthread.php?t=165591

                      The source code is in the zip file.
                      I am still a Hs2Pro user what Dll 's do i need the Scheduler.dll i have found.
                      the HSCF.dll, HomeSeerAPI.dll i can not find on my system.
                      are these Hs3 dll's?

                      Comment


                        #12
                        Originally posted by harrympower View Post
                        I am still a Hs2Pro user what Dll 's do i need the Scheduler.dll i have found.
                        the HSCF.dll, HomeSeerAPI.dll i can not find on my system.
                        are these Hs3 dll's?
                        Yes, from memory you will need HomeSeerAPI.dll and Scheduler.dll. There is from memory an example in the HS2 help file how to create a reference in an external application, it is completely different to that example I posted.

                        Comment

                        Working...
                        X