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

Here are some new lines from the log, after I put it back to [DEBUG] mode…

2018-12-13 08:14:28.168 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[^]: No further status for socket response received for device
2018-12-13 08:14:28.182 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[^]: null response from model 2 status request
2018-12-13 08:14:28.186 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[^]: Problem getting status. Marking as offline ...
2018-12-13 08:14:28.190 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[^]: updateItemStatus: Online -> Offline

==> /var/log/openhab2/events.log <==
2018-12-13 08:14:28.277 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-b0-71' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address

==> /var/log/openhab2/openhab.log <==
2018-12-13 08:14:58.285 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[v]: We've never actually successfully authenticated with this device in this session. Doing so now
2018-12-13 08:14:58.290 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[v]: Authenticating with packet count = 54782
2018-12-13 08:14:58.374 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[v]: Authenticated with id '01000000' and key '56F2C22AFE76EA2226BA9E7ED2D6E68A'.
2018-12-13 08:14:58.377 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[v]: Authenticated with newly-detected device, will now get its status
2018-12-13 08:14:58.422 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b0-71[v]: updateStatus: Offline -> Online

==> /var/log/openhab2/events.log <==
2018-12-13 08:14:58.434 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-b0-71' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address to ONLINE

is rm pro plus supported?? it can’t find it

Hi, I will report no Problems with my SPMini2 using the BETA-10.

check the serial number of your device.
The beginning of it tells you the exact model, which could be rm3 :wink:

What Authentication Key and IV do you use for your SP3’s?

Finally worked perfect for me using a Broadlink RM Pro +, using auto discovering feature in Openhab and RM Plugin Lite android app.
Thank you all.

Hi everybody. I’m trying to use this binding with OpenHAB 2.4 on a raspberry pi v3 with Stretch (apt-get installed) because I’m slowly migrating from a working OpenHAB 1.8.3 installation.
In my still working 1.8.3 I’m using probably an old version of the broadlink python library that worked well for my broadlink A1 sensor and for my 2 RM mini3 remotes. I was using an early version of (following indication in this thread by @davorf ) which I also used to record IR codes in a file. Such a program was also mentioned in this thread by someone else.

In my new OpenHAB installation I would like to simplify and therefore this binding is of great help.
I am able to read temperatures for the A1 (which was discovered after some time) and I discovered the two RM3 mini. I created the map file but when I tried to issue a command I always get the following error

2018-12-23 11:47:06.857 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:b4-43-0d-dc-8b-ed[^]: Will not send remote code because it has an incorrect length (212)

The things are defined in paper UI, while items, sitemap and mapping files are configured as text files.

Suspecting that the IR codes by my old broadlink version were incorrect, I also tried to copy IR codes from other threads. I was expecting that the binding would have sent it anyway, but I always get the same error: only the length in parenthesis changes.
I’m not a java programmer so I cannot delve into the binding sources to try to figure out what this error means.
Can someone suggest me how can I further debug this issue?
Thank you,

2.4.0-BETA-10 works perfect with SP3S switch.

You might need to “tidy up” your .map file, checking for spaces, newlines etc in the IR codes. The binding requires an IR code to be a multiple of 16 bytes in length (I have no idea why, it was like that in the original binding; I assume it’s a requirement of the RM- devices themselves).

As another working example for you to try, here’s the first two entries in my

PANASONIC_AIRCON_ON = 2600bc017438100d0f2a0f0d100d0f0d100d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f2a0f0d100d0f0d100d0f0e0f0d0f0e0f2a0f2a0f2a100d0f0d1029100d0f0e0f0d0f0e0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0e0f0d0f2a1029100d0f0e0f0d0f0e0f0d100001487338100d0f2a100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f2a100d0f0d100d0f0d100d0f0d100d0f2a10291029100d0f0e0f2a0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0e0f2a0f0d100d0f2a0f0e0f0d0f0e0f0d100d0f0d102a0f0d0f0e0f2a0f0d100d0f0d100d0f0d100d0f0d100d0f0d102a0f2a0f2a0f2a1029100d0f2a100d0f2a0f2a0f0e0f2a0f2a0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d100d0f0d0f0e0f0d100d0f2a0f2a1029100d0f0d100d0f0d100d0f0d100d0f0e0f0d10291029102a0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f2a100d0f0d100d0f0d100d0f0d1029100d0f0e0f0d0f0e0f0d0f0e0f0d100d0f0d100d0f0d1408100d100d0f0d100d0f0d1029102a0f2a0f2a100d0f2a0f2a10000d05000000000000000000000000

