I have a cheap relays module with ModBus support integrated. I`ve tested it with my debug scripts and it works well. Here is my short manual about it: link (russian lang). Relays on this card could not be accessed as coils and another scheme used instead.
For example if i need to enable relay number 2 i should write value 0x0200 to holding register 2, and i should write 0x0100 if it need to be changed back to open state.
My question is: how to use such kind of control scheme as reular Switch item if it is possible? I have a led lamp connected to such board and i need to enable and disable it with some schedule or manually.
Thanks!
I`m not experienced with modbus and OH at a moment but i will try to understand how to use it. I will post results there.
Thanks again for your response !
Seems i not enough experienced yet (in OH configuration mostly) to understand how to bind different modbus commands (and may be check its state) for Switch item. Ive trying to build vegitables micro-farm in own room and this relay module should be used for activation/deactivation of light and water pump. It was mounted before i`ve found OH.
This line will write to holding register 2 (with index 1 in my modbus definition) on device slave2 numerical values 256 (0x0100) to switch relay to Closed state and 512 (0x0200) backwise as described in device documentation.
Note, that you should upgrade modbus binding in order to enable transformation functionality.
I have the same relay board. I want to controll my roller shutter with it. In my Installation I would like to have 2 relays to control 1 roller shutter. So one is for up and one for down. So I could define 2 relays like that:
If I have my item defined as follows:
Switch Relay1 “Relay1” (ALL) {modbus=“slave1:1”}
and the modbus (sniffed on bus) has the expected telegram.
But for the relay card I need to have a transformation from 1 to 0100 and from 0 to 0200. Therefore I added the following:
Switch Relay1 “Relay1” (ALL) {modbus=">[slave1:1:trigger=*,transformation=256],>[slave1:1:trigger=0,transformation=512]"}
Unfortunately after that change I have no telegram on bus.
What I am doing wrong?
Do I need to install anything, that this transformation works?
You need the 1.10.0-SNAPSHOT as indicated in the docs. Transformation was introduced there. You should find installation instructions somewhere from here.
If you have that version already, it might be worthwhile to check logs for any errors