themillhousegroup / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
36 stars 17 forks source link

Fix for RM2 not responding to pings and becoming OFFLINE #21

Closed niebochod closed 3 years ago

niebochod commented 3 years ago

Why? This is an fix for issue reported and described here: https://github.com/RobPope/BroadlinkOH3/issues/1

Change Instead of trying to check whenever the device is reachable with InetAddress::isReachable(), which sends PING-s, we just trigger communication with the device over UDP. E.g. Broadlink RM2, may enter into a state where it stops responding to pings, but still remains operational and being able to handled commands.

In such state device responds with:

java.net.ProtocolException: Response from device is not valid. (0x22=0xF9,0x23=0xFF,0x24=0x00) however after ignoring packets 0x22-23 check, looks like binding is able to read tempearature from the device successful.

Testing I've checked this with RM2 device that i use and works OK for 1 and half week with this fix.

niebochod commented 3 years ago

Thanks!