Open niebochod opened 3 years ago
As i can see in the source code:
NetworkUtils.hostAvailabilityCheck(thingConfig.getIpAddress(), 3000)
used in this case use: https://docs.oracle.com/javase/1.5.0/docs/api/java/net/InetAddress.html#isReachable(int) that is trying to ping such device. But broadlink seems to be stop responding to pings.
When i've removed NetworkUtils.hostAvailabilityCheck()
call and let to query device for status i've got:
21:06:52.611 [ERROR] [.handler.BroadlinkRemoteModel2Handler] - rm2:34-ea-34-8e-fc-b7[v]: Problem getting status. Marking as offline ...
21:06:52.611 [WARN ] [.handler.BroadlinkRemoteModel2Handler] - rm2:34-ea-34-8e-fc-b7[v]: Online -> Offline due to: Problem getting status
21:07:22.626 [ERROR] [.handler.BroadlinkRemoteModel2Handler] - rm2:34-ea-34-8e-fc-b7[v]: Could not get status:
21:07:22.626 [ERROR] [.handler.BroadlinkRemoteModel2Handler] - Broadlink Exception:
java.net.ProtocolException: Response from device is not valid. (0x22=0xF9,0x23=0xFF,0x24=0x00)
at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:195) ~[bundleFile:?]
at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:193) ~[bundleFile:?]
at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel2Handler.getStatusFromDevice(BroadlinkRemoteModel2Handler.java:41) [bundleFile:?]
at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:227) [bundleFile:?]
at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:102) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
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) [?:?]
I've been looking into this briefly today and having a similar issue. You mention the RM2, which I've not explicitly touched (but have updated other code in the protocol to get the SP4B working.
I'd suggest your best bet is to use the OH 3.1 jar from the Millhouse Group https://github.com/themillhousegroup/openhab2-addons/
Seems that it also calls NetworkUtils.hostAvailabilityCheck
(source), so i guess it will switch device into offline as well.
With this change: https://github.com/niebochod/openhab-addons/commit/b32744b1b13667a243e574b704f82d2c1395bf26 it seems to be working fine (at least from initial tests).
I have problem with RM2 device to be marked as OFFLINE ('Couldn't find statically-IP-addressed device') in openHAB 3.0.1 after a couple of days working perfectly fine.
It looks that after few days RM2 device enters into state where it's not responding to 'ping' requests:
but it remains working and responsive for UDP packets, at least when checking with:
I can see also in my RouterOS, that it communicates successful with remote and local IPs. I can see also in the wireshark no network errors when using python lib as shown above:![image](https://user-images.githubusercontent.com/35240051/113477694-f19a9b00-9483-11eb-9fb4-dddcb8082fd2.png)
However, seems that binding does not make attempt to communicate with such device. Restarting binding produces logs as follow:
Binding version: org.openhab.binding.broadlink-3.1.0-SNAPSHOT.jar
OpenHAB setup
Restarting broadlink device solves problems for few days (where broadlink device responds to pings back).