Serial Device Control

I have been trying to get Openhab to control a serial device. To control from both a button and time rule. I have not had any success yet. I’ve scowered the forums and documentation, there isn’t any thing definitive. There are bits and pieces but not everything I need to make it work.

So far I have a RS232 Insteon modem working on one port, and the Zwave/Zigbee dongle running which is via it’s usb to serial chip.

I’m using a 4 port USB to Serial device on a Raspberry Pi 3. So far it’s working with the Insteon modem on /dev/ttyUSB1

The Serial device I’m trying to control is in /dev/ttyUSB4 I can use Minicom with it just fine. Just for reference it is one of the old circuit cellar/micromint DIO boards with RS485.

I have the serial binding installed.

What I need to do is:
-How to correctly Add the device to Openhab, well set it up so I can define the actual serial strings
-How to correctly define buttons that actually work with it.
-What needs to be created in Items, Things, Sitemaps, Rules or Services.

How it needs to be controlled:

Via some sort of button in the various Openhab UI’s. It could be individual switches for the zones… but bit #8 is the pump control, but the pump must never run without one of the zones if that makes sense…

Send these commands to the sprinkler control:
! DIO0 S DP=7E and a CRLF for Zone 1
! DIO0 S DP=7D and a CRLF for Zone 2
! DIO0 S DP=7B and a CRLF for Zone 3
! DIO0 S DP=77 and a CRLF for Zone 4
! DIO0 S DP=6F and a CRLF for Zone 5
! DIO0 S DP=5F and a CRLF for Zone 6
! DIO0 S DP=3F and a CRLF for Zone 7
! DIO0 S DP=FF and a CRLF for OFF

The ultimate desire would be able to control the individual bits that make up the hex value above lines. As well as have Openhab querry the DIO device for status. That command looks like

! DIO0 Q DP and a CRLF

Generally speaking I’ve always preceded the commands to these with a CRLF and then one following the command to have the device process the command. This is a RS485 line, so it’s half duplex, so we can’t send and receive at the same time.

I’ve not found any of the documents or other posts complete enough to get this to work. Usually it’s maybe sending the commands, but I’ve seen things in both the items file and rules, but not linking all the way to the UI so I’m not sure which is the right way on this. This would apply to alot of serial devices just just this particular serial control device…

I appreciate any help on this!

The Serial Binding is a 1.x version binding so you will be doing everything through config files. See Serial - Bindings | openHAB for how to populate serial.cfg and create your Items to communicate with the device.

Realize that Serial is a very low level binding and it will be challenging to get working as a consequence.

Create Items and put them on your sitemap or UI.

It’s a 1.x version binding so there are no Things. You will need to create Items. You may need to create Rules if you can’t do everything you need in Items. I don’t use this binding so I can’t say whether you will need Rules. I suspect not.

Once you have Items then building the UI is the same no matter what binding you are using. See the Sitemap docs for how to create and work with the sitemap based UIs like BasicUI or the phone apps. See the HABPanel apps if you want to build a UI that looks a little more like the Windows 10 start menu.