Wrapping an existing serial binding to a tcp binding


There is an epson projector binding that openHab already supports but expects a serial connection; this makes sense since the target uses RS-232 serial for communication. However, rather than having a computer connected to my projector, I have a an ESP8266 connected to my projector with a tx/rx to rs232 chip in between; The ESP8266 has a simple POST method that I use to send commands to/from the projector.

So, I figure the best way to attach my projector to openHab is to code out a generic tcp binding that is based off of work already done.

Before i do that though, I was wondering if there isn’t a simple way to just wrap the existing code to use tcp instead. Specifically, targeting a webapi call instead of a serial port.


If you want to connect to your ESP8266 over TCP why not use the already existing generic TCP/UDP Binding. So long as you can handle just sending/receiving Strings it should work unmodified.

If you put a webapi on the ESP8266 you can use the HTTP binding unmodified.

You don’t need to modify the Serial binding, you just need to use a different binding.


I’m working on a similar thing but I’m having trouble with the ESP code reading responses from the projector.would you be willing to share your code?

Hey Mr.,
I was trying to use TCP/UDP binding also , I can see it says commands sent by using " log:tail " via ssh to my pi3.
but the device doesn’t receive anything and do no response to my cmds.
Is there an simple example of TCP/UDP binding for beginners?

Not really because the TCP/UDP binding is not really intended for beginners. This is super low-level stuff and debugging problems like this often requires use of a sniffer and interpreting raw IP packets.