OpenHAB 3 With Broadlink Binding - Lag sending some commands - Network issues

Hello,
I wanted to share a problem that i am having with the Broadlink Binding for OpenHAB 3. I would like to see if anyone has seen this kind of issue, or has any ideas on how to troubleshoot it.

I have also open a ticket with the binding developer, in case they can help out.

I have made a HABpanel panel that has a remote control. The remote control uses the Broadlink binding to send commands to different appliances through IR.

The remote control is connected over WiFi, on the same network as the Broadlink device (an RM mini 3).
OpenHAB 3 is on a raspberry pi 3 connected through the network with a cable.

What i have found is that sometimes there is a delay between when the command is received by OpenHAB, and when the network packet with the command to control the Mini goes out of the raspberry pi. This delay is irregular. Sometimes openhab receives the command to activate the Mini, and sends the command to the Mini immediately, and sometimes the delay is of several seconds.
In some cases, the command is not sent at all, and you can see the following error on OpenHAB logs:

12:10:49.066 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler@': sendAndReceiveOneTime: Send/Receive failure
java.lang.IllegalStateException: sendAndReceiveOneTime: Send/Receive failure
at org.openhab.binding.broadlink.internal.socket.RetryableSocket.sendAndReceiveOneTime(RetryableSocket.java:67) ~[?:?]
at org.openhab.binding.broadlink.internal.socket.RetryableSocket.sendAndReceive(RetryableSocket.java:49) ~[?:?]
at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.sendAndReceiveDatagram(BroadlinkBaseThingHandler.java:165) ~[?:?]
at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.sendCode(BroadlinkRemoteHandler.java:63) ~[?:?]
at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleCommand(BroadlinkRemoteHandler.java:95) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor1177.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
at com.sun.proxy.$Proxy7168.handleCommand(Unknown Source) [?:?]
at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:80) [bundleFile:?]
at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]
at jdk.internal.reflect.GeneratedMethodAccessor1176.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

This issue translates in a really poor experience when using IR devices. Specially when trying to control things like a TV, going through menus, etc.

Does anyone has any ideas on how to start looking at this? The issue appears to affect only the Broadlink device (I have more devices on the network). At first i thought the problem could be the device itself, but when i capture traffic on the pi, it is clear that the commands send by OpenHAB/binding sometimes delay by several seconds. I am using Beta 5 snapshot release of the Broadlink binding.

Thank you very much.

Hello:
I guess, trying to think about this in a broader way, has anyone seen lag of seconds sending commands to items at all? I am trying to figure out if this is a problem with this specific binding, or if it could be a problem that has more to do with the whole setup. I have only noticed this issue being so prominent with the Broadlink binding, but at the same time, this would be the only binding where i am trying to send a lot of commands in a short time (using it like a remote control).

Thanks!

Hi all:
After some long troubleshooting, i figured out the problem is not the binding, nor openHAB or the device. It appears to be the network.

Specially, issues with the network when some devices connect to it (Apple devices).

It is pretty strange, the network is not saturating, but you can see the Broadlink RM mini not responding to packets or having a delay in the response.

Since i use Openwrt routers, i have opened a topic in the OpenWRT forum that describes my network and the issue, i am referencing it here, in case someone wants to get more detail.

But in short, i noticed that when some apple devices connect to my network, there is an impact on the experience using HABpanel with the Broadlink device (The experience probably impacts all smart home devices, but it is most noticeable when using habpanel to control things like TVs, etc etc).

Does someone has any tips on network optimization for smarthome devices? The details of my network are in the previously mentioned topic, but specifically, i am looking to answer the following questions:

-Does anyone know what could be running on the Apple devices that is so network-intrusive? i have my Android phone connected to the 2.4Ghz network, and have devices like streaming audio speakers, etc, that are not as invasive. It is specially strange that i do not see bandwidth saturation.

-Does anyone have any tips on prioritizing Wifi devices? (I understand this is a Wifi related question)

-Does anyone runs a scenario like this and has any recommendations? I have made sure that devices connect to the SSID with the best signal levels, and locked devices so they can only connect to that SSID. In general, the signal levels for both devices and APs are healthy. I cannot guarantee the same for mobile devices, but i have only 3 of those. everything that can be wired is wired.

-To investigate this further, does anyone now of any software that would help me map wifi “airtime” utilization per device?

-I have several Tuya devices in the network. They are very chatty, and like to send broadcasts very often. Someone on the openWRT forum mentioned Multicasts (likely broadcasts too) are sent with the lowers possible rate. Does anyone knows of any way to disable these broadcasts? i use tuya-mqtt to control them, and i will be opening a topic with them and the tuya-api guys, to see if they have any experience with this.

I understand these are not openhab-related questions anymore, but i thought there could be people here with more experience than me dealing with this kind of issues. My smart-home infrastructure is only a couple of months old, so i am just discovering issues as i go.
Thanks!