Problem with modbus binding, writing to a coil

Hi all,

after running modbus for our heating controls I just tried to add Modbus control to our pool control this weekend. Managed to wire an RTU/TCP bridge in the pool controller and are able to read value with proper values.

I however do not pass the next level, that is writing back values to the control using modbus. As an example I wanted to start with a single coil that controls the relay for the illumination. What is currently not working is that the switch’s value does not seem to be processed as output command by the modbus addon. At least this is what it looks like on the openhab.log (see below for details).

thing definition

	// Output 4 (coil 0x128E), Illumination: Also just enable the manual on/off bit switch
	Bridge poller output4 "Poller - pool - domotic 2 - output 4 / illumination" [ start = 4750, length = 1, refresh = 10000, type = "coil" ] {
		Thing data Output4Switch [ readStart = "4750", readValueType = "bit", writeStart = "4750", writeValueType = "bit", writeType = "coil" ]
	}

item definition

// Relais 4 - Illumination
Switch	PoolControl_ILLUMINATION_Switch		(POOL_CONTROL) ["Point"] { channel="modbus:data:PoolControl:output4:Output4Switch:switch" }

And here the log except (openhab + events) from a point where I turned the switch to ON (I have set org.openhab.binding.modbus to loglevel DEBUG):

2024-04-09 23:01:45.601 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'PoolControl_ILLUMINATION_Switch' received command ON
2024-04-09 23:01:45.601 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'PoolControl_ILLUMINATION_Switch' predicted to become ON
2024-04-09 23:01:45.604 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'PoolControl_ILLUMINATION_Switch' updated to ON
2024-04-09 23:01:45.606 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PoolControl_ILLUMINATION_Switch' changed from OFF to ON
2024-04-09 23:01:56.600 [DEBUG] [bus.handler.ModbusPollerThingHandler] - Thing modbus:poller:PoolControl:output4 received response PollResult(result=AsyncModbusReadResult(request = ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_COILS, start=4750, length=1, maxTries=3], bits = BitArray(bits=0)))
2024-04-09 23:01:56.602 [DEBUG] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:PoolControl:output4:Output4Switch channels updated: {modbus:data:PoolControl:output4:Output4Switch:switch=OFF}. readValueType=bit, readIndex=Optional[4750] -> numeric value 0 and boolValue=false. Bits BitArray(bits=0) for request ModbusReadRequestBlueprint [slaveId=2, functionCode=READ_COILS, start=4750, length=1, maxTries=3]
2024-04-09 23:01:56.604 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'PoolControl_ILLUMINATION_Switch' updated to OFF
2024-04-09 23:01:56.606 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PoolControl_ILLUMINATION_Switch' changed from ON to OFF

Neither the light is turned on in the pool control nor the logfile is showing any log entry for the modbus component after the switch ON event at seconds :45. The next log event is really at :56 when the 10 second polling interval kicks in again. I haven’t anaylzed the source code if anything at all should be printed in the log at writing some value but I strongly guess so.

What I can also confirm is the correctness of the coil address: If I switch the illumination on manually in the pool control, the switch in openhab turns ON as well after some seconds. So it looks the wiring modbus/thing/item/UI is working correctly.

Looks like a very basic error as writing to a coil seems to a standard action for modbus. Running openhab 4.1.2, everything else of my installation is running perfectly.

Thanks a lot for helping,
Soeren