I’m starting developing a binding for a Baytech RPC3-NC, basically a smart pdu with telnet access to turn on/off the different sockets (8 in total) and also get some infos (Power, Current and Voltage).
I have the logic to connect to the device, get the status and also turning on/off the sockets.
Problem, the device only allow one telnet connection at time. The next one would only get a menu without access to the cli. So if the status refresh is too frequent, it’s possible to have two connections at once and have the problem.
So the idea would be to have the telnet session always opened between the OpenHab server and the binding, and then use some type command queueing to get status or send on/off command.
Or at least disconnect when the command queue is empty.
Does anyone has some example of code that would do something like that ?
Thanks a lot
I recently undertook a similar effort to develop a binding for the LiteTouch control system installed in my house. The interface to the LiteTouch controller is via a serial communications port, to which I have connected a terminal server that supports only one TCP/IP telnet session at a time.
I found the lutron binding to be very helpful as an example for my binding development effort.
Best of luck!
So far I changed my logic to add the commands to a FIFO queue and then check the queue every second and run the commands in queue until empty.
Like that, only one session.
I’ll check the lutron implementation.
new to OH here and have similar interest in controlling Baytech RPCs (I have an RPC-5 and one that is serial-only). Did you ever get this going?
FYI, I’ve used a Linux package called ‘powerman’ (http://powerman.sourceforge.net/) to control the Baytechs.
I’m totally unfamiliar with the OH plug-in architecture, but It might make life easier to run the powerman daemon on Linux and just talk to the daemon instead of the RPC itself. One big advantage is that powerman has a pretty broad library for controlling legacy IT-type remote power controllers and it’s scriptable to handle other serial and network devices.
In any case, I hope this isn’t a community that gets upset by people reviving old threads … given the persistence of internet forums and how useful the discussions can be even years after the fact, I never understand this POV.