I’m new to openhab and one of the first things I’m trying to do is send a string from a raspberry pi 4 running openhabian 3 to an arduino using the serial binding. I’ve spent days researching the serial binding and I just cant get it to work.
Here is the serial bridge thing I created:
Bridge serial:serialBridge:sensors [serialPort="/dev/ttyUSB1", baudRate=9600] {
Channels:
Type string : control []
}
In the serial bindings docs it says if I send a string to the string channel in the serial bridge it will send that data to the serial port, but it wont work.
Does your rule trigger at all? Check the log to see if your item actually changes state
maybe add a log statement to your rule to read out what gets returned
How are you viewing the state of your item? In the user interface? sitemap?
2021-09-01 01:27:34.273 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘WL’ received command 214,29,89
2021-09-01 01:27:34.279 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘WL’ changed from 173,29,89 to 214,29,89
2021-09-01 01:27:34.360 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘deviceControl’ received command hi
2021-09-01 01:27:34.363 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘deviceControl’ predicted to become hi
the rule is working and properly sending the command to the item but nothing gets sent through the serial port. I made sure the serial port was working by sending:
echo -e “hi\n”>> /dev ttyUSB1
in the terminal window and it triggered the arduino and was registered in the log as:
2021-09-01 01:30:06.088 [INFO ] [openhab.event.ChannelTriggeredEvent ] - serial:serialBridge:sensors:data triggered PRESSED
Is this a rules file or is the rule entered via the OH UI ?
In an other thread one member used the UI and observed that the plug didn’t changed it’s state.
End of the story was that it looked like the UI escaped the \ other than expected but the rule is working fine from a rules file.