Announcement

Collapse
No announcement yet.

strange Comm error

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

    strange Comm error

    Hey anyone got any ideas what i am doing to cause this error. Would comm mode be an issue? I have tried both.

    Type mismatch: '[string: "OK"]' in line 21 More info: Type mismatch: '[string: "OK"]' (line 21 is select case)

    The device is sending a "0" or "1" as reply.
    Here is the script in question...

    Const CommPort = 4

    sub main()

    Dim Data
    Dim Count


    For Count = 1 to 8

    hs.SendToComPort CommPort,"GI" & Count

    Do
    Data = hs.GetComPortData(CommPort)
    Loop While InStr(1,Data, "") = 0


    Select Case Data

    Case 0
    hs.SetDeviceStatus "x" & Count, 3 'is ON
    Case 1
    hs.SetDeviceStatus "x" & Count, 2 'is ON
    Case Else
    hs.writelog "Comport data error",Data

    End Select

    Next
    Last edited by smokey1384; March 29, 2011, 08:20 PM.

    #2
    First try changing Data to sData and see if that helps. Also change your lines Case 0 to Case "0", etc these need to be strings.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      Rupp,

      I changed as you said but I am getting "OK" for first sData reply. Rest are correct.

      Should be reply for "GI1" (1 OR 0) but i get "OK"

      Really strange because but I tried a bunch of weird commands with hyperterminal but could never get the device to reply "OK"

      Big question is where is this "OK" coming from???

      Smokey

      Comment


        #4
        Turns out the comm buffer must have some commands in it from another event.

        Does anyone know how to flush the buffer out? I don't see much by way of functions available in Homeseer.

        Comment

        Working...
        X