Announcement

Collapse
No announcement yet.

.NET xAP Plugin

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

    .NET xAP Plugin

    I have a .NET version of mcsXap plugin with which I ran the xAP Stress script as a benchmark. The CPU utilization was under 1% vs. the 75% when running through hs_compatibility. The prior test results were posted at http://board.homeseer.com/showthread.php?t=118266.

    If anyone has concerns about xAP impact on the CPU and wants to use an alpha level plugin then I'll make it available.

    #2
    Michael,

    I have a Netiom-xAP which send out frequent status updates on > 100 variables every few seconds and it pegs my CPU. I would like to try the .NET version and see if it helps.

    Comment


      #3
      I'm new at this .NET development so I'm not ceratain how many of the files you actually need. I suspect only dll's, but I included the full binary output

      In my case I did the development on a Vista PC with a fresh HS2 install. I put the files in the zip container into the Homeseer 2 folder. I suspect you will need to move hspi_mcsXap.ocx out of the Homeseer 2 folder otherwise you will have 2 mcsXap plugins.

      My testing so far has shown that I am able to use the browser setup to change settings and Accept xAP messages and observe that the accepted message is updated in HS device.

      The primary files that you will want to backup are the mcsXap.mdb database that contains the message information and mcsXap.ini that contains the setup settings.

      Most of my conversion effort has been with recoding of the Winsock control to use .NET libraries. I started with an internet download called Winsock2007 to give me a structure and then implemented the UDP broadcast and multi-NIC needed to support mcsXap. I have not done anything yet about the interopt with the existing ADO-related database libraries or the Scripting libraries.
      Last edited by Michael McSharry; August 6, 2007, 12:06 AM.

      Comment


        #4
        I receive the following error message when the plugin launches:

        6/4/2007 6:17:07 PM - mcsXap - AddtoBSCSendDB Line 210 Conversion from string "" to type 'Integer' is not valid.

        and several others following like:

        6/4/2007 6:17:07 PM - mcsXap - AddtoBSCSendDB Line 210 Conversion from string "" to type 'Integer' is not valid.

        Comment


          #5
          This is an outbound setup and I had only tested inbound. It was an easy fix and I reposted the files at the same location. I did not have any BSC outputs, but I did evaluate X10 output and it was working so the BSC out should work as well.

          Comment


            #6
            The plugin seems to be working well so far. I had to reduce the messages coming from the Netiom-xAP because the were excessive. It was sending xAP messages several times per second and I did not need that type or refresh rate. It caused Homeseer.exe to use nearly 500MB or ram at times and xAP reception eventually stopped working without error messages. Since scaling back the refresh rate to a reasonable rate, everything is working well. CPU usage is not excessive and hs_compatibility.exe is using next to no CPU.

            Comment


              #7
              The xapStress.vbs that I used to benchmark was sending 10 messages per second and it increased the HS 2 memory from 9.7M to 10.5M and the HS cpu remained at 0 when viewing from Task Manager. This is on a 2.6GHz 1G Ram, Vista that has a very small HS install of no events, no other plugins, and around 20 devices.

              When I change the message rate to 100 messages per second HS CPU goes to 20% and RAM increases to 12M. It does not continue to grow, but remains steady while it is being hit with the xAP firehose. I suspect as the HS install becomes larger it takes longer and longer for it to be able to sevice device status updates. This is especially true if there is a list of events that are triggered by device status changes. My guess is that the RAM growth is due to the pending action queue getting larger and larger as it is not able to keep up in real time.

              Comment


                #8
                I lost a few devices today and I am not sure why. All I could find in my logs was:

                6/9/2007 9:08:38 PM - mcsXap - ActOnOthers Line 110 Index was outside the bounds of the array.

                and

                6/9/2007 9:09:23 PM - mcsXap - BackupDB Line 290 You attempted to open a database that is already opened exclusively by user 'Admin' on machine 'HOMEAUTOMATION'. Try again when the database is available.

                This errors persited after shutting down HS/restarting. I started again with the OCX version, and these errors went away.

                Comment


                  #9
                  I had fixed the BackupDB error as I progressed with further migration using more native .NET functions.
                  I had never seen the ActOnOther message before so I added more visibiltiy into the subscripts being used in the line where you had an error.

                  10 backups are maintained so if you loose information you have the option of using the prior dated mcsXap.mdb. My environment is just one for testing so it does not stress it as much as you likely are. I have not seen any missing devices, but I do not have very many.
                  Last edited by Michael McSharry; August 6, 2007, 12:06 AM.

                  Comment


                    #10
                    I'm trying it out, and so far so good. I can see a noticeable drop in HS2 and hs_compatibility CPU utilization. I am only using inbound at this point (remote 1wire and local rfxcom).

                    Bill

                    Comment


                      #11
                      Thanks Bill.

                      The first posted was an automated conversion followed by Winsock recoded to .NET sockets.

                      The second posted version extends the first with ADO converted to ADO.NET, FileSystemObject to System.IO and fixed a few things that I saw during my testing.

                      I still have ADOX, JRO, and Scripting.Dictionary as COM. I was going to convert the Dictionary, but I think I will just leave it alone as the Dictionary is a heavily used object that benchmarked very well in performance tests and I will not be able to achieve 100% managed code because of ADOX and JRO.

                      My HS2 license is just used for development testing with HS1 deployed 24/7. Since .NET if for HS2-only I do not have the opportunity to observe long term behaviors or unexpected real control actions associated with mcsXap. For me the .NET conversion was done as a learning experience and a desire to assess the CPU load without the hs_compatibility involved. Brave souls like Madmax and you will determine if the .NET version is really usable.

                      Comment


                        #12
                        the plugin seems to be working ok getting the messages into HS, but I get a bunch of errors showing in the HS log.

                        <TABLE cellSpacing=2 cellPadding=0 width="100%" border=0><TBODY><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:11:05 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Line 240 Object reference not set to an instance of an object.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:11:05 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Line 230 Object reference not set to an instance of an object.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:11:04 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>BuildSection 0 |State=ON|Text=Hot|Name=Temp Alert|Location=Display| Line 50 This key is already associated with an element of this collection.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:11:04 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:11:02 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>GetPluginTriggers Line 510 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:11:00 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:10:57 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Line 250 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:10:57 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>BuildSection 0 |Location=xapmcs1wire|Name=OAH|Code=[10|Type=Humidity|Status=69|OldStatus=69|Value=68|OldValue=69 |Extra=4,10,[,17,,,| Line 50 Object reference not set to an instance of an object.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:10:48 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:10:47 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 490 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 11:10:47 AM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>BuildSection 0 |State=OFF|Name=test jig|Location=xapmcs1wire| Line 50 Object reference not set to an instance of an object.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 11:10:47 AM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Line 230 Object reference not set to an instance of an object.</TD></TR></TBODY></TABLE>

                        Comment


                          #13
                          These look like reentrancy issues which did not exists under VB6, but now with the new way of handling sockets for incoming traffic I see that it is possible. I suspect your xAP traffic is heavier than mine and that may be why you are seeing it and I did not. A little redesign in this area
                          Last edited by Michael McSharry; August 6, 2007, 12:07 AM.

                          Comment


                            #14
                            Yes, my xap message traffic is fairly high.
                            Seems like fewer errors but still getting some.

                            <TABLE cellSpacing=2 cellPadding=0 width="100%" border=0><TBODY><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:06:17 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:06:15 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:06:15 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:06:10 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:05:05 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:05:04 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:05:00 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:05:00 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 400 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:04:56 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:04:55 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:04:52 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 400 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:04:37 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>GetPluginTriggers Line 480 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:04:37 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:04:17 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>6/11/2007 7:03:53 PM </TD><TD class=LOGType0 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry0 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 350 Index was outside the bounds of the array.</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left>6/11/2007 7:03:26 PM </TD><TD class=LOGType1 align=left colSpan=3>mcsXap </TD><TD class=LOGEntry1 align=left colSpan=8>ActOnMessageForTrigger Section=1, Ubound=0 Line 350 Index was outside the bounds of the array.</TD></TR></TBODY></TABLE>

                            Comment


                              #15
                              Different area with a different issue of handling the HS event enumeration which should have existed with the VB6 version, but must of been masked due to the one-message-at-a-time nature of VB6. Should be taken care of in http://mcsSprinklers.com/mcsXapNet_V4.zip.

                              I learned the hard way when testing the event trigger about how HS2 disables newly created events. Lots of wasted time trying to debug what looked like a problem with the plugin with the callback.

                              Comment

                              Working...
                              X