hello,
I have just started with openHab and thought I might set up a switch that used modbus on an Arduino. The Arduino is connected to a linux machine via a CP2102 USB to UART bridge.
So in my openhab.cfg I have:
modbus:poll=2000
#modbus:serial.slaveSystem.connection=:::::
modbus:serial.slave1.connection=/dev/ttyUSB0:9600:8:even:1:rtu
modbus:serial.slave1.type=coil
modbus:serial.slave1.id=10
modbus:serial.slave1.start=0
modbus:serial.slave1.length=12
modbus:serial.slave1.valuetype=bit
and in items.cfg the line
Switch MySwitch “My Modbus Switch” (GF_Arduino) {modbus=“slave1:7”}
defines the switch.
The server runs as the user openhab that is in the dialout (and lock) groups.
In the debug log I have lines like these about modbus
14:06:40.083 [DEBUG] [o.b.m.internal.ModbusActivator:30 ] - Modbus binding has been started.
14:06:40.086 [DEBUG] [i.internal.GenericItemProvider:341 ] - Start processing binding configuration of Item ‘MySwitch (Type=SwitchItem, State=Uninitialized)’ with ‘ModbusGenericBindingProvider’ reader.
14:06:40.103 [DEBUG] [.modbus.internal.ModbusBinding:282 ] - modbusSlave ‘slave1’ instanciated
14:06:40.103 [DEBUG] [b.m.internal.ModbusSerialSlave:41 ] - overriding modbus port: null by: /dev/ttyUSB0but there is currently only one port supported
14:06:40.104 [DEBUG] [.modbus.internal.ModbusBinding:344 ] - config looked good, proceeding with slave-connections
14:06:40.107 [DEBUG] [b.m.internal.ModbusSerialSlave:117 ] - connection was null, going to create a new one
I can see events like these in the event.log
2016-01-07 15:13:37 - MySwitch received command OFF
2016-01-07 15:13:38 - MySwitch received command ON
2016-01-07 15:13:40 - MySwitch received command OFF
2016-01-07 15:13:41 - MySwitch received command ON
The LED I have plugged in there never goes on or off.
But the thing is, I never see any indication that there is any communication between the linux machine and the CP2102 (Rx or TX leds) and wonder if I am missing something.
Suggestions would be most welcome.