PANASONIC_AIRCON_OFF = 2600bc017338100d1029100d0f0d100d0f0d100d0f0d100d0f0e0f0d0f0d100d0f2a100d0f0d100d0f0d100d0f0d100d0f2a1029102a0f0d0f0e0f2a0f0d100d0f0d100d0f0d100d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d102a0f2a0f0d100d0f0d100d0f0e0f00014874380f0e0f2a0f0d100d0f0d0f0e0f0d100d0f0d100d0f0d100d0f0d102a0f0d100d0f0d100d0f0d100d0f0d102a0f2a0f2a0f0e0f0d0f2a100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0d100d0f0e0f0d0f0e0f2a0f0d0f0e0f0d100d0f0d100d0f2a0f0e0f0d0f2a100d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d0f2a0f2a102a0f2a0f2a0f0e0f2a0f0d1029102a0f0d0f2a102a0f0d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d100d0f0d0f0e0f0d102a0f2a0f2a0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f0d0f0e0f2a0f2a0f2a0f0e0f0d0f0e0f0d100d0f0d100d0f0d100d0f0d100d0f0e0f0d0f0e0f0d0f0e0f2a0f0d100d0f0d100d0f0d100d0f2a0f0e0f0d0f0e0f0d0f0e0f0d0e0f0f0d0f0e0f0d100d0f0d0f0e0f0d100d0f0e0f2a0f0d0f2b0f2a0f2a0f0e0f2a0f2a0f000d05000000000000000000000000

I feel like you should be able to “pad out” the IR code to a multiple of 16 with zeroes (a zeroed byte will be 00) without doing much harm … ?

Thank you very much for your explanation.
It means that codes stored by the version of I use are stored in a different format than the one accepted by the binding.
I’ll try with a newer version. Hopefully this will solve the issue that the ir code of the same remote is coded completely differently by each rm mini.

EDIT: I verified that the python code stores data encrypted. Once decrypted it can be copied into the map file that can be used by the binding.

Hey guys,
Does anyone have tried to control the binding through amazon alexa?
If do so, could someone provide item and rule example?
Thank you in advance.

Hi @themillhousegroup, first of all I want to thank you for this great contribution. I abandoned binding version 2.2 long time ago due to many reconnection and general reliability issues time ago. It have been working more or less fine through executecommand calling python script, but I now realise it was slow and some times had to send the IR code twice to get it to work. Now with 2.4 b10 new binding everything goes very quick and reliable

The only strange thing is that the logs are filled with communication error messages:

2018-12-30 06:29:44.039 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:33:23.287 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: Problem getting status. Marking as offline …
2018-12-30 06:33:23.290 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:41:03.923 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: Problem getting status. Marking as offline …
2018-12-30 06:41:03.926 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:43:10.006 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: Problem getting status. Marking as offline …
2018-12-30 06:43:10.010 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:46:46.579 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: Problem getting status. Marking as offline …
2018-12-30 06:46:46.581 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:54:22.877 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 06:59:32.437 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 07:04:15.035 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: Problem getting status. Marking as offline …
2018-12-30 07:04:15.038 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:rm2:78-0f-77-17-f1-35[^]: updateItemStatus: Online -> Offline
2018-12-30 07:06:33.846 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b1-06[^]: null response from model 2 status request
2018-12-30 07:06:33.852 [ERROR] [.handler.AbstractLoggingThingHandler] - broadlink:sp2:34-ea-34-f5-b1-06[^]: Problem getting status. Marking as offline …

But the truth is that even when it says marking as offline, the IR commands works perfectly and quick. As far as I can tell It haven’t failed a single time in the last week, but logs are plenty of this messages

Happy new year everyone!
I have a question, I have a Sony Projector which is using the same command for Powering ON and OFF, the only difference with the OFF command is that needs to be repeated once to finally switch OFF the projector.
Any .rules suggestion would be appreciated.
Thank you in advance,

That’s really strange @Dixon - I suspect turning logging up to TRACE level (see further up this thread to see how to do that in the OpenHAB console) might explain that a bit better.

You might also experience an improvement from downloading and using BETA-11 which I’ve just published.

This version attempts to improve general reliability. The Broadlink network protocol always acknowledges every command sent to a device, so logically, the sendPacket() and receivePacket() functions have been coalesced to sendAndReceivePacket(). This in turn allowed for a simple retry mechanism to be implemented. If we time out waiting for a response from the device, we immediately retry, sending the packet again. Together with some improved logging, this should hopefully be enough to fix (or at least understand) devices prematurely being marked “offline” on unreliable networks.

The reason that page doesn’t work with an RM3 is that the page’s JavaScript in learn.js tests for the device code, and ignores the “RM3” code which your device has. So you can add

type == "RM3" ||

