Announcement

Collapse
No announcement yet.

Script error snap7.dll

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

    Script error snap7.dll

    Hello

    i want to send data from homeseer to a siemens PLC but get some errors when trying to create a script.

    I am trying to call a DLL but i get some error messages :


    aug-30 16:06:16 Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\TX_PLC.vb: Type 'Snap7.S7Client' is not defined.
    aug-30 16:06:16 Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\TX_PLC.vb: Namespace or type specified in the Imports 'Snap7' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
    aug-30 16:06:16 Error Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\TX_PLC.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    The DLL is referenced in the settings.ini :

    ScriptingReferences=DDay.iCal;DDay.iCal.dll,DDay.Collections ;DDay.Collections.dll,antlr.runtime;antlr.runtime.dll;snap7. net;Snap7.net.dll

    also the filles are copied in : C:\Program Files (x86)\HomeSeer HS3\

    But i got 2 filles : Snap7.dll and Snap7.net.dll

    i tried both of them, also i checked if i used the correct file x86 vs x64,

    according to http://snap7.sourceforge.net/
    VB

    Unluckily for you, you cannot use directly snap7.net.cs in your program because it’s a c# source class library.
    To be used, the wrapper must be compiled into a compiled class library, i.e. an “universal” .net library that can be loaded by any .net language.
    You need of : snap7.net.dll
    In spite of its extension, snap7.net.dll is not a windows DLL (like snap7.dll) but a class library. Thank Microsoft for the enlightening name
    So, in order to use the snap7 classes, you need to import snap7.net.dll referencing it into the project properties, otherwise the compiler does not know how to find them.

    so should i reference snap7.dll or snap7.net.dll ?


    some code i use :

    Imports Snap7

    Sub Main(ByVal Parms As Object)
    '==========================================================
    'Modify these to fit your system
    dim PLC_IP = "192.168.0.199"
    Dim UDTLength = 100
    '==========================================================
    Dim Buffer() As Byte ' Buffer
    Dim Client As Snap7.S7Client ' Client Object

    Thx. Doebe





    #2
    My guess is the object definition is incorrect. I'd recommend that you check the tenScripting application. It's very instructive and a powerful way to tackle scripting in HomeSeer.
    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
      Thank you i will have a look

      Comment


        #4
        Originally posted by Doebe View Post
        ScriptingReferences=DDay.iCal;DDay.iCal.dll,DDay.Collections ;DDay.Collections.dll,antlr.runtime;antlr.runtime.dll;snap7. net;Snap7.net.dll
        Should there be a space here? snap7. net

        Comment


          #5
          I've typically provided the full path for libraries like that:

          Code:
          ScriptingReferences=System.Data.SQLite;C:\Program Files (x86)\HomeSeer HS3\Bin\System.Data.SQLite.dll,System.Management;System.Management.dll,System.Web;System.web.dll,System.Windows.Forms;System.Windows.Forms.dll,System.Drawing;System.Drawing.dll,Newtonsoft.Json;C:\Program Files (x86)\HomeSeer HS3\Bin\homeseer\Newtonsoft.Json.dll,System.Web.Extensions;System.Web.Extensions.dll
          May be worth trying. I would move the dll files into a sub-directory under the Bin folder, rather than in the HS root folder.
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Originally posted by drhtmal View Post

            Should there be a space here? snap7. net
            Probably a forum issue as it sometimes inserts spaces like that when you paste text into a post.
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              Space is indeed coming from copy/paste.
              i also tried full path, nog changes here.

              if i have time i will try tenscripting option to see if there is some problem.

              Comment

              Working...
              X