Android Debug Bridge status not updating

  • Platform information:
    • Hardware: Docker on Intel Atom x86_64 with 2GB RAM
    • OS: Debian 11 Bulseye
    • Java Runtime Environment: *
    • openHAB version: 3.3

I have an OH setup with Android Debug Bridge binding and I have created a thing with AndroidDebugBridge for my Mi TV. The thing shows different statuses of the android device like ONLINE, OFFLINE, UNKNOWN, UNINITIALIZED etc. I have a rule to trigger a shell script which will turn off the smart plug connected to the TV, when the thing’s status changes to OFFLINE.

The setup was working without any issues till last month. Recently while troubleshooting, I found that the status of the thing is not changing when the TV is turned off by remote.

I have tried to debug this by running OH3 docker container on a Pi 4 and tried to install it on the host machine as well, all of them returns the same behavior.

The thing status is not getting updated when I turn off TV with remote (no ping). However, when I turn back the TV on and when it connects to network, suddenly the Thing status changes to OFFLINE and then to ONLINE.

See the logs below,

/var/log/openhab/events.log

2022-07-02 15:46:28.816 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androiddebugbridge:android:0a26559a6d' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalStateException: connect() must be called first
2022-07-02 15:46:58.950 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'androiddebugbridge:android:0a26559a6d' changed from OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalStateException: connect() must be called first to ONLINE

/var/log/openhab/openhab.log

2022-07-02 15:46:28.811 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.IllegalStateException: connect() must be called first
        at com.tananaev.adblib.AdbConnection.open(AdbConnection.java:321) ~[?:?]
        at org.openhab.binding.androiddebugbridge.internal.AndroidDebugBridgeDevice.lambda$5(AndroidDebugBridgeDevice.java:699) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
        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:829) [?:?]

I suspect this might also be an issue with my Android TV.

Any help would be much appreciated.

Regards,
DMJ