to the end of line 80 of learn.js and it will recognise those devices.


The JavaScript in learn.js used by that page filters out RM3 type devices as far as I can see - so see my note just above about modifying line 80 of learn.js to enable RM3 device type.

Answering my own question, to use alexa on/off commands with broadlink rm products.
This post from @themillhousegroup worked great for me Broadlink binding for RMx, A1, SPx and MP. Any interest?

Thanks a lot

Unfortunately even after BETA-11 I still get the messages that after a few hours my SP3’s are not found anymore on the network.
I tried with and without static IP’s, but no luck so far… Also reset the SP3’s completely and reinstalled again; no luck.
Any ideas?

==> /var/log/openhab2/openhab.log <==
2019-01-05 19:35:04.732 [WARN ] [internal.discovery.DiscoveryProtocol] - Device scan: wait complete ...
2019-01-05 19:35:04.739 [WARN ] [internal.discovery.DiscoveryProtocol] - Ended Broadlink device scan...
2019-01-05 19:35:04.745 [INFO ] [link.internal.socket.BroadlinkSocket] - Socket closed
2019-01-05 19:35:04.750 [INFO ] [link.internal.socket.BroadlinkSocket] - Receiver thread ended
2019-01-05 19:35:32.727 [WARN ] [nal.discovery.DeviceRediscoveryAgent] - DeviceRediscoveryAgent - Beginning Broadlink device scan for missing BroadlinkDeviceConfiguration [ipAddress= (static: false), port=80, mac=EE:08:6B:F5:B0:71, pollingInterval=30, mapFilename=null, authorizationKey=097628343fe99e23765c1513accf8b02, iv=562e17996d093d28ddb3ba695a2e6f58]
2019-01-05 19:35:32.731 [WARN ] [internal.discovery.DiscoveryProtocol] - Beginning async Broadlink device scan; will wait 5000ms for responses
2019-01-05 19:35:32.747 [WARN ] [internal.discovery.DiscoveryProtocol] - Broadlink device scan waiting for 5000 ms to complete ...
2019-01-05 19:35:37.751 [WARN ] [internal.discovery.DiscoveryProtocol] - Device scan: wait complete ...
2019-01-05 19:35:37.753 [WARN ] [internal.discovery.DiscoveryProtocol] - Ended Broadlink device scan...
2019-01-05 19:35:37.760 [INFO ] [link.internal.socket.BroadlinkSocket] - Socket closed
2019-01-05 19:35:37.768 [INFO ] [link.internal.socket.BroadlinkSocket] - Receiver thread ended
2019-01-05 19:35:40.761 [ERROR] [handler.BroadlinkSocketModel3Handler] - sp3:89be66a1[^]: Exception while getting status from device Incoming packet from device is null.
	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket( ~[256:org.openhab.binding.broadlink:]
	at org.openhab.binding.broadlink.handler.BroadlinkSocketModel2Handler.getStatusFromDevice( [256:org.openhab.binding.broadlink:]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus( [256:org.openhab.binding.broadlink:]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$ [256:org.openhab.binding.broadlink:]
	at java.util.concurrent.Executors$ [?:?]
	at java.util.concurrent.FutureTask.runAndReset( [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301( [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]
	at java.util.concurrent.ThreadPoolExecutor$ [?:?]
	at [?:?]
2019-01-05 19:35:40.767 [ERROR] [handler.BroadlinkSocketModel3Handler] - sp3:89be66a1[^]: Problem getting status. Marking as offline ...
2019-01-05 19:35:40.769 [ERROR] [handler.BroadlinkSocketModel3Handler] - sp3:89be66a1[^]: updateItemStatus: Online -> Offline

==> /var/log/openhab2/events.log <==
2019-01-05 19:35:40.791 [me.event.ThingUpdatedEvent] - Thing 'broadlink:sp3:89be66a1' has been updated.
2019-01-05 19:35:40.853 [me.event.ThingUpdatedEvent] - Thing 'broadlink:sp3:89be66a1' has been updated.
2019-01-05 19:35:40.857 [hingStatusInfoChangedEvent] - 'broadlink:sp3:89be66a1' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address

Thank you Michael, how do i add that line if the learn.js is on the server side?

Firefox and Chrome both allow you to edit source files including JavaScript in Developer mode. Open js/learn.js in the Sources tabs of the Developer window, and edit it. Hit Ctrl-S to have the page use the edited version - but don’t reload the page (when you do, your changes will disappear I think).

Alternatively, may I introduce a better way - a tool I just created which doesn’t have prejudices against RM3 or any other model, and which produces an output which can be easily copy-pasted into the file. Simply download the whole repository to a local folder and open index.html in your browser:

1 Like