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

Edit: @Viktor_Olah and @mleon71 - Looking at the code its “treated as an RM4 due to sendCode quirk” as mentioned and yep, device firmware will be V44057. I turned off lock device thanks Viktor and it does give me the same error you have. I am going to look at the code further and see if there’s something straightforward that needs to be tweaked to get it working again, referencing your notes.

@Viktor_Olah and @mleon71 - I got it working! You can try BETA 14 below, it will auto-detect as a Broadlink RM3 v11057 device.

@Cossey - Great, thanks Cossey. I made some tests and everything is working fine.

Thanks to @Cossey 's excellent work which is now merged into the main repository, Beta 14 now supports those quirky RM3 devices:

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

Thanks again Stewart :smiley:

1 Like

thank you john!

HI, Do you plan to move the binding to OH3?

Regards
Lorenzo

2 Likes

@themillhousegroup I’m looking at doing some more tidying up. Looking at removing the IV and keys from config as Caro had them, thinking about placing them in the constants class instead.

Looking at going over the thing-types.xml again to tidy up a bit more, it’s really large, and might need to be split out to make it more easier to work with.

Can you look at resolving those problems in ThingLogger.java, I didn’t want to touch that code as I wasn’t 100% sure as to your approach with that class - once those 5 issues are sorted it’ll make things a lot easier to work with. You may also want to pull in the most recent changes from the 2.5.x branch from the new add ons repo as they started using spotless to style the code, and Jenkins will fail its checks if spotless has errors (https://github.com/openhab/openhab-addons/pull/8401).

Thanks for your efforts so far, this saves me having to use MQTT for the RM3 mini. I’m using this to automate my heat pump and old CD Player unit.

I am trying to get this setup and I am probably missing something very simple.

I have downloaded the version of the binding posted 5 days ago, moved it into my addons folder but can’t get any further.

After moving the jar file I got this in my log: -
2020-11-05 16:31:13.976 [INFO ] [.discovery.BroadlinkDiscoveryService] - BroadlinkDiscoveryService - Constructed

But when I try to discover anything the Broadlink binding isn’t showing.

What am I doing wrong?

Thanks.

Try hitting the ‘Scan’ icon on top right.

Hello,
I’m newbie and having problems with sending codes. I followed all steps and seems everything fine but openhab throwing error when I try to send codes. How can I fix the error?

2020-11-07 19:20:35.678 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler@1b49c7c’: hexString needs to have an even length:

I came here after a bit of a journey, but I think I’ve nearly reached the goal. I have a BG Electrical Smart Socket, which is shown in the Broadlink App as a compatible device. From there I found the Python script, which supports the BG1, and then here.

I’ve loaded in Beta14 and see this in my logs:

2020-11-08 21:25:54.107 [WARN ] [internal.discovery.DiscoveryProtocol] - Device scan: wait complete ...
2020-11-08 21:25:54.108 [WARN ] [internal.discovery.DiscoveryProtocol] - Ended Broadlink device scan...
2020-11-08 21:25:54.108 [INFO ] [link.internal.socket.BroadlinkSocket] - Socket closed
2020-11-08 21:25:54.108 [INFO ] [.discovery.BroadlinkDiscoveryService] - Discovery complete. Found 0 Broadlink devices
2020-11-08 21:25:57.390 [WARN ] [.discovery.BroadlinkDiscoveryService] - BroadlinkDiscoveryService - Beginning Broadlink device scan...
2020-11-08 21:25:57.390 [WARN ] [internal.discovery.DiscoveryProtocol] - Beginning async Broadlink device scan; will wait 10000 ms for responses
2020-11-08 21:25:57.392 [WARN ] [internal.discovery.DiscoveryProtocol] - Broadlink device scan waiting for 10000 ms to complete ...
2020-11-08 21:25:57.461 [ERROR] [nding.broadlink.internal.ModelMapper] - Device identifying itself as '20963' (0x51e3) is not currently supported. Please report this to the developer!
2020-11-08 21:25:57.461 [ERROR] [nding.broadlink.internal.ModelMapper] - Join the discussion at https://community.openhab.org/t/broadlink-binding-for-rmx-a1-spx-and-mp-any-interest/22768/616

So it looks like we’ve got a new device 20963. I couldn’t see that code mentioned in this thread so thought it’s best I mention it. Have you seen this device before?

Hi,
nice binding, a use it on oh 2.x
is there a version available for OH3
regards ?
Ronny

1 Like

I’ve made a bit of progress, but not much. I’ve added the device to the supported list and can discover the device in Paper UI
image

I can’t authenticate though. It looks like getMac() doesn’t have anything set for the string mac

    2020-11-13 15:36:40.742 [ERROR] [dlink.handler.BroadlinkSocketHandler] - bg1:c8-f7-42-97-45-33[v]: Authentication failed:
    java.lang.NumberFormatException: For input string: ""
            at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_252]
            at java.lang.Integer.parseInt(Integer.java:592) ~[?:1.8.0_252]
            at org.openhab.binding.broadlink.config.BroadlinkDeviceConfiguration.getMAC(BroadlinkDeviceConfiguration.java:78) ~[bundleFile:?]
            at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.buildMessage(BroadlinkBaseThingHandler.java:183) ~[bundleFile:?]
            at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.authenticate(BroadlinkBaseThingHandler.java:139) [bundleFile:?]
            at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:273) [bundleFile:?]
            at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:227) [bundleFile:?]
            at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:104) [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-11-13 15:36:40.743 [ERROR] [dlink.handler.BroadlinkSocketHandler] - bg1:c8-f7-42-97-45-33[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline

Hi all, I have been trying to get this Binding working on my 2 RM3Mini’s. I previously had them working great on BlackBeanControl using the old Exec binding but my Pi died and I didn’t have a backup so took the opportunity to upgrade. Now running 2.5.10-1 and the org.openhab.binding.broadlink-2.5.1-SNAPSHOT.jar version of the binding. It installed lovely and picked up both devices on the network but when I try and send a command I get a similar Java error.

2020-11-18 12:24:42.889 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler@4e967068’: bundleContext
java.lang.NoSuchFieldError: bundleContext
at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.lookupCode(BroadlinkRemoteHandler.java:102) ~[?:?]
at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleCommand(BroadlinkRemoteHandler.java:72) ~[?:?]
at jdk.internal.reflect.GeneratedMethodAccessor64.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
at com.sun.proxy.$Proxy550.handleCommand(Unknown Source) [?:?]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]
at org.openhab.transform.map.internal.profiles.MapTransformationProfile.onCommandFromItem(MapTransformationProfile.java:91) [bundleFile:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
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: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) [?:?]

not sure if it’s just me or if there is an issue with the binding on these versions or if anyone else has managed to get it working? I feel like I am so close but now looking at using exec with Python Broadlink similar to what I had before but the binding approach would be far better if it worked. Unfortunately BlackBeanControl doesn’t work now either as I believe the Python version it was on is no longer supported sadly as it worked seemlessly.

Hello Friends,
After many weeks of dead ends, I finally managed to learn my RF remotes’ codes using my RM4 Pro.

Could someone please be kind to point me to a guide on how to continue setting up the Broadlink binding so that it sends my RF commands using OpenHAB and the RM4 Pro?

My RM4 Pro is already configured as a Thing in OpenHAB, but I don’t know where I should save the RF codes for OpenHAB to use them?

I would also like to know how to configure my sitemap to include buttons that control my RF devices.

Many thanks to anyone that can point me in the right direction :pray: :pray: :pray:

[UPDATE]: I was able to find a simple guide to where and how to save the RF codes and how to add buttons for them in the sitemap.

In case someone finds it helpful, here is a link to the guide I found:

not sure if RF is working as IR
but you will need a MAP file

the map file is in the maps folder (that i cant find right now… but its in the same folder as the addon folder)

in the map file you will need to put somthing like

FAN_ON = 4353463763734 (RF CODE)
FAN_OFF = 345345345345354

then when aproching the thing in the site map or where ever else you can ask for the FAN_ON
there also a way of giving the complete code but this is not good for humens :slight_smile:

1 Like

I recently bought a new device for sending RF (BroadLink - RM4 Pro):

[ERROR] [nding.broadlink.internal.ModelMapper] - Device identifying itself as '25755' (0x649b) is not currently supported. Please report this to the developer!
[ERROR] [nding.broadlink.internal.ModelMapper] - Join the discussion at https://community.openhab.org/t/broadlink-binding-for-rmx-a1-spx-and-mp-any-interest/22768/616

Thanks for the binding. Could anybody help? I am getting the following problem:

I installed the latest .jar version “org.openhab.binding.broadlink-2.5.1-SNAPSHOT.jar”. I could install the binding and recognized my RM3 hardware correctly. Then I created the item line:

String FF_Library_TV_Power “TV” {channel=“broadlink:rm3:34-ea-34-40-93-68:command”}

and sitemap line:

    Switch item=FF_Library_TV_Power label="TV Power" mappings=[TV_POWER_ON="On", TV_POWER_OFF="Off"]

Everything seems ok… BUT, when I click in basic UI, I get the folloging error in the log:

2020-11-26 23:48:02.648 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler@18c0088’: hexString needs to have an even length:

java.lang.IllegalArgumentException: hexString needs to have an even length:

at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:105) ~[bundleFile:?]

at org.eclipse.smarthome.core.util.HexUtils.hexToBytes(HexUtils.java:119) ~[bundleFile:?]

at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.lookupCode(BroadlinkRemoteHandler.java:127) ~[?:?]

at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleCommand(BroadlinkRemoteHandler.java:94) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_262]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_262]

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

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

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

at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]

at com.sun.proxy.$Proxy200.handleCommand(Unknown Source) [?:?]

at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]

at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_262]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_262]

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

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

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_262]

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

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

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

Could anybody help? Thanks!

hello everyone!

question:
is the latest version of the binding (maybe any version is… dunno) compatible with OH 3.0.M4?

I might have to migrate from OH.2.4m3 due to some new Z-Wave database devices, but i don’t want to loose this binding’s functionality… it’s been really solid.

Thanks @themillhousegroup for the amazing work, you’ve improved my home :slight_smile:

Hi Dario
To my understanding it is not yet ready at least I didn’t find anything.
I also used it under v2.5