Broadlink binding for RMx, A1, SPx and MP. Any interest?

Hi All,
Seems like we hit a perfect storm of UI issues and what may have been a bad merge in the ModelMapper file that caused the 0x5f36 device to be considered an RM3 when it needs to be an RM4.

With many thanks to @lampy, @JMahmens and @cb87 for their investigative/detective work, Beta 9.1 is here:
https://github.com/themillhousegroup/openhab2-addons/releases/download/BROADLINK_2.5.BETA_09.1/org.openhab.binding.broadlink-2.5.1-SNAPSHOT.jar

with the required change to the mapping file. RM device users, please try it out with commands!

Regards,
John

Thanks @themillhousegroup, not sure to understand what do you mean by using it without commands

Concerning the textual definition of things, is the format still the same ?

Thing broadlink:rm2:34-ea-34-c7-c9-18 "txtBroadlink RM2-Salon [192.168.1.101]-RM_1" [ ipAddress="192.168.1.101", port=80, staticIp=true, mac="34:ea:34:c7:c9:18", authorizationKey="097628343fe99e23765c1513accf8b02", iv="562e17996d093d28ddb3ba695a2e6f58", mapFilename="RM_1_c.map", pollingInterval=120 , retries=3, ignoreFailedUpdates=true]

Hi John!

Thanks for the quick releasae of a new snapshot! I can confirm that 0x5f36 device is now recognized as RM4.
Auth works, however another issue is arising now, as device status is read after the device becomes reachable:

2020-06-01 06:26:02.711 [TRACE] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Sending RM4 device status to 10.0.0.10:80
2020-06-01 06:26:02.712 [TRACE] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Sending RM4 device status complete
2020-06-01 06:26:02.713 [TRACE] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Awaiting RM4 device status response
2020-06-01 06:26:02.735 [TRACE] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Received RM4 device status (72 bytes)
2020-06-01 06:26:02.736 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Could not get status:
java.net.ProtocolException: Response from device is not valid. (0x22=0xFB,0x23=0xFF,0x24=0x00)
        at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:184) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.getStatusFromDevice(BroadlinkRemoteModel4Handler.java:45) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.onBroadlinkDeviceBecomingReachable(BroadlinkRemoteModel4Handler.java:36) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:270) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:218) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:95) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_252]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
2020-06-01 06:26:02.738 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-d8-e5[v]: Device became reachable but had trouble getting status. Marking as offline ...

This is reproducable and happens on every re-try.
The returned device error codes 0x22=0xFB,0x23=0xFF,0x24=0x00 returned would be a StorageError.

There are a couple known issues from python-broadlink regarding StorageError & 0x5f36:

Happy to be of assistance with further trials in fixing & highly appreciate the effort!

Hi John,
Thanks for the quick rebuild! Tried the new beta 9.1 but not with success. The device is recognized as RM4, while it is a RM mini 3.
The error codes are the same as @cb87 has, x22=0xFB,0x23=0xFF,0x24=0x00.

2020-06-01 09:43:25.920 [WARN ] [.discovery.BroadlinkDiscoveryService] - BroadlinkDiscoveryService - Beginning Broadlink device scan...

2020-06-01 09:43:25.930 [WARN ] [internal.discovery.DiscoveryProtocol] - Beginning async Broadlink device scan; will wait 10000 ms for responses

2020-06-01 09:43:25.945 [WARN ] [internal.discovery.DiscoveryProtocol] - Broadlink device scan waiting for 10000 ms to complete ...

2020-06-01 09:43:25.996 [INFO ] [.discovery.BroadlinkDiscoveryService] - Data received during Broadlink device discovery: from 192.168.0.97:80 [24:df:a7:7a:6a:87]

2020-06-01 09:43:25.999 [DEBUG] [.discovery.BroadlinkDiscoveryService] - Adding new Broadlink device (5f36 => broadlink:rm4) at 192.168.0.97 with mac '24:df:a7:7a:6a:87' to Smarthome inbox

2020-06-01 09:43:26.002 [DEBUG] [.discovery.BroadlinkDiscoveryService] - Device 'broadlink:rm4:24-df-a7-7a-6a-87' discovered at '192.168.0.97'.

