After having successfully tested all the serial items and rules on Windows I want to move it to openHAB running on a Linux machine.
Except the changed serial port the configuration of openHAB is the very same in Windows and Linux.
The serial device is detected in my Linux machine:
dmesg
[320913.597066] usb 1-1.2: cp210x converter now attached to ttyUSB0
Doing a cat on this device gives the expected serial data:
cat /dev/ttyUSB0
Then I checked who the device belongs to using ls -al /dev/ttyUSB0:
crw-rw---- 1 root dialout 188, 0 Mai 5 09:40 /dev/ttyUSB0
Because running openHAB as user automark I changed that:
sudo chown automark /dev/ttyUSB0
crw-rw---- 1 automark dialout 188, 0 Mai 5 09:40 /dev/ttyUSB0
Also I verified if the user automark is part of the dialout group:
groups automark.
Then reading the instructions for the serial binding I added a line to the bottom of start.sh:
... \
-console \
-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0
Now I could switch the item bound to the serial port to work with Linux (file serial.items)
// Windows
//String serialRx "Serial-Rx [%s]" <text> { serial="COM5@115200,REGEX((.*?))" }
// Linux
String serialRx "Serial-Rx [%s]" <text> { serial="/dev/ttyUSB0@115200,REGEX((.*?))" }
With this preparation I started openHAB in DEBUG mode.
There I get this:
11:25:41.817 [INFO ] [c.internal.ModelRepositoryImpl:80 ] - Loading model 'serial.items'
11:25:41.830 [DEBUG] [i.internal.GenericItemProvider:154 ] - Processing binding configs for items from model 'serial.items'
...
11:25:41.838 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model 'serial.items'
...
11:25:41.871 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model 'serial.items'
That looks OK to me even though the second line shows up several times.
But the item serialRX never gets updated.
However, the serial data still can be read using cat /dev/ttyUSB0.
Then I tried to provoke an error by changing the serial port to an invalid device. The log output show that the item file has been reloaded but still no error message like serial port could not be found.
11:39:47.709 [INFO ] [c.internal.ModelRepositoryImpl:98 ] - Refreshing model 'serial.items'
11:39:47.736 [DEBUG] [i.internal.GenericItemProvider:154 ] - Processing binding configs for items from model 'serial.items'
11:39:47.741 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model 'weather.items'
11:39:47.743 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model 'udp.items'
11:39:47.745 [DEBUG] [i.internal.GenericItemProvider:133 ] - Read items from model 'serial.items'
So this refresh also triggers the updated of other item files which are not connected to the serial item - at least not by user configurations.
The question is:
There are no errors and no data. What did I miss when changing the configuration to work with Linux?
It looks like the configuration is parsed correctly but somehow ignored.