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

@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.

Instructions fpr learning channel… Broadlink binding for RMx, A1, SPx and MP. Any interest? - #1411 by themillhousegroup

Thanks i did see that but it didn’t make any sense as I haven’t installed the binding.
I might play with it on my test system just to see how it works.

Hmm @millhousegroup there is one point interesting… may be there is a way to store the Learned automatically in the broadlink.map … Me be with option to Insert also the Command name ?

hi guys,i just got a RM4 mini,is it supported by this binding at openhab2.5.x?If yes where can i find the right jar? thnx!

OpenHAB has a StorageService which allows storing data internally. The MAP could be removed then.

I think the map file is needed for transforming the received code in a shorter command…

No, you can store key/value pairs, e.g. the shortcut as key and the code as value.

found the latest 2.5.x jar put it in the addons folder but when i scan at PaperUI i get

2021-07-09 15:56:19.700 [WARN ] [.discovery.BroadlinkDiscoveryService] - BroadlinkDiscoveryService - Beginning Broadlink device scan...

2021-07-09 15:56:19.706 [WARN ] [internal.discovery.DiscoveryProtocol] - Beginning async Broadlink device scan; will wait 10000 ms for responses

2021-07-09 15:56:19.722 [WARN ] [internal.discovery.DiscoveryProtocol] - Broadlink device scan waiting for 10000 ms to complete ...

2021-07-09 15:56:19.756 [ERROR] [nding.broadlink.internal.ModelMapper] - Device identifying itself as '25914' (0x653a) is not currently supported. Please report this to the developer!

2021-07-09 15:56:19.758 [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

2021-07-09 15:56:29.726 [WARN ] [internal.discovery.DiscoveryProtocol] - Device scan: wait complete ...

2021-07-09 15:56:29.728 [WARN ] [internal.discovery.DiscoveryProtocol] - Ended Broadlink device scan...

2021-07-09 15:56:29.731 [INFO ] [link.internal.socket.BroadlinkSocket] - Socket closed

2021-07-09 15:56:29.733 [INFO ] [.discovery.BroadlinkDiscoveryService] - Discovery complete. Found 0 Broadlink devices

so my device is not supported?I read above in the thread that people is using rm4mini with this binding…is it a matter of newer firmware?
when i try to add it manually i get

2021-07-09 15:54:08.966 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:742ec2a5[v]: Authentication failed: 

2021-07-09 15:54:08.969 [ERROR] [handler.BroadlinkRemoteModel4Handler] - Broadlink Exception: 

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:195) ~[bundleFile:?]

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

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

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

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:216) [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_282]

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

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

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

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

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

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

2021-07-09 15:54:08.976 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:742ec2a5[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline

2021-07-09 15:54:08.979 [WARN ] [handler.BroadlinkRemoteModel4Handler] - rm4:742ec2a5[v]: Online -> Offline due to: Couldn't authenticate