I got a “Wandisy” 16-channel modbus relay controller from Amazon. There’s essentially no documentation included with it about which functions or addresses are useful. I’m a modbus newb, but it seems like it is hooked up and receiving messages as when I change state on an OpenHAB item the thing blinks. Does anyone know a good place to look to try to figure out what the exact commands are for this thing?
I haven’t found any useful documentation yet, but I abused the transform to scan the address/value space and found that this device is using bit 16 set = “off” state, bit 17 set = “on state”, so I’m abusing the transform like this:
(function(cmd) {
parts = cmd.split("-")
var address = Number(parts[0])
var action = parts[1]
if (action == "ON") {
action = 256
} else {
action = 512
}
return JSON.stringify([{ functionCode: 6, address: address, value: [action] }])
})(input)
and it seems to do just the right thing for me. Again, new to modbus in general, and the modbus binding in particular, so there’s probably a tidier way to do it that I’m not aware of.
More googling with the actual codes (0x0100
etc) led me here: https://www.instructables.com/Arduino-Controlled-Modbus-Relay-Board/ which seems to have links to manuals for the board I have.