2020-06-01 09:43:26.008 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'broadlink:rm4:24-df-a7-7a-6a-87' to inbox.

2020-06-01 09:43:35.947 [WARN ] [internal.discovery.DiscoveryProtocol] - Device scan: wait complete ...

2020-06-01 09:43:35.954 [WARN ] [internal.discovery.DiscoveryProtocol] - Ended Broadlink device scan...

2020-06-01 09:43:35.961 [INFO ] [link.internal.socket.BroadlinkSocket] - Socket closed

2020-06-01 09:43:35.969 [INFO ] [link.internal.socket.BroadlinkSocket] - Receiver thread ended

2020-06-01 09:43:35.975 [INFO ] [.discovery.BroadlinkDiscoveryService] - Discovery complete. Found 1 Broadlink devices

2020-06-01 09:46:34.992 [DEBUG] [ink.internal.BroadlinkHandlerFactory] - Creating Thing handler for 'broadlink:rm4'

2020-06-01 09:46:34.997 [DEBUG] [ink.internal.BroadlinkHandlerFactory] - RM 4 handler requested created

2020-06-01 09:46:35.026 [INFO ] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: constructed: resetting deviceKey to '097628343fe99e23765c1513accf8b02', length 32

2020-06-01 09:46:35.031 [INFO ] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: (HINT: this should start '0976', end '8b02' and have length 32)

2020-06-01 09:46:35.099 [DEBUG] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: initializing polling

2020-06-01 09:46:35.106 [DEBUG] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: We've never actually successfully authenticated with this device in this session. Doing so now

2020-06-01 09:46:35.272 [DEBUG] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: Authenticated with id '01000000' and key 'DC44AE3CC62483EC94BDFD0F02CB8EA8'

2020-06-01 09:46:35.276 [DEBUG] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: Authenticated with newly-detected device, will now get its status

2020-06-01 09:46:35.298 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: Could not get status: 

java.net.ProtocolException: Response from device is not valid. (0x22=0xFB,0x23=0xFF,0x24=0x00)

	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:184) ~[bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.getStatusFromDevice(BroadlinkRemoteModel4Handler.java:45) [bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.onBroadlinkDeviceBecomingReachable(BroadlinkRemoteModel4Handler.java:36) [bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:270) [bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:218) [bundleFile:?]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.initialize(BroadlinkBaseThingHandler.java:88) [bundleFile:?]

	at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_252]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_252]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]

	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

2020-06-01 09:46:35.339 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: Device became reachable but had trouble getting status. Marking as offline ...

2020-06-01 09:46:35.344 [WARN ] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-7a-6a-87[?]: Online -> Offline due to: Trouble getting status

Newer RM Mini 3 (device type 0x5f36) need to be handled like RM4 devices with regards to sending IR commands to the device (they also require the same 6 byte header as the RM4’s) - that’s why it is handled as a RM4 in the new build (check out the posts above). Good to see though that the problem with querying the device status is reproducable on other devices of the series.

Hi John,
Unfortunately, beta 9.1 didn’t fix my problem.
My RM4 Pro is not showing up in the Inbox at all and I can’t add it manually.
Is there any info I can send you to help solve this issue?

Was indeed not fully surprised it showed up, but don’t they have different device ID’s? In the posts where you refer to I do see it is written in de table of RM4 devices, and for me no problem in displaying it as RM4, but in the future people could get confused when the description isn’t matching the name plate of the device.

[Update]
After deleting the old thing, reinstalling beta 9.1 and restarting OpenHAB I’m now able to find my RM4 Pro in the Inbox.
Nevertheless, after adding the RM4 Pro as a Thing I’m seeing an “OFFLINE - COMMUNICATION_ERROR Couldn’t authenticate” message for it.

hi Everybody
I have exactly the same behavior like miki
I have a new RM3 which is recognized as RM4 and always Offline- Communication error in the gui
i have also new beta 9.1 installed (and newes openhab 2.5.3
<<
2020-06-03 20:28:35.331 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-df-01-dd[v]: Authentication failed:

java.net.ProtocolException: Response from device is not valid. (0x22=0xFF,0x23=0xFF,0x24=0xFF)

at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:184) ~[bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.authenticate(BroadlinkBaseThingHandler.java:133) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:262) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:218) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:95) [bundleFile:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_222]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

