I’m wondering if someone can point me in the right direction. I’m trying to get a simple way to send commands to my 1141 plcbus device. I was hoping to use the binding, but it’s not been updated to OH3 (fingers crossed it will be migrated).
Anyway, I spotted a post over on home-assitant forum that has a python script that does the following:
import serial
myser= serial.Serial('/dev/ttyUSB1',9600)
frame="0205D11722000003"
message_bytes = bytes.fromhex(frame)
myser.write(message_bytes)
From this I attempted to do something with the serial binding. It is connecting but nothing else. Would anyone have any advice? My dodgy code below! thanks.
plcbus.things
Bridge serial:serialBridge:plcbus [serialPort="/dev/ttyUSB2", baudRate=9600] {
Thing serialDevice devices [patternMatch=".*"] {
Channels:
Type switch : b6 [on=“0205D11722000003”, off=“0205D11723000002”]
}
}
plcbus.items
String PlcBusBinary “PlcBus [%s]” { channel=“serial:serialBridge:plcbus:binary” }
Switch TestPlcbus “test plcbus” {channel=“serial:serialDevice:plcbus:devices:b6”}