Override sendCommand()

Hello!

I am using OH1 mainly with the binding ELKO/IHC.

The problem I have is that the ELKO controller hardware seems to have a poor TCP stack implementation.
At least that is my guess, since the controller reboots frequently if it gets flooded with binding updates. The reboots dissapears if I add a delay between every consequtive sendCommands()

My question is if someone knows a way to create a new sendCommand() which basically is the old SendCommand() but with a thread::delay added.
I guess I am looking for a way of creating a function or redefining the sendCommand

Try the jsr223 binding with jython. No problem there.

Hi
Thank you for this answer
I must admit that I cannot see right now where I can find the sendCommand() function so I can modify it.
But maybe the way forward is to create a function “mysendCommand()” with Jython?

Hi,

you can just override and inject the function as I have done (Thread here: Library for JSR223 in Jython).
But the easiest way is definitely to create a custom function:

def mysendCommand( a, b):
    time.sleep(1)
    BusEvent.sendCommand(a,b)

Great, perfect. This is exactly what I was looking for.
Thank you!!

Short question, will this simple function work in OH2?

Unfortunately not since the jsr223 has not been merged to the stable release