Announcement

Collapse
No announcement yet.

8CUR Relay polling problem

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

    8CUR Relay polling problem

    This problem has been around for years, and I finally figured it out. It needs to get fixed.

    I have found the problem with this and can now present it in such a way that you can fix it. Yes, for over a year, I've been getting a little note from Homeseer every five or six days telling me that this happened and finally I took the time to turn on all logs and "catch it". I can see why no one answered my original post a year ago, since the problem cannot be caught in it. The problem actually probably occurred JUST AFTER the end of the log entries shown in my original post.

    The problem is caused by the plug-in discarding the entire receiving buffer upon finding a command it cannot understand. But in this case, i've discovered that the plug-in is discarding all responses to its polling requests for my relay expanders. The relay expanders have always worked great, but I guess that the polling has not. And I do believe that polling did work at one point, so perhaps a subsequent change to the plug-in broke it and nobody noticed.

    The next four lines show the plug-in querying (polling) the external relay expanders:
    10/26/2008 8:22:56 AM ~!~JDS StarGate Comms~!~Sending Command: ##%a507!R801Q
    10/26/2008 8:22:56 AM ~!~JDS StarGate Comms~!~Sending Command: ##%a507!R802Q
    10/26/2008 8:22:56 AM ~!~JDS StarGate Comms~!~Sending Command: ##%a507!R803Q
    10/26/2008 8:22:56 AM ~!~JDS StarGate Comms~!~Sending Command: ##%a507!R804Q

    The first relay expander response comes in:
    10/26/2008 8:22:56 AM ~!~JDS StarGate DEBUG~!~gRbuffer :: :: $R801Q00<13><10>
    10/26/2008 8:22:56 AM ~!~JDS StarGate Comms~!~CurrentBuffer = $R801Q00

    And is discarded as an unknown packet:
    10/26/2008 8:22:56 AM ~!~JDS StarGate DEBUG~!~Unknown packet (CurrentBuffer) : :: $R801Q00<13><10>

    Then comes the real problem. Stargate sends some variable updates, but is also still sending the responses to the polling request:
    10/26/2008 8:22:57 AM ~!~JDS StarGate DEBUG~!~gRbuffer :: :: !!10/260265834004<13><10>$R802Q00<13><10>!!10/26026583415d<13><10>!!10/260265833131<13><10>!!10/260265834262<13><10>!!10/260265835000<13><10>$R803Q00<13><10>!!10/26026583S01020100<13><10>$R804Q0D<13><10>

    The first part of the buffer is processed just fine. This is the first half of a variable set (value half):
    10/26/2008 8:22:57 AM ~!~JDS StarGate Comms~!~CurrentBuffer = !!10/260265834004
    10/26/2008 8:22:57 AM ~!~JDS StarGate Comms~!~Variable event :: 004
    10/26/2008 8:22:57 AM ~!~JDS StarGate Comms~!~Variable Load(0) :: (4)

    Then the plug-in moves to the next item in the buffer:
    10/26/2008 8:22:57 AM ~!~JDS StarGate Comms~!~CurrentBuffer = $R802Q00

    It decides again that it must discard the unknown packet and also discards all remaining items in the receiving buffer:
    10/26/2008 8:22:57 AM ~!~JDS StarGate DEBUG~!~Unknown packet (CurrentBuffer) : :: $R802Q00<13><10>

    The plug-in continues on with a newly received item:
    10/26/2008 8:22:58 AM ~!~JDS StarGate DEBUG~!~gRbuffer :: :: !!10/26026584S00020203<13><10>
    10/26/2008 8:22:58 AM ~!~JDS StarGate Comms~!~CurrentBuffer = !!10/26026584S00020203
    10/26/2008 8:22:58 AM ~!~JDS StarGate Comms~!~Security event :: 000

    What was lost here were all the items in the buffer after that unrecognized "$R802Q00", so look what we lost:
    !!10/26026583415d<13><10>
    the variable number 94 (hex 5d), to which the value 4, received earlier, was to be applied
    !!10/260265833131
    a flag set command that was completely discarded and missed! ("Homeseer talk" flag)
    !!10/260265834262
    a variable CLEAR command that was completely discarded and missed! ("Garage away status" variable)
    !!10/260265835000
    a relay output that happened, but again was completely discarded and missed!
    $R803Q00
    the third polling response which would also have been considered an unknown packet
    !!10/26026583S01020100
    a security event that happened that was completely discarded and missed!
    $R804Q0D
    the fourth polling response which would also have been considered an unknown packet

    In Summary,

    The relay expander polling is not working and is actually causing data to get lost by the plug-in and for potentially important, flag, variable, relay, and security information to be DISCARDED!!!

    To fix this, the plug-in code for receiving relay polls should be checked. I know that the plug-in discards all packets except for those preceded by certain characters. This was an issue addressed back in 2006 and 2007.

    Here is a message I received from RJ back in 2006 regarding message prefixes and discarded "unknown packets":
    Hi Tim-
    The reason that we clear the buffer here is because this can sometimes contain ACK data, from reading X10 status, etc.
    There are some “Prefixes” you can use in an ASCII-out to get the plugin to recognize this:
    ElseIf InStr(1, CurrentBuffer, "&&") <> 0 Then
    ' DOS shell event
    ExecDOS(CurrentBuffer)
    ElseIf InStr(1, CurrentBuffer, "$$") <> 0 Then
    ' HomeSeer script event
    ExecScript(CurrentBuffer)
    ElseIf InStr(1, CurrentBuffer, "@@") <> 0 Then
    ' HomeSeer audio play event
    ExecMedia(CurrentBuffer)
    ElseIf InStr(1, CurrentBuffer, ">>") <> 0 Then
    ' ASCII out string
    SaveAscii(CurrentBuffer)
    That is straight out of the Com code, so perhaps “>>TAL25” would be a better solution.
    Best Regards,
    RJ Walsh
    HomeSeer Technologies, LLC
    Related post: http://board.homeseer.com/showthread.php?t=121780

    So the plug-in probably doesn't recognize the prefix of a single "$". Can this be easily fixed? Who, if anyone, works on the Stargate plug-in these days.

    For now, I'll turn off relay polling and advise everyone else to do the same and to consider the plug-in broken. Perhaps this will also help people explain the occasional missed data from Stargate, even if rarely.
    Tim
    Last edited by timlacey; November 3, 2008, 03:59 PM. Reason: formatting clean-up

    #2
    Tim,
    Wow. Great detective work! Have you submitted a help request on this? I don't think anyone from HST monitors the JDS discussion, so probably won't pick up on the problem without a ticket. I wonder if there is anyone around to work on the problem any more?
    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'm willing to put in a fix for you, but RJ has moved on to college (and has started his own business so I understand) I do not know the Stargate protocol so it would take a lot of time for me to figure out a fix. If you know the protocol maybe you can help. I have posted the packet handling code below, I suspect a change to this part of the code will fix it. Tell me what you want changed and I'll do another build.

      Code:
       
      [SIZE=2]LogDebug([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"gRbuffer :: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], gRbuffer)
      [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Have we got a complete line?
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'*******************************************************************************************
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] gRbuffer.Length > 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Mid(gRbuffer, gRbuffer.Length, 1) = vbLf [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Do
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]LineIndex = InStr(1, gRbuffer, vbCr)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] LineIndex = 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' We don't have a line yet
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]LogComms([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"gRbuffer = "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & gRbuffer & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" ("[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & Trim([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]CStr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](LineIndex)) & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]")"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Exit[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Sub
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' strCurrentBuffer holds first term in gRbuffer
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] LineIndex < gRbuffer.Length [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]CurrentBuffer = Mid(gRbuffer, 1, LineIndex + 1)
      b0 = Mid(CurrentBuffer, CurrentBuffer.Length - 1, 1)
      b1 = Mid(CurrentBuffer, CurrentBuffer.Length, 1)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] b0 = vbCr [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]And[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] b1 <> vbLf [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gRbuffer = Mid(CurrentBuffer, Len(CurrentBuffer), 1) & gRbuffer
      CurrentBuffer = Mid(CurrentBuffer, 1, Len(CurrentBuffer) - 1) & vbLf
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gRbuffer = Mid(gRbuffer, LineIndex + 2)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Else
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]CurrentBuffer = gRbuffer
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]LogComms([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"CurrentBuffer = "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"##"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' ack
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' check ack type
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"###%33"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gAckBuffer = CurrentBuffer
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Else
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"###"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gAckBuffer = gAckBuffer & CurrentBuffer
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' InStr(1, gAckBuffer, "###%33")
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Device type response
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' ACK response
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"##0"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gAckBuffer = gAckBuffer & CurrentBuffer
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"!!"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' event
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]HandleEvent(CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"&&"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' DOS shell event
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]ExecDOS(CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"$$"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' HomeSeer script event
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]ExecScript(CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"@@"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' HomeSeer audio play event
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]ExecMedia(CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] InStr(1, CurrentBuffer, [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]">>"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) <> 0 [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' ASCII out string
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]SaveAscii(CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Else
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]LogDebug([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Unknown packet (CurrentBuffer) : "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], CurrentBuffer)
      [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' must be ack data
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]gAckBuffer = gAckBuffer & CurrentBuffer & gRbuffer
      gRbuffer = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]""
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Loop[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]While[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] gRbuffer.Length > 0
      [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Mid(gRbuffer, Len(gRbuffer), 1) = vbLf
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' Len(gRbuffer) > 0 Then
      [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'**********************************************************
      [/COLOR][/SIZE][/COLOR][/SIZE]
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        To permit the packets, all we'd have to add is:
        ElseIf InStr(1, CurrentBuffer, "$R") <> 0 Then
        ' Relay Expander Polling Response
        ExecScript(CurrentBuffer)

        If you want to do a beta build with this addition, I could see how the packets are handled after the packet is passed through.


        Perhaps since $$ is used for Homeseer script commands, it got confused with the single $ which has this other purpose. The original plug-in by Glen Todd did not support relay expanders, and this is one of the much-wanted features that RJ added. Then when RJ updated these packet prefixes, he must have missed the single $. The trick is whether or not he properly differentiates between the two when acting on the packet.

        But I could test it really easily if you wanted to do a quick build and send it over. I can simply force a polling command and log the responses and see if the relay values get loaded. I could also send a $$ command and make sure that the plug-in is distinguishing the two different types of command.

        Thanks,

        Tim
        tim
        Last edited by timlacey; November 5, 2008, 10:43 AM.

        Comment


          #5
          Ok, I added the change, try this version:

          ftp://ftp.homeseer.com/updates/Beta/...3231.16995.zip
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            Well, I guess RJ didn't put the code in there (or leave the code in there) to handle the packets, because the log shows this after processing a packet from the relay expander.

            <TABLE cellSpacing=2 cellPadding=0 width="100%" border=0><TBODY><TR><TD class=LOGDateTime0 noWrap align=left>11/6/2008 8:07:40 AM </TD><TD class=LOGType0 align=left colSpan=3>Info </TD><TD class=LOGEntry0 align=left colSpan=8>Event Trigger "Stargate - Send manual Relay Expander Query"</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>11/6/2008 8:07:40 AM </TD><TD class=LOGType1 align=left colSpan=3>Info </TD><TD class=LOGEntry1 align=left colSpan=8>Running script and waiting: &Hs.plugin("JDS Stargate").SendRaw "##%a507!R801Q",0</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>11/6/2008 8:07:40 AM </TD><TD class=LOGType0 align=left colSpan=3>JDS StarGate Comms </TD><TD class=LOGEntry0 align=left colSpan=8>Sending Command: ##%a507!R801Q</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>11/6/2008 8:07:40 AM </TD><TD class=LOGType1 align=left colSpan=3>JDS StarGate DEBUG </TD><TD class=LOGEntry1 align=left colSpan=8>gRbuffer :: :: $R801Q00<13><10></TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>11/6/2008 8:07:40 AM </TD><TD class=LOGType0 align=left colSpan=3>JDS StarGate Comms </TD><TD class=LOGEntry0 align=left colSpan=8>CurrentBuffer = $R801Q00</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>11/6/2008 8:07:43 AM </TD><TD class=LOGType1 align=left colSpan=3>Error </TD><TD class=LOGEntry1 align=left colSpan=8>Running script: File not found: $R801Q00</TD></TR></TBODY></TABLE>
            The plug-in does seem to otherwise work fine with this change. I guess ExecScript is the next place we'd have to look to see if there is code in there to handle the $R commands. I'm puzzled that it wouldn't be, since RJ specifically added it at some point and people had tested it.

            For now, having an error message in the LOG at least lets people know that something isn't working.

            Even with polling disabled, the plug-in seems to poll upon startup. So uncorrected, the other version of the plug-in might be causing people to lose data on startup. Upon initialization, it produces four error messages corresponding to the four relay expander queries.

            The good news is that Homeseer now doesn't discard subsequent packets:

            11/6/2008 8:19:02 AM Info Event Trigger "Stargate - Send manual Relay Expander Query"
            11/6/2008 8:19:02 AM Info Running script and waiting: &Hs.plugin("JDS Stargate").SendRaw "##%a507!R801Q",0
            11/6/2008 8:19:02 AM JDS StarGate Comms Sending Command: ##%a507!R801Q
            11/6/2008 8:19:02 AM JDS StarGate DEBUG gRbuffer :: :: $R801Q00<13><10>!!11/0603000409cb<13><10>
            11/6/2008 8:19:02 AM JDS StarGate Comms CurrentBuffer = $R801Q00
            11/6/2008 8:19:02 AM Error Running script: File not found: $R801Q00
            11/6/2008 8:19:02 AM JDS StarGate Comms CurrentBuffer = !!11/0603000409cb
            11/6/2008 8:19:02 AM JDS StarGate Comms X10 address :: H14
            11/6/2008 8:19:02 AM JDS StarGate Comms X10 command :: 3
            11/6/2008 8:19:02 AM JDS StarGate Comms X10 receive
            11/6/2008 8:19:02 AM X10 Received H14 ( Attic AC BoosterFan) H Off

            Tim
            Last edited by timlacey; November 6, 2008, 11:22 AM.

            Comment


              #7
              What are the $R commands? ExecScript is used to execute HomeSeer scripts. I suspect that is not the call we need to make there.
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Yes, you are right. Sorry I had misread the original code that you sent me, and I was thinking that he was passing everything to ExecScript after considering it valid. But most likely, if RJ has code to handle the ASCII coming from Stargate starting with "$R" (as opposed to "$$" which is a ExecString command), he does it with HandleEvent, as is done here:

                ElseIf InStr(1, CurrentBuffer, "!!") <> 0 Then
                ' event
                HandleEvent(CurrentBuffer)
                So I intended to suggest:
                ElseIf InStr(1, CurrentBuffer, "$R") <> 0 Then
                ' Relay Expander Polling Response
                HandleEvent(CurrentBuffer)
                The "$R" strings are used for Stargate event reporting for external devices, and "!!" is used for variables, flags, and other internal values.
                A sample "$R" string is: $R801Q00 - relay expander #1 has all relays turned OFF.

                Is it possible to ask RJ if he remembers? I could e-mail and ask him? I know it's in there, because I found all the message board postings of people testing it out, and even testing out the polling functions. It was agreed back in 2006 that it was working, but this was before he finished work ont he plug-in and before the final builds that we're all using today.
                Tim
                Last edited by timlacey; November 6, 2008, 07:48 PM.

                Comment


                  #9
                  Ok, he has code to handle "$R8" which looks like the external relays. I added a call to the code that handles this, see if this works:

                  ftp://ftp.homeseer.com/updates/Beta/...3233.18073.zip
                  💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                  Comment


                    #10
                    Thank you for your help.

                    The plug-in now appears to process all relay messages properly, including polling requests.

                    I have not seen a single error message or unknown packet and the resulting loss of data.

                    I suggest that others with Relay Expanders update to this version and verify that it's working for them here. Then it should probably get pushed out to the updater.

                    Thanks,

                    Tim

                    Comment


                      #11
                      Ok, thanks for your help also, I would not have known were to look to fix this. I'll let it simmer for a while then put it in the updater.
                      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                      Comment

                      Working...
                      X