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

That makes sense. Confusion solved!

It does. To complicate it further, you can control them individually or as a pair. You can also set a “max working time” that will switch the socket off a fixed time after it was switched on manually or by the app.

That would be fantastic. I’d rather it was in the official binding than have to run another version.

Understand completely. There is a workaround through controlling the socket with Alexa and sending commands to Alexa from OpenHAB so it is usable, just not ideal. Whenever it gets integrated into the binding it will be appreciated. - Thanks

Version 3.1.M5.4 now exposes Remote Learning Control channel for RM4Mini. Following your manual some posts above (##1-4), Learn Mode can be triggered - but RM4Mini doesn’t get there. No LED change to solid (#5) + no code learned. String item state, originally NULL, stays on “Enter infrared learn mode”.
IR-Commands can be sent, sensors are read.
Although log looks promising, no activity on the learn mode:

2021-07-01 11:09:26.463 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending learning-channel command LEARN
2021-07-01 11:09:26.466 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending enter remote code learning mode to <IP>:80
2021-07-01 11:09:26.467 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending enter remote code learning mode complete
2021-07-01 11:09:26.469 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Awaiting enter remote code learning mode response
2021-07-01 11:09:26.492 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Received enter remote code learning mode (72 bytes)

When choosing Check last learnt code, this is the result, maybe because of no code learned yet:

2021-07-01 11:19:44.610 [WARN ] [handler.BroadlinkRemoteModel4Handler] - Exception while attempting to check learnt code
java.net.ProtocolException: Response from device is not valid. (0x22=0xFB,0x23=0xFF)
	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:192) ~[bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:183) ~[bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.sendCheckDataCommandAndLog(BroadlinkRemoteHandler.java:100) [bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleLearningCommand(BroadlinkRemoteHandler.java:120) [bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleCommand(BroadlinkRemoteHandler.java:158) [bundleFile:?]
	at jdk.internal.reflect.GeneratedMethodAccessor168.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy58613.handleCommand(Unknown Source) [?:?]
	at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:80) [bundleFile:?]
	at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [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.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.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) [?:?]
1 Like

Did you check the oh-input system widget? There are also oh-input-card and oh-input-item widgets for card and use in list items. You should be able to just enter text. I use it with the upnpcontrol binding to give names to new favorites I define.

Dear Colleagues, i’m facing issues with broadlink as below: I just started a new OH and load my restore and broadlink addon was uploaded but didn’t work

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.broadlink [326]
2021-07-01 10:40:53.258 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.broadlink-3.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.broadlink [326]
2021-07-01 10:41:11.891 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.broadlink-3.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.broadlink [326]

i can observe the same behaviour / problem here too at my RM4mini…
Also the Temperature and Humindy will shown with “0.0” but thats better then NULL

Yes I have seen them before, but I believe they only show up when you create certain types of pages. If you don’t want to create custom pages and just set a default display widget when clicking on equipment in the semantic system it does not offer anything I can see that will then carry over into all auto generated UI lists. Since I don’t need to do this and don’t own any broadlink products it is not high on my list of things to look at but thanks for posting that it is possible with those widgets/cards.

@themillhousegroup
Can we RM4mini owners do something for helping you ? Did you need more Info? / Logs?

I previously attempted to add the BG1 and U01 with limited success. You can find repo here.

It worked ok for a while, then I changed something and haven’t been able to get it working again since :roll_eyes:

@themillhousegroup @matt1

Fixes

  • Power consumption calculations for SPxS devices

I think the problem persist, I’ve connected for example, a sonoff th16 to the SP3s plug and he tells me that consumption is 130w:

Screenshot_20210704_212327

In a xiaomi plug, the consumption is 0.52w and with the broadlink-mqtt project tells me the same thing:

Screenshot_20210704_212648

Best Regards,
Fernando Gomes

OK thanks for the bug reports all. I’ve been away for the last few days but I can see the problem affecting RM4 devices which would stop them entering learn mode thanks @cwi , and an actual example of the power consumption figures is really useful for the SPxS devices too - thanks @fapg

Should have a new version up shortly. Cheers.

1 Like

New version of the binding is out:

I’m hopeful to have finally sorted out the SP3S power consumption calculation, and I’ve also taken delivery of an RM4 Pro so was able to sort out issues with learning-related commands and command sending.

This version is based on the openHAB 3.2 sources but I’ve been testing it on my openHAB 3.1 system with no problems noted. As usual, please take care when updating the binding; note especially that the actual filename of the JAR has changed so you’ll need to remove the old 3.1 binding. For safety, I’d recommend the following:

  • Remove all your Broadlink Things
  • Delete the Broadlink 3.1 JAR file from addons
  • Let the system stabilise
  • Shut down your openHAB server
  • Copy the new 3.2 JAR into addons
  • Restart your openHAB server
  • Rediscover your Broadlink Things

Cheers,
John

3 Likes

Your new version looks good in conjunction with RM4mini, even with learn mode as you described in an earlier post. Testing on oh3.1 release version.
One comment: When triggering “Check last captured IR code” a second time after its learning, or after no code learnt (e.g. after timeout), it runs into a failure, which you might be able to avoid, see log below. I guess it is OK to notify that a learnt code can only be presented once or no (new) code available, so needs re-learning.

2021-07-08 09:10:51.437 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending learning-channel command CHECK
2021-07-08 09:10:51.440 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending send learnt code check command to <ip>:80
2021-07-08 09:10:51.441 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Sending send learnt code check command complete
2021-07-08 09:10:51.443 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Awaiting send learnt code check command response
2021-07-08 09:10:51.517 [TRACE] [handler.BroadlinkRemoteModel4Handler] - Received send learnt code check command (72 bytes)
2021-07-08 09:10:51.519 [WARN ] [handler.BroadlinkRemoteModel4Handler] - Exception while attempting to check learnt code
java.net.ProtocolException: Response from device is not valid. (0x22=0xFB,0x23=0xFF)
	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:192) ~[bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:183) ~[bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel4Handler.extractResponsePayload(BroadlinkRemoteModel4Handler.java:95) ~[bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.sendCheckDataCommandAndLog(BroadlinkRemoteHandler.java:114) [bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleLearningCommand(BroadlinkRemoteHandler.java:131) [bundleFile:?]
	at org.openhab.binding.broadlink.handler.BroadlinkRemoteHandler.handleCommand(BroadlinkRemoteHandler.java:170) [bundleFile:?]
	at jdk.internal.reflect.GeneratedMethodAccessor171.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy16743.handleCommand(Unknown Source) [?:?]
	at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:80) [bundleFile:?]
	at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [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.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.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) [?:?]

Hello John - great work - thank you for fixing the rm4mini leraning channel - i´ts working now!

It´s very iportant to follow the recommanditions of John aka the @themillhousegroup for installing the Binding…, without deleting and unlinking all device and giving enough time after erease the old jar file… stopping openhab copy the new one starting openhab… it will not work!

It´costs me 2 hrs for trying the quick and dirty way… had to reinstall the version before … After clean Reinstall with de advice of John the rm4mini also is working now with open hab!

The Errors wich Carl was reporting before i can also confirm - i have the same behavior when i try to show the last learned code a second time…

Thanks a lot for this great working binding!

Binding looks good. I have 3 remote controls and I created one item and 3 rules .One for each remote.
I created 3 remote widgets. It all works well.
Below is what I did, more or less.

@ubeaut
What do you need the broadlink-mqtt for? Is that a replacement for the broadling-binding?

I have only 1 item, no rules and 4 different remote control widgets. Works great :slight_smile:

I didn’t install the binding.
I did mine before I saw the binding but mine is working.
How is yours set up?
I really couldn’t find the instructions for this binding (granted I didn’t look too hard)
If your set up is easier I might install the binding.

The binding offers a “command” channel. You just have to link that channel to an item of type “string”.
Then you can assign the commands to the string item and there you go…


Optionally, you can save the IR-codes in a .map file, so you can use “pretty” names e.g. in your widgets.
So my widget definition on the pages has the pretty names, e.g.

          slots:
            default:
              - component: widget:UniversalRemote2
                config:
                  item: BroadlinkRMPro
                  power: SAT_POWER
                  volumeup: SAT_VOL_UP
                  volumedown: SAT_VOL_DOWN
                  devicetype: Sat
                  volumemute: SAT_MUTE
                  channelup: SAT_CH_UP
                  channeldown: SAT_CH_DOWN
1 Like

Interesting but how do you get the IR commands from the remotes?
In other words how do you get into learn mode?
I have a test system I can try all this on.

Previously you had to use other tools to get the code, but as I read in this thread, the binding now offers a learning mode. I have not tried that yet.

I used

to get my codes.

OK thanks. I think I will just stick with how I have it as the way I do it generates the codes into the folders etc.