Announcement

Collapse
No announcement yet.

Data Receiving Script not Executing

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

    Data Receiving Script not Executing

    Hi,

    I'm trying to get my Hometroller SEL to communicate with another device via RS232. I can send a string to the device and the device can read the string, but HS3 cannot read a string from the device. I use Tera Term to verify that the device is indeed sending a string. If I use Tera Term to send a string to HS3, it still does not read the string.

    I have the following lines at the end of Startup.vb script that basically opens my com port on the SEL:

    'Open USB COM Port 1 for RTI Controller

    Dim e As String

    e = hs.opencomportterm(1, "19200,N,8,1", 1, "RTIUpdate.vb", "",chr(13))

    If e <> "" Then

    hs.writelog("Error Opening Com Port 1", e)

    Else

    hs.writelog("COM 1 ", "Successfully Opened")

    End If


    I have the following test script that sends a string to the device and it is works perfect:

    Sub Main(parm as object)

    dim e as string

    e="Hello world"

    hs.SendToComPort(1,e +chr(10)+chr(13))

    hs.writelog("RTI", e)

    End Sub

    The following is the RTIUpdate.vb(receiving data from com port) script:

    Sub Main(ByVal Feedback As String)

    'Log Zone and level

    hs.writelog("RTI", "Serial Data:"&Feedback)

    End Sub

    I believe my issue is in the RTIUpdate.vb script. When I try to send a string from the device or from Tera Term I don't think the script is executing. hs.writelog("RTI", "Serial Data:"&Feedback) doesn't get logged to the log file. Also, If I run the script manually, the Feedback string is blank in the logs. It would just state RTI Serial Data in the log file.



    I'm I missing something here?

    #2
    Try e = hs.opencomportterm(1, "19200,N,8,1", 1, "RTIUpdate.vb", "Main",chr(13))
    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 did have "Main" in my original string before and it didn't work then either. I just tried re-adding it to my string and it didn't work.

      Comment


        #4
        Current Date/Time: 7/12/2019 11:20:01 AM
        HomeSeer Version: HS3 Pro Edition 3.0.0.534
        Linux version: Linux hometrollerSEL 3.16.0-031600-generic #201408031935 SMP Sun Aug 3 23:56:17 UTC 2014 i686 i686 i686 GNU/Linux System Uptime: 0 Days 0 Hours 11 Minutes 44 Seconds
        IP Address: 192.168.0.13
        Number of Devices: 206
        Number of Events: 42
        Available Threads: 194
        HSTouch Enabled: True
        Event Threads: 1
        Event Trigger Eval Queue: 0
        Event Trigger Priority Eval Queue: 0
        Device Exec Queue: 0
        HSTouch Event Queue: 0
        Email Send Queue: 0

        Enabled Plug-Ins
        2.0.31.0: BLRing
        2.0.0.1: EZFlora
        5.0.0.59: Global Cache Pro
        3.0.7.2: Insteon
        3.0.1.14: Kodi
        3.0.1.18: weatherXML
        3.0.1.252: Z-Wave

        Comment


          #5
          Do you have a way to confirm that chr(13) is the proper termination?
          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


            #6
            No, but I've tried other methods of writing a carriage return and the script logs an error.

            Comment


              #7
              When I sent opencomportterm to raw mode instead of string. I'm not getting any characters back either

              Comment


                #8
                Originally posted by huntley1 View Post
                No, but I've tried other methods of writing a carriage return and the script logs an error.
                Can you elaborate on this point, please? Are you saying you've change the Startup.vb script?

                I'm just wondering if the received message actually has chr(13) at the end. What if you specify chr(10) - or even a printable character that is present in the message - instead?
                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


                  #9
                  I'd be cautious before you delve too deep as I'm not sure that Linux COM ports ever worked correctly, I looked at it some years ago and couldn't get them working with a plugin however HS may have fixed it.

                  Mono has some missing functions especially around the data received event that probably never got implemented even as Mono progressed.

                  Comment


                    #10
                    Originally posted by huntley1 View Post
                    If I use Tera Term to send a string to HS3, it still does not read the string.
                    What is the nature of the string you tried sending? I assume you sent it to the same com port, with the same parameters as if it had some from your device.

                    Could you try sending a string like: "Test test testQ"
                    and change your startup script to: e = hs.opencomportterm(1, "19200,N,8,1", 1, "RTIUpdate.vb", "Main", "Q")

                    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


                      #11
                      Originally posted by Uncle Michael View Post
                      What is the nature of the string you tried sending? I assume you sent it to the same com port, with the same parameters as if it had some from your device.

                      Could you try sending a string like: "Test test testQ"
                      and change your startup script to: e = hs.opencomportterm(1, "19200,N,8,1", 1, "RTIUpdate.vb", "Main", "Q")
                      Yes. I have Tera Term open and I know it is communicating with HS3 I can see all the strings I send from HS3 with ch(13) at the end of the string.

                      It tried changing my script as you mentioned here and I'm not getting any returning string. I can send the same string to my RTI device and it is recieving it.

                      I'll tryout Mr.Happy's theory on a a windows PC and see if I'm an able to recieve strings with my scripts.

                      Comment


                        #12
                        Originally posted by huntley1 View Post
                        I'll tryout Mr.Happy's theory on a a windows PC and see if I'm an able to recieve strings with my scripts.
                        I agree. It does seem like it's nothing to do with your script.

                        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


                          #13
                          So, I just install HS3 Windows on my laptop added my scripts and opened my COM port. I sent a few strings from SEL and my laptop received them. The scripts and method are now proven to work. I guess the question now is there a work around for the SEL? it's weird that it the port can send strings, but can't receive them.

                          Comment


                            #14
                            Originally posted by huntley1 View Post
                            So, I just install HS3 Windows on my laptop added my scripts and opened my COM port. I sent a few strings from SEL and my laptop received them. The scripts and method are now proven to work. I guess the question now is there a work around for the SEL? it's weird that it the port can send strings, but can't receive them.
                            Not to my knowledge unless you went along with using one of the plugins that can assist with serial commands (I think Big5 and the one by drule are the only ones I know of and don't really have any experience of either). The workaround I had to do with the plugin I wrote was to watch the bytes on the serial port in a thread and then pass that to a subroutine when it found the carraige return. I'm not sure that would be realistic or possible to do in a script.

                            The issue with receiving data is listed here as a limitation - https://www.mono-project.com/archive...systemioports/ - I did have the belief from Bugzilla posts (from years ago) that HS had implemented a workaround for Linux but not sure I ever saw proof either way as it was some time before the issue with HS accepting non-windows type serial port names.

                            Comment

                            Working...
                            X