Announcement

Collapse
No announcement yet.

Problems using hs.Plugin("SMS Connector").SendSMS

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

    Problems using hs.Plugin("SMS Connector").SendSMS

    Good morning,

    I CANNOT GET THE hs.Plugin("SMS Connector").SendSms COMMAND TO WORK WITHIN THE hspi_smsc.vb SCRIPT. AM I DOING SOMETHING WRONG?

    THE FOLLOWING MODIFICATION OF THE SCRIPT IS MEANT TO FORWARD A RECEIVED TEXT TO ANOTHER TEXT NUMBER. ASIDE FROM MAKING AN ENTRY IN THE HS LOG ABOUT THE SENDING, IT DOES NOT DO ANYTHING ELSE.

    THIS IS THE MODIFICATION OF THE hspi_smsc.vb SCRIPT
    >>>>>>>>>>>>>>
    Sub OnIncomingSms( param as SerialAction )

    hs.WriteLog( hs.Plugin("SMS Connector").Port & " EVENT", "INCOMING SMS CallerId:" & param("callerid") & " Message:" & param("message") )
    hs.WriteLog(hs.Plugin("SMS Connector").Port & " EVENT",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
    hs.Plugin("SMS Connector").QueueSerialAction("WRITELINE", "AT+CNMA")
    hs.Plugin("SMS Connector").QueueSerialAction("WAITFOR", "OK|ERROR", 9000)
    'send on the received message
    'INSERT A PROGRAMMING DELAY HERE
    hs.WaitSecs(10)
    hs.Plugin("SMS Connector").SendSms("087XXXXXXX", param("message"))

    'If param("message") = "my trigger message" Then
    ' hs.TriggerEvent( "My Event Name" )
    ' End If

    End Sub

    FRON LOG - WHAT HAPPENS WHEN MESSAGE IS RECEIVED AND ATTEMPTED TO BE SENT
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    19/05/2009 22:35:15 - COM10 EVENT - INCOMING SMS CallerId:+35387xxxxxxx Message:Test
    19/05/2009 22:35:15 - COM10 EVENT - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    19/05/2009 22:35:15 - COM10 WRITELINE - AT+CNMA
    19/05/2009 22:35:15 - COM10 WAITFOR - OK|ERROR - ResponseTimeout=9000
    19/05/2009 22:35:15 - COM10 READ - 1 bytes: 65 [A]
    19/05/2009 22:35:15 - COM10 READ - 2 bytes: 84 43 [T+]
    19/05/2009 22:35:15 - COM10 READ - 11 bytes: 67 78 77 65 13 13 10 79 75 13 10 [CNMAOK]
    19/05/2009 22:35:15 - COM10 WAITFOR - OK|ERROR MATCHED
    19/05/2009 22:35:25 - SMS Connector - Sending SMS to 087XXXXXXX : Test
    {Nothing else is recorded}
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    nb - NO MESSAGE IS SENT, NO DEBUG DATA IS OUTPUTED, ONLY THIS ENTRY IS MADE IN THE HOMESEER LOG

    THANKS FOR ANY HELP

    #2
    You cannot use this API from within the driver script.

    When you call this API from a standard HomeSeer script, the plugin then calls different functions within the driver script.
    --
    stipus

    Comment


      #3
      Okay and thanks for that advice.

      I added the following code in place of that statement, and it works (i.e. all sms texts received are resent to my own mobile):

      hs.Plugin("SMS Connector").QueueSerialAction( "WRITELINE", "AT+CMGS=" & chr(34) & "087XXXXXXX" & chr(34) )
      hs.Plugin("SMS Connector").QueueSerialAction( "WAITFOR", ">", 9000 )
      hs.Plugin("SMS Connector").QueueSerialAction( "WRITEGSM", param("message"))
      hs.Plugin("SMS Connector").QueueSerialAction( "WRITE", chr(26).ToString() , 0 )
      hs.Plugin("SMS Connector").QueueSerialAction( "WAITFOR", "CMGS", 9000)

      Comment


        #4
        Hi Stipus,

        And first, thank you for the great plugin! I am replacing the old (and not so reliable) Maxx plugin with this one.

        I already have a script that parses the received message, does what ever needs do be done based on the caller id and the message text and then sends an acknowledgement message back to the sender if the message came from a known number.

        First, I tried using hs.Plugin("SMS Connector").SendSMS in the driver code, but as you said, it does not work.

        Then, I tried calling hs.Plugin("SMS Connector").SendSMS from a handler script that was being called from the driver with hs.RunEx, but it would not work either.

        Finally, I found this thread, used gaynorc's approach and added a sub to the driver code that sends the reply. And that works! Only I need to insert a delay of 5 secs before the reply is sent.

        My question: Is there any other way to send the reply from the driver script? A script interface?

        One thing to the wish list: support for the accentented characters! I am not an expert, but I believe they can be sent either in PDU format or in 7-bit ascii by using a code conversion table. With Maxx plugin, I was able to send and receive them. Here is some info:

        http://www.developershome.com/sms/gsmAlphabet.asp

        Implementing this would make many of us in Europe very happy!

        Comment


          #5
          I think the GSM Alphabet is already implemented in the plugin, but I'm not sure if this setting is available through the Web Configuration Interface.

          Try this:

          - Shutdown HomeSeer
          - Open Config/hspi_smsc.ini with Notepad
          - In the Delivery section, add the key MessageEncoding=GSM0338
          - Restart HomeSeer

          hspi_smsc.ini
          Code:
          [Delivery]
          MessageEncoding=GSM0338
          If the section or key is not in the ini file, the plugin uses the Windows 1252 Alphabet.
          --
          stipus

          Comment

          Working...
          X