OpenHab + Insteon - ISY i994

What information should I provide? I checked the “insteon-terminal.log” but it stays empty. How do I enable logging?

@Bernd_Pfrommer, some more info below.

init.py file contents:

from console_commands import *
from keypad2487S import *
from thermostat2441TH import *
from modem2413U import *
from switch2477S import *
from dimmer2477D import *
from ledBulb2672 import *

modem = Modem2413U("tesmt_modem", "41.ec.8e")
light = Switch2477S("BackYardLight", "29.5a.75")

Console Output:
$ ./insteon-terminal
Insteon Terminal
Terminal ready!

light.on()
Traceback (most recent call last):
File “”, line 1, in
File “python/light.py”, line 46, in on
iofun.writeMsg(message.createStdMsg(
File “python/iofun.py”, line 77, in writeMsg
console.writeMsg(msg)
at us.pfrommer.insteon.terminal.IOFun.writeMsg(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
java.io.IOException: java.io.IOException: Not connected

The errror message indicates that you are not connected. Connected to what? Are you using a Insteon Hub or a PLM modem? You need to specify one or the other, and properly configure your init.py, see instructions there.

#
# uncomment correct line, depending on if you have a PLM modem or a hub (or a legacy hub)
# to automatically connect on startup. You will also have to change the info in the corresponding connectToMy...() function
#
#connectToMySerial()
#connectToMyHub()
#connectToMyLegacyHub()

You need to uncomment one of them, most likely connectToMySerial(), but then you also need to define connectToMySerial correctly, for instance with the proper device instead of /dev/insteon (maybe your serial port is at /dev/ttyUSB0 if you are on a linux machine).

def connectToMySerial():
    """connects to my modem on pre-defined serial port"""
    connectToSerial("/dev/insteon")

And while we are at it: what OS are you running on, Linux or Windows?

The reason I didnt use the “connectToSerial” is I thought its needed only for the case of Serial PLM modem and not hte USB PLM modem.

I’m running the terminal on RPI, the image from OpenHAB. “Linux openHABianPi 4.4.0-1-rpi2 #1 SMP Debian 4.4.6-1+rpi14 (2016-05-05) armv7l GNU/Linux”

I’ve changed the code to connect to /dev/ttyUSB0. Now I get another exception:

Insteon Terminal
Connecting
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Failed to initialize python interpreter: 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./init.py", line 15, in <module>
    connectToMySerial()
  File "./init.py", line 13, in connectToMySerial
    connectToSerial("/dev/ttyUSB0")
  File "python/console_commands.py", line 93, in connectToSerial
    iofun.connectToSerial(dev)
  File "python/console_commands.py", line 93, in connectToSerial
    iofun.connectToSerial(dev)
  File "python/iofun.py", line 64, in connectToSerial
    console.connectToSerial(dev)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
	at us.pfrommer.insteon.msg.serial.SerialIOStream.open(Unknown Source)
	at us.pfrommer.insteon.msg.IOPort.open(Unknown Source)
	at us.pfrommer.insteon.terminal.IOFun.updatePort(Unknown Source)
	at us.pfrommer.insteon.terminal.IOFun.connectToSerial(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
>>>

@Bernd_Pfrommer, I noticed in another thread you suggested to modify LD_LIBRARY_PATH to include the jni path. I tried that but it didn’t help, any other paths I need to include?

Tried this:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jni/
$ echo $LD_LIBRARY_PATH
:/usr/lib/jni/

The contents of the directory:

$ ls -la /usr/lib/jni
total 136
drwxr-xr-x  2 root root  4096 Mar  9 08:33 .
drwxr-xr-x 43 root root  4096 Mar  9 08:33 ..
-rw-r--r--  1 root root 17908 Jul 26  2014 librxtxI2C-2.2pre1.so
lrwxrwxrwx  1 root root    21 Jul 26  2014 librxtxI2C.so -> librxtxI2C-2.2pre1.so
-rw-r--r--  1 root root 13764 Jul 26  2014 librxtxParallel-2.2pre1.so
lrwxrwxrwx  1 root root    26 Jul 26  2014 librxtxParallel.so -> librxtxParallel-2.2pre1.so
-rw-r--r--  1 root root 17924 Jul 26  2014 librxtxRaw-2.2pre1.so
lrwxrwxrwx  1 root root    21 Jul 26  2014 librxtxRaw.so -> librxtxRaw-2.2pre1.so
-rw-r--r--  1 root root 17912 Jul 26  2014 librxtxRS485-2.2pre1.so
lrwxrwxrwx  1 root root    23 Jul 26  2014 librxtxRS485.so -> librxtxRS485-2.2pre1.so
-rw-r--r--  1 root root 51052 Jul 26  2014 librxtxSerial-2.2pre1.so
lrwxrwxrwx  1 root root    24 Jul 26  2014 librxtxSerial.so -> librxtxSerial-2.2pre1.so

You may have to make a soft link in the right place. This is probably the
trickiest part: getting the java serial support working. I don’t have a PI,
just google it and try around until you find a solution. It is workable.
Maybe open another thread on the forum.

@Bernd_Pfrommer, I’ve got it working by editing insteon-terminal script the following way:

java -Djava.library.path=/usr/lib/jni -cp "${path}" us.pfrommer.insteon.terminal.Main "$@"

I’m getting some warning messages, should I worry about them? How to fix or suppress them?

22:54:34.892 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - got unknown command code 00
22:54:34.898 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
22:54:38.760 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - got unknown command code 5A
22:54:38.764 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
22:54:38.768 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02 

My last question would be regarding binding devices to the PLM modem. Is it possible to do programmatically by providing device addresses? I would appreciate an example. Thanks!

Do you only get the error messages on start-up, just a few? That’s ok. You should not get them during regular operation.
Can you read the modem db etc?

I have had mixed luck trying to link devices to the modem completely programmatically. I usually establish the first link with the buttons, then the additional links (most devices actually don’t need any) with the insteonterminal.

Actually I get the errors upon every action and notification. The modem db does not work as well.

Insteon Terminal
Connecting
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
Connected
Terminal ready!
>>> modem.printdb()
>>> modem.getdb()
23:45:48.724 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:46:00.088 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:46:00.091 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:46:00.390 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:46:00.397 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:47:40.107 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - got unknown command code 00
23:47:40.111 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:47:40.402 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:47:40.405 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:47:40.408 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02
23:47:40.412 [Thread-3] WARN  us.pfrommer.insteon.msg.MsgReader - incoming message does not start with 0x02

Could be a speed mismatch of some sort. And this is a standard PLM
connected via USB? Maybe a bad cable, but unlikely. Very strange…

I think the cable is ok. Its a regular cable, no extension used. Works well with the HouseLinc and OpenHAB.

The last thing to get his working is to bind 30+ devices. Just trying to find the best way to do that.

I don’t understand how the serial link would give you garble messages under
insteonterminal, but not in openhab. Did you specify the correct
/dev/ttyUSBx or /dev/ttyACMx ? Maybe you are connecting to another usb
serial terminal?

Yes, I used “/dev/ttyUSB0” for inteon-terminal and openhab as well. It it was a wrong device I would not be able to use it in the first place. I can turn on or off the switches, but query of the database does not work.