Announcement

Collapse
No announcement yet.

mcsXap plugin / Script Call send xap Message

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

  • mcsXap plugin / Script Call send xap Message

    Need some scripting Help calling mcsXap plugin
    I am wanting to send an Xap message from a script but not having any luck.

    Here is what I have so far...

    PHP Code:
    Sub Main

    Dim callname
    dim callnmbr
    dim flag
    dim tmr
    Dim ct
    Dim body
    Dim xap
    Dim sTarget 
    Dim sClass 
    Dim sSection 
    Dim sData 
    '*************************************************************************************
    get the caller directory name
    'callname = hsp.cidname(1)
    get the phone number
    'callnmbr = hsp.cidnumber(1)
    callname=hs.DeviceStringByName("Phone Status CID_Name")
    callnmbr=hs.DeviceStringByName("Phone Status CID_Number") 
    '
    *************************************************************************************
    xap hs.GetPlugins("mcsXap"

    ' xap.SendXapMessage sTargetAddress, "cid.Incoming", "cid.incoming", _
    '                       "Device" 
    Chr(1) & sDC Chr(0) & _
    '                       "Command" & Chr(1) & sLevel

    xap.SendXapMessage  sTarget, "cid.Incoming", sClass "cid.incoming", sData "name" &callname, "phone" &callnmbr
       
    xap.SendXapMessage """xAPBSC.event""output.state.1"_
    '                    "State" & Chr(1) & sStatus,  _
    '                    
    sName "." sID "." "Relay"_
    '                    Left(gXapUID, 6) & sIndex

     End Sub 
    Last edited by HomeTech; November 24th, 2013, 05:14 PM.
    HS2 Environment
    Zotac 1.83 GHz Quadcore
    HomeSeer Way2Call
    Netiom-Xap board
    opnode 1-wire 1.2.7
    Plug-In's
    WeatherXML 1.0.0.32
    Pwr Link USB 1.0.0.13
    mcsTemp V6.2.0.14
    mcsXap V3.0.0.0/3.0.0.20
    IM Connector 4.87.2.5
    Sip Connector 2.56.2.4
    RFXCOM 15.0.0.22
    Odroid X2
    Asterisk 11.5.1
    FreePBX 2.11.0.42
    WebMin 1.720
    Xap Switchboard by Mi4

    There is no place Like 127.0.0.1

  • #2
    Any one know how to address mcsXap plugin from a script to send a Xap message? I have tried a few different ways but no luck.

    All I need is an example to get me started.

    Thanks
    HS2 Environment
    Zotac 1.83 GHz Quadcore
    HomeSeer Way2Call
    Netiom-Xap board
    opnode 1-wire 1.2.7
    Plug-In's
    WeatherXML 1.0.0.32
    Pwr Link USB 1.0.0.13
    mcsTemp V6.2.0.14
    mcsXap V3.0.0.0/3.0.0.20
    IM Connector 4.87.2.5
    Sip Connector 2.56.2.4
    RFXCOM 15.0.0.22
    Odroid X2
    Asterisk 11.5.1
    FreePBX 2.11.0.42
    WebMin 1.720
    Xap Switchboard by Mi4

    There is no place Like 127.0.0.1

    Comment


    • #3
      I ran the following script to see if I had the name correct for the plugin and for some reason it does not show mcsXap in its list.

      11/25/2013 2:57:18 PM Item Plugin name is: mcsTemperature
      11/25/2013 2:57:18 PM Item Plugin name is: SmartHome PowerLinc USB
      11/25/2013 2:57:18 PM Event Running script and waiting: GetNamesPlugins.txt

      PHP Code:
      Sub main()
      Dim plugIn
      Dim item
      Set plugIn 
      hs.GetPlugins
      For Each item In plugIn
      hs
      .WriteLog "Item","Plugin name is: " item.name
      Next
      End Sub

      'This script will show all Plugins installed with there Names. 
      HS2 Environment
      Zotac 1.83 GHz Quadcore
      HomeSeer Way2Call
      Netiom-Xap board
      opnode 1-wire 1.2.7
      Plug-In's
      WeatherXML 1.0.0.32
      Pwr Link USB 1.0.0.13
      mcsTemp V6.2.0.14
      mcsXap V3.0.0.0/3.0.0.20
      IM Connector 4.87.2.5
      Sip Connector 2.56.2.4
      RFXCOM 15.0.0.22
      Odroid X2
      Asterisk 11.5.1
      FreePBX 2.11.0.42
      WebMin 1.720
      Xap Switchboard by Mi4

      There is no place Like 127.0.0.1

      Comment


      • #4
        Please keep in mind I know nothing about mcsXap so my advice is generic. For a start

        xap = hs.GetPlugins("mcsXap")

        will not work, to retrieve the plugin you instead use hs.plugin (which will return the plugin object), try changing this to hs.Plugin("mcsXap").

        Why it is not returning the name using the example in post #3 I am going to guess is because it is a .net plugin, only com plugins will be returned using hs.getplugins, hs.getpluginsex will return all plugins.
        My Plugins:

        Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
        Yeelight 3P | Nanoleaf 3P

        Comment


        • #5
          mcsXap plugin / Script Call send xap Message

          Originally posted by HomeTech View Post
          Any one know how to address mcsXap plugin from a script to send a Xap message? I have tried a few different ways but no luck.

          All I need is an example to get me started.

          Thanks
          I don't think the HS3 plugin has this capability yet. Michael said he is working on a way to send an xAP message. I don't think a script will be needed.

          Steve Q


          Sent from my iPad using Tapatalk HD
          HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
          2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit

          Comment


          • #6
            OK, ran this script found on the board and you are correct it is a .Net plugin
            So it looks like the plugin name is mcsXap so I have that correct.

            If the plugin does not support the calls. Then that is what I am Fighting. Will need to wait for Michale to chime in to let us know.

            FYI I can send an Xap message from an event no problem...... but I need to use a script to insert my incoming CID name and number.

            Here is the script that show the installed plugin names for calling.

            PHP Code:
             
             ' 
            Get a list of all plugin's installed.
             '
            Sub Main(parm As Object)
            Dim list As string
            Dim pi
            Dim p
            Dim s

            On Error Resume Next
             
            list = ""
            pi hs.GetPluginsEx()

             
            hs.WriteLog("QUERY TEST""There are " pi.count " NET Plug-ins in the system.")
            For 
            Each p In pi
             hs
            .WriteLog("QUERY TEST""-->NET Plug-in " p.Name)
            Next

             pi 
            hs.GetPlugins()

            'hs.WriteLog("QUERY TEST", "There are " & pi.count & " COM Plug-ins in the system.")
            hs.WriteLog("QUERY TEST", "List of COM Plug-ins in the system.")
            For Each p In pi
                Err.Clear
                s = p.name
                If (Err.Number <> 0) Or (Trim(s) = "") Then
            '
            if (Trim(s) = ""Then
                hs
            .WriteLog("QUERY TEST""--> .NET without COM Interface")
                
            Err.Clear
                 
            Else
                
            hs.WriteLog("QUERY TEST""-->COM Plug-in " s)
                 
            End If
             
            Next

             End Sub 
            <table border="0" cellpadding="0" cellspacing="2" width="100%"><tbody><tr><td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry0" align="left">--COM Plug-in mcsTemperature</td></tr> <tr> <td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType1" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry1" align="left">--COM Plug-in SmartHome PowerLinc USB</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry0" align="left">List of COM Plug-ins in the system.</td></tr> <tr> <td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType1" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry1" align="left">--NET Plug-in SIP Connector</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry0" align="left">--NET Plug-in weatherXML</td></tr> <tr> <td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType1" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry1" align="left">--NET Plug-in IM Connector</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry0" align="left">--NET Plug-in mcsTemperature</td></tr> <tr> <td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType1" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry1" align="left">--NET Plug-in mcsXap</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry0" align="left">--NET Plug-in SmartHome PowerLinc USB</td></tr> <tr> <td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType1" align="left"> QUERY TEST </td><td colspan="8" class="LOGEntry1" align="left">There are 6 NET Plug-ins in the system.</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">11/25/2013 6:42:04 PM </td><td colspan="3" class="LOGType0" align="left"> Event </td><td colspan="8" class="LOGEntry0" align="left">Running script and waiting: GetPluginNameVB.vb</td></tr></tbody></table>
            Last edited by HomeTech; November 25th, 2013, 07:01 PM.
            HS2 Environment
            Zotac 1.83 GHz Quadcore
            HomeSeer Way2Call
            Netiom-Xap board
            opnode 1-wire 1.2.7
            Plug-In's
            WeatherXML 1.0.0.32
            Pwr Link USB 1.0.0.13
            mcsTemp V6.2.0.14
            mcsXap V3.0.0.0/3.0.0.20
            IM Connector 4.87.2.5
            Sip Connector 2.56.2.4
            RFXCOM 15.0.0.22
            Odroid X2
            Asterisk 11.5.1
            FreePBX 2.11.0.42
            WebMin 1.720
            Xap Switchboard by Mi4

            There is no place Like 127.0.0.1

            Comment


            • #7
              Two access method examples that produce the same result using xapScript.vb as the script action from an event

              Code:
              Sub Main(parm as Object)
              Dim pi
              Dim p
              Dim s
              
               pi = hs.GetPluginsEx()
              
              For Each p In pi
                  s = p.name
                  if s = "mcsXap" then
                      hs.WriteLog("Sending",  s)
              	p.SendXapMessage("","my.class","my.section","my" & chr(1) & "data","","")
                  End if
               Next
              
              Dim xap
              xap = hs.Plugin("mcsXap").SendXapMessage("","my.xAPclass","my.section","my" & chr(1) & "data","","")
              
              end Sub
              Code:
              xap-header
              {
              v=13
              hop=1
              uid=FF.000E:0000
              class=my.class
              source=mcs.Xap.MCS5
              }
              my.section
              {
              my=data
              }
              
              
              xap-header
              {
              v=13
              hop=1
              uid=FF.000E:0000
              class=my.xAPclass
              source=mcs.Xap.MCS5
              }
              my.section
              {
              my=data
              }

              Comment


              • #8
                Thanks Michael that works but I need to have two lines of data Name & phone how would I update the script to accommodate that?

                I tried this but no luck
                p.SendXapMessage("","my.class","my.section","my" & chr(1) & "data","","","my2" & chr(1) & "data2","","")

                Below is what I am trying to end up with

                xap-header
                {
                v=13
                hop=1
                uid=FF.000E:0000
                class=cid.incoming
                source=mcs.Xap.lexington
                }
                CID.Incoming
                {
                Name=Paul (pcs)
                phone=261293042
                }
                Last edited by HomeTech; November 26th, 2013, 06:49 AM.
                HS2 Environment
                Zotac 1.83 GHz Quadcore
                HomeSeer Way2Call
                Netiom-Xap board
                opnode 1-wire 1.2.7
                Plug-In's
                WeatherXML 1.0.0.32
                Pwr Link USB 1.0.0.13
                mcsTemp V6.2.0.14
                mcsXap V3.0.0.0/3.0.0.20
                IM Connector 4.87.2.5
                Sip Connector 2.56.2.4
                RFXCOM 15.0.0.22
                Odroid X2
                Asterisk 11.5.1
                FreePBX 2.11.0.42
                WebMin 1.720
                Xap Switchboard by Mi4

                There is no place Like 127.0.0.1

                Comment


                • #9
                  Michael when your available could you provide me a way to have
                  two lines of data like Name= & phone= in the script xap message see post above to get a better understanding of what I am attempting.

                  I do have it working with one line of my=data just need the syntax on how to add the second line I am wanting my2=data

                  Thanks
                  HS2 Environment
                  Zotac 1.83 GHz Quadcore
                  HomeSeer Way2Call
                  Netiom-Xap board
                  opnode 1-wire 1.2.7
                  Plug-In's
                  WeatherXML 1.0.0.32
                  Pwr Link USB 1.0.0.13
                  mcsTemp V6.2.0.14
                  mcsXap V3.0.0.0/3.0.0.20
                  IM Connector 4.87.2.5
                  Sip Connector 2.56.2.4
                  RFXCOM 15.0.0.22
                  Odroid X2
                  Asterisk 11.5.1
                  FreePBX 2.11.0.42
                  WebMin 1.720
                  Xap Switchboard by Mi4

                  There is no place Like 127.0.0.1

                  Comment


                  • #10
                    chr(0) is used for the line break. In your body string you will have two chr(1) for the equal sign and one chr(0) for the line break.

                    Comment


                    • #11
                      Thats what I needed here is the line:

                      hs.Plugin("mcsXap").SendXapMessage("","cid.incoming","CID.In coming","Name" & chr(1) & callname & chr(0)& "phone" & chr(1) & callnmbr,"","")


                      Thank you Michael !
                      HS2 Environment
                      Zotac 1.83 GHz Quadcore
                      HomeSeer Way2Call
                      Netiom-Xap board
                      opnode 1-wire 1.2.7
                      Plug-In's
                      WeatherXML 1.0.0.32
                      Pwr Link USB 1.0.0.13
                      mcsTemp V6.2.0.14
                      mcsXap V3.0.0.0/3.0.0.20
                      IM Connector 4.87.2.5
                      Sip Connector 2.56.2.4
                      RFXCOM 15.0.0.22
                      Odroid X2
                      Asterisk 11.5.1
                      FreePBX 2.11.0.42
                      WebMin 1.720
                      Xap Switchboard by Mi4

                      There is no place Like 127.0.0.1

                      Comment


                      • #12
                        HS3 Script call

                        Hi Michael,

                        I'm trying to write a script for HS3 to xap messages and found your example above. But I' can't get it to work in HS3.

                        I have come up with:

                        Sub Main(ByVal Parms As Object)

                        Dim xap
                        xap = hs.PluginFunction("mcsXap", "", "SendXapMessage", {"","my.xAPclass","my.section","my" & chr(1) & "data","",""})

                        end Sub
                        But I get an error:

                        PluginFunction Method SendXapMessage does not exist in this plugin.

                        Can you provide some help on scripting for HS3?

                        Thanks, Marty.
                        iCore5 Win 10 Pro x64 SSD

                        HS3 Pro Edition 3.0.0.435 Windows

                        BLOccupied:,Device History:,Yamaha:,UltraMon3:,mcsXap:,Restart:,UltraNetatmo3:, UltraM1G3:,Ultra1Wire3:,BLBackup:,Harmony Hub:,DoorBird:,UltraECM3:,Nanoleaf 3P:,UltraRachio3:,Z-Wave:,SDJ-Health:,BLGarbage:,Blue-Iris:,Chromecast:,Pushover 3P:,EasyTrigger:

                        Comment


                        • #13
                          xAP Caller ID schema

                          Hi,

                          Just a plea really - if you do implement one of the officially published xAP schema then do ensure it complies with the schema definition - otherwise it can causes support issues down the line. There's 4 mandatory parameters + the optional Name= , even if you had to kludge this with hardcoded values it helps a lot.

                          Yeah .. I know if it's for your own use then this shouldn't really be a problem but these things have a habit of escaping or you may later expect your code to work with someone else's published app e.g. with xAP Switchboard (the call logger that I still use 24/7).

                          Or alternatively you can just use a different class name to the officially published one and all will be well something like class=TelCall.incoming .


                          The xAP CallerID schema definition


                          CID.Incoming
                          {
                          Type=[Voice | Ringback | MessageWaiting]
                          --- Mandatory call type
                          DateTime=YYYYMMDDHHMMSS
                          --- Mandatory
                          Phone=01234567890
                          --- Mandatory
                          RNNumber=[Available | Unavailable | Withheld]
                          --- Mandatory (Reason No Number)
                          Formatted_Date=22 January 2003
                          --- Optional
                          Formatted_Time=21:27:00
                          --- Optional
                          Name=["Calling Line Name" | INTERNATIONAL | PAYPHONE]
                          --- Optional (not currently supported so will mostly be blank)
                          RNName=[Available | Unavailable | Withheld]
                          --- Optional (Reason No Name)
                          }

                          edit: Just noticed this original post was 3 years ago...
                          Last edited by CouchPotatoe; September 8th, 2016, 05:51 AM.

                          Comment


                          • #14
                            I'm not very good at scripting but am trying to send commands to my webcontrol boards.
                            I know I can use HS devices to do this but it uses CAPI commands and I am getting multiple scripts running despite using the 'wait for script to finish' and ' allow single instance' options. Not sure why this is happening. So I thought I would try xap Script commands.

                            Any help with the plugin syntax would be appreciated.

                            Marty
                            iCore5 Win 10 Pro x64 SSD

                            HS3 Pro Edition 3.0.0.435 Windows

                            BLOccupied:,Device History:,Yamaha:,UltraMon3:,mcsXap:,Restart:,UltraNetatmo3:, UltraM1G3:,Ultra1Wire3:,BLBackup:,Harmony Hub:,DoorBird:,UltraECM3:,Nanoleaf 3P:,UltraRachio3:,Z-Wave:,SDJ-Health:,BLGarbage:,Blue-Iris:,Chromecast:,Pushover 3P:,EasyTrigger:

                            Comment


                            • #15
                              With HS3 there were no plugin functions exposed. The paradymn is that events are used to achieve the desired objectives. There is an event action to send xap message. In essence you use xAP Message Viewer to create a message and save it to a file. This file is then used in the event action. Will this work for you?

                              I could expose the SendXapMessage function. What I saw in the HS3 SDK is the following to access a plugin's procedure. There may also be the method that you showed, but right now there is no scripting interface for any internal functions of mcsXap.

                              Code:
                                  Private Sub AccessPlugin()
                                  Dim pa As New PluginAccess(hs, "ZWave","")
                                  If pa.Connected Then
                                      hs.WriteLog(IFACE_NAME, "Connected to plugin ZWave")
                                      hs.WriteLog(IFACE_NAME, "Interface name: " & pa.Name & " Interface status: " &
                              pa.InterfaceStatus.intStatus.ToString)
                                  Else
                                      hs.WriteLog(IFACE_NAME, "Could not connect to plugin ZWave,is it running?")
                                  End If
                              End Sub

                              Comment

                              Working...
                              X