more G-Labs products

Author Topic: Insteon - Cannot discovery any device  (Read 1514 times)

February 24, 2015, 12:02:57 AM
Read 1514 times

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I am moving away from mControl (emmbededautomation.com).

When trying to connect my Insteon to HomeGenie, the discovery returns NO devices.

Please help.

February 24, 2015, 07:45:32 AM
Reply #1

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I created this program:
            var plm = new Plm("COM3");
            plm.OnError += OnError;
            var info = plm.GetInfo();
            Console.WriteLine(string.Format("Device Category: {0} Subcategory: {1} Firmware: {2}", info.DeviceCategory, info.DeviceSubcategory, info.FirmwareVersion));
            var database = plm.GetAllLinkDatabase();
            foreach (var record in database.Records)
            {
                Console.WriteLine(string.Format("DeviceId: {0}, IsMaster {1}", record.DeviceId, record.PlmIsMaster));
                DeviceBase device;
                if (plm.Network.TryConnectToDevice(record.DeviceId, out device))
                {
                    Console.WriteLine(string.Format("    Device Category: {0} Subcategory: {1} Firmware: {2}", device.DeviceCategory, device.DeviceSubcategory));
                }
                else
                {
                    Console.WriteLine(string.Format("    Device did not responded"));
                }
            }

This is the output I get:

Device Category: Network Bridges Subcategory: PowerLinc - USB (Dual Band) [2413U] Firmware: 146
DeviceId: 25.BC.0F, IsMaster True
System.TimeoutException: Timeout waiting for receipt of data.
   at SoapBox.FluentDwelling.SerialPortController.waitForMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.SerialPortController.<>c__DisplayClass4.<GetIncomingMessageOfType>b__5()
   at SoapBox.FluentDwelling.SerialPortController.serialPortTransaction(Action action)
   at SoapBox.FluentDwelling.SerialPortController.GetIncomingMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.waitForStandardMessageFrom(DeviceId peerAddress)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessageAndWait4Response(DeviceId toAddress, Byte flags, Byte command1, Byte comman
d2)
   at SoapBox.FluentDwelling.PlmNetwork.<>c__DisplayClass2.<TryConnectToDevice>b__3()
   at SoapBox.FluentDwelling.PlmCommunicatorBase.exceptionHandler(Action action)
    Device did not responded
DeviceId: 25.BD.83, IsMaster True
System.TimeoutException: Timeout waiting for receipt of data.
   at SoapBox.FluentDwelling.SerialPortController.waitForMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.SerialPortController.<>c__DisplayClass4.<GetIncomingMessageOfType>b__5()
   at SoapBox.FluentDwelling.SerialPortController.serialPortTransaction(Action action)
   at SoapBox.FluentDwelling.SerialPortController.GetIncomingMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.waitForStandardMessageFrom(DeviceId peerAddress)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessageAndWait4Response(DeviceId toAddress, Byte flags, Byte command1, Byte comman
d2)
   at SoapBox.FluentDwelling.PlmNetwork.<>c__DisplayClass2.<TryConnectToDevice>b__3()
   at SoapBox.FluentDwelling.PlmCommunicatorBase.exceptionHandler(Action action)
    Device did not responded
DeviceId: 25.BF.1C, IsMaster True
System.TimeoutException: Timeout waiting for receipt of data.
   at SoapBox.FluentDwelling.SerialPortController.waitForMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.SerialPortController.<>c__DisplayClass4.<GetIncomingMessageOfType>b__5()
   at SoapBox.FluentDwelling.SerialPortController.serialPortTransaction(Action action)
   at SoapBox.FluentDwelling.SerialPortController.GetIncomingMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.waitForStandardMessageFrom(DeviceId peerAddress)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessageAndWait4Response(DeviceId toAddress, Byte flags, Byte command1, Byte comman
d2)
   at SoapBox.FluentDwelling.PlmNetwork.<>c__DisplayClass2.<TryConnectToDevice>b__3()
   at SoapBox.FluentDwelling.PlmCommunicatorBase.exceptionHandler(Action action)
    Device did not responded
DeviceId: 16.55.6A, IsMaster True
System.TimeoutException: Timeout waiting for receipt of data.
   at SoapBox.FluentDwelling.SerialPortController.waitForMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.SerialPortController.<>c__DisplayClass0.<SendReceive>b__1()
   at SoapBox.FluentDwelling.SerialPortController.serialPortTransaction(Action action)
   at SoapBox.FluentDwelling.SerialPortController.SendReceive(Byte[] send, Int32 receiveLength)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendCommandWithEchoReturnAck(Byte[] send)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendCommandWithEchoAndAck(Byte[] send)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessage(DeviceId toAddress, Byte flags, Byte command1, Byte command2)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessageAndWait4Response(DeviceId toAddress, Byte flags, Byte command1, Byte comman
d2)
   at SoapBox.FluentDwelling.PlmNetwork.<>c__DisplayClass2.<TryConnectToDevice>b__3()
   at SoapBox.FluentDwelling.PlmCommunicatorBase.exceptionHandler(Action action)
    Device did not responded
DeviceId: 16.55.6A, IsMaster True
System.TimeoutException: Timeout waiting for receipt of data.
   at SoapBox.FluentDwelling.SerialPortController.waitForMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.SerialPortController.<>c__DisplayClass4.<GetIncomingMessageOfType>b__5()
   at SoapBox.FluentDwelling.SerialPortController.serialPortTransaction(Action action)
   at SoapBox.FluentDwelling.SerialPortController.GetIncomingMessageOfType(Byte[] messageTypes)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.waitForStandardMessageFrom(DeviceId peerAddress)
   at SoapBox.FluentDwelling.PlmCommunicatorBase.sendStandardLengthMessageAndWait4Response(DeviceId toAddress, Byte flags, Byte command1, Byte comman
d2)
   at SoapBox.FluentDwelling.PlmNetwork.<>c__DisplayClass2.<TryConnectToDevice>b__3()
   at SoapBox.FluentDwelling.PlmCommunicatorBase.exceptionHandler(Action action)
    Device did not responded

February 25, 2015, 07:48:33 AM
Reply #2

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
When running HomeGenie from the console, I read this:
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Object reference not set to an instance of an object.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.
PLM ERROR: Access to the port 'COM3' is denied.

February 25, 2015, 08:18:16 AM
Reply #3

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
It seems that HomeGenie.exe itself have the port opened.

How could this be?

Investigating more...

March 02, 2015, 01:06:19 AM
Reply #4

ocalvo

  • *
  • Information
  • Newbie
  • Posts: 10
I have fixed the problem and now I can now discover Insteon devices.

The problem is that in my case, my insteon network have some devices that are timing out during discovery. When this happens the error handler will disconnect the port, however the listener thread is also trying to access the port and it also starts to fail and then we have the main thread and the listener thread both trying to close and re open the port.
The fix I made is to suspend and resume gracefully the listener thread during device discovery.

I created this pull request to fix the problem:
https://github.com/genielabs/HomeGenie/pull/141