2020-06-03 20:28:35.333 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-df-01-dd[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline

2020-06-03 20:28:35.337 [WARN ] [handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-df-01-dd[v]: Online → Offline due to: Couldn’t authenticate

any ideas what i do wrong or how to fix it?
thank you very much in advance!
Philipp

Update: I have now cloned the git repo, replaced the logic of the getDeviceStatus method in BroadlinkRemoteModel4Handler with return true and compiled it locally. Doing this, the IR commands are now correctly sent to the 0x5f36 device.

Obviously, this is not a viable solution and was meant to test if everything would work fine going beyond the issue of the StorageError when sending a RM4 style status request. I think creating a seperate handler could be a solution, in that way the device could also be reported correctly as an RM3 in openHAB (as mentioned by @lampy)?

can anybody point me in the right direction, or does the binding at the moment don’t work with the new RM3?
Thank you for the help and the effort in the binding!

I use RM 4 Mini. But I got OFFLINE - COMMUNICATION_ERROR Trouble getting status.

10:39:56.473 [ERROR] [.handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-4f-d3-7e[v]: Could not get status: 

java.net.ProtocolException: Response from device is not valid. (0x22=0xFB,0x23=0xFF,0x24=0x00)

at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:184) ~[bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.getStatusFromDevice(BroadlinkRemoteModel4Handler.java:45) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.onBroadlinkDeviceBecomingReachable(BroadlinkRemoteModel4Handler.java:36) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:270) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:218) [bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:95) [bundleFile:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_212]

at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_212]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_212]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_212]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_212]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_212]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

10:39:56.475 [ERROR] [.handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-4f-d3-7e[v]: Device became reachable but had trouble getting status. Marking as offline ...

10:39:56.477 [WARN ] [.handler.BroadlinkRemoteModel4Handler] - rm4:24-df-a7-4f-d3-7e[v]: Online -> Offline due to: Trouble getting status
1 Like

@themillhousegroup Just for your information I’m gettings this warn message during OH starting up process…

2020-06-11 15:45:22.315 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.broadlink-2.5.1-SNAPSHOT.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.broadlink [19]

Unresolved requirement: Import-Package: org.eclipse.smarthome.config.core

at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]

at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]

at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

2020-06-11 15:48:53.546 [INFO ] [.discovery.BroadlinkDiscoveryService] - BroadlinkDiscoveryService - Constructed

Looks like there’s a big problem communicating with these 4th-generation (?) devices. Looking at the Python-broadlink repository, it looks like they use a special header on each request - this binding doesn’t do that … yet.

Hoping to get something out this weekend to address this. Sorry for the delay.
Cheers,
John

4 Likes

Hi all, looks like I have the same issue like the rest. I have RM4 mini and I couldnt find it automatically. I added the thing manually, filled in IP, port and MAC and I am getting constantly: Status: OFFLINE - COMMUNICATION_ERROR Couldn’t authenticate

Here are my logs:

2020-06-14 00:58:51.897 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:67261b7f[v]: Authentication failed: 
java.net.ProtocolException: Response from device is not valid. (0x22=0xFF,0x23=0xFF,0x24=0xFF)
        at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:184) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.authenticate(BroadlinkBaseThingHandler.java:133) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:262) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:218) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:95) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_251]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_251]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_251]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_251]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_251]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_251]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251]
2020-06-14 00:58:51.898 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:67261b7f[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline
2020-06-14 00:58:51.898 [WARN ] [handler.BroadlinkRemoteModel4Handler] - rm4:67261b7f[v]: Online -> Offline due to: Couldn't authenticate

Any idea what next? Are the pre-filled authorization key and IV correct? Thanks

OK RM4 owners, please try out BETA 10 available here:

https://github.com/themillhousegroup/openhab2-addons/releases/download/BROADLINK_2.5.BETA_10/org.openhab.binding.broadlink-2.5.1-SNAPSHOT.jar

This one builds in all the 4th-generation protocol changes as implemented by the Python code (linked just above in this discussion). Unfortunately I don’t have an RM4 device so have to work blind on this, but I have added some substantial unit testing based on network captures kindly provided by people in this thread so have some confidence that it’ll work…

There’s also a worthwhile improvement to ALL RM- devices (not just RM4s) - when sending a remote code, it used to throw a big error if the code was not an exact multiple of 16 bytes in length.
That’s now been rectified - the binding will automatically now “pad” the code with zero-bytes to make it the correct length to be transmitted by the Broadlink device. I’ve checked this on my RM mini 3.

Cheers and enjoy!
John

@themillhousegroup Thanks for the update. I am getting same issues with both RM3mini and RM4mini:

2020-06-17 15:35:05.741 [ERROR] [dlink.handler.BroadlinkRemoteHandler] - rm3:c8-f7-42-40-0c-f9[v]: Authentication failed: 
java.net.ProtocolException: Response from device is not valid. (0x22=0xFF,0x23=0xFF,0x24=0xFF)
        at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:191) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:204) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.authenticate(BroadlinkBaseThingHandler.java:147) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:287) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:243) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:109) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_251]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_251]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_251]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_251]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_251]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_251]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_251]
2020-06-17 15:35:05.743 [ERROR] [dlink.handler.BroadlinkRemoteHandler] - rm3:c8-f7-42-40-0c-f9[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline
2020-06-17 15:35:05.744 [WARN ] [dlink.handler.BroadlinkRemoteHandler] - rm3:c8-f7-42-40-0c-f9[v]: Online -> Offline due to: Couldn't authenticate

Is there anything I should do to make it work? This rm3 was added by automatic detection via binding. My RM4 was not detected and had to be added manually.

So for everybody who is struggling with new RM3mini or RM4mini devices and getting Authentication failed message:

Apparently there is some new “feature” in RM devices which disables local API authentication if device is connected to the cloud.

And of course, the official Broadlink app makes it impossible for you to set up the device without connecting it to the cloud. So how did I get things up and running? Manually…

Download the official python-broadlink scripts and set it up (you have to use python3 and run python3 setup.py install ; it does not hurt to update pip3 install -U cryptography as otherwise you may encounter an error about initialization error)

Now once you installed the tools, put your device into AP mode (hold reset button until it starts flashing fast. then hold it once more until it starts flashing a bit slower) run python3 and lets get to some in-line coding:

import broadlink
broadlink.setup('myssid', 'mynetworkpass', 3)

Once you do this, the flashing on RMx should stop flashing and after a short while the device will become pingable (find its IP on your router e.g.)

I then wanted to get some IR codes for my broadlink.map, so I had to learn them. To do that, first cd into cli folder of python-broadlink package and edit broadlink_discovery file. On top replace python with python3 , as python2 does not work with this.

Then run ./broadlink_discovery and if your device is set up ok, you will see it detected together with something like

0x2712 1.1.1.1 aaaaaaaaaa

So this is your IP as well as MAC and you use this with another script to start the learning process.

Execute:

broadlink_cli --device "0x2712 1.1.1.1 aaaaaaaaaa" --learn

And point your IR blaster to the RMx, press the buttons and if the gods are with you, you should see a hex and base64 captured code. Use that in your broadlink.map

Now for RM3 device I was able to detect and add it automatically via PaperUI, but for RM4 I had to add device manually. Just select RM4 type, enter IP, MAC (with : separators) and port=80 and you should be good to go. After this the device should show as ONLINE.

So to sum up - if you want to use latest firmware on RM3/4 devices you cannot set them up with Broadlink Android app.

1 Like

You can use the app, but I would certainly recommend your way of doing it though.

See my post, go to its history and wind it back one step and you’ll see instructions on using the app to get your Broadlink device connected to your WiFi.

But I think using python-broadlink is the better way, which is why I switched my instructions to using it once I’d found the correct method!

1 Like

Wow - fantastic work @michnovka and @hafniumzinc - obviously the changes in the 4th-generation devices are even bigger than “just” adding some extra header bytes to the protocol.