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

Thanks Michael I shall give it a go :slight_smile:

Hi John,

I tried beta 11, it has the same flawless performance as beta 10, but now I get the same stack trace errors that @Jorg reported

2019-01-09 11:16:48.208 [ERROR] [handler.BroadlinkSocketModel2Handler] - sp2:34-ea-34-f5-b1-16[^]: Exception while getting status from device
java.net.ProtocolException: Incoming packet from device is null.
	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:193) ~[235:org.openhab.binding.broadlink:2.4.0.201901041112]
	at org.openhab.binding.broadlink.handler.BroadlinkSocketModel2Handler.getStatusFromDevice(BroadlinkSocketModel2Handler.java:47) [235:org.openhab.binding.broadlink:2.4.0.201901041112]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:204) [235:org.openhab.binding.broadlink:2.4.0.201901041112]
	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:79) [235:org.openhab.binding.broadlink:2.4.0.201901041112]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
    2019-01-09 11:16:48.218 [ERROR] [handler.BroadlinkSocketModel2Handler] - sp2:34-ea-34-f5-b1-16[^]: Problem getting status. Marking as offline ...
    2019-01-09 11:16:48.223 [ERROR] [handler.BroadlinkSocketModel2Handler] - sp2:34-ea-34-f5-b1-16[^]: updateItemStatus: Online -> Offline

I had similar issues with a A1 device. The problem was bad wifi reception quality.

@themillhousegroup Hello John, I have a Broadlink A1 and I’m wondering why the temperature polling is so inconsistent.

I have set the parameter in PaperUI -> Configuration -> Things - to 30 seconds but it clearly doesn’t work.

As you can see in my events.log there is no data sometimes for about 20 minutes.

2019-01-13 18:06:38.582 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.399999618530273 to 21.5
2019-01-13 18:07:09.042 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.5 to 21.399999618530273
2019-01-13 18:27:14.428 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.399999618530273 to 21.299999237060547
2019-01-13 18:28:45.196 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.299999237060547 to 21.399999618530273
2019-01-13 18:29:15.282 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.399999618530273 to 21.299999237060547
2019-01-13 18:46:19.565 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.299999237060547 to 21.200000762939453
2019-01-13 18:46:49.624 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.200000762939453 to 21.299999237060547
2019-01-13 18:49:20.348 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.299999237060547 to 21.200000762939453
2019-01-13 18:50:20.836 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.200000762939453 to 21.299999237060547
2019-01-13 18:52:21.470 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.299999237060547 to 21.200000762939453
2019-01-13 19:26:01.091 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.200000762939453 to 21.100000381469727
2019-01-13 19:27:31.668 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.100000381469727 to 21.200000762939453
2019-01-13 19:35:03.290 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.200000762939453 to 21.299999237060547
2019-01-13 19:45:08.681 [vent.ItemStateChangedEvent] - BroadlinkA1192168112_Temperature changed from 21.299999237060547 to 21.399999618530273

Hi @bccrew;
Looks like you have some rule firing on the output of your A1 Item, and you’ve used (correctly) the Item ItemName changed trigger to only do something if the temperature is actually different to the previous value. As the A1 is only capable of indicating temperatures with a 0.1C resolution, it’s quite possible for nothing to have changed for 20 minutes or more in a normal room!

If you’re concerned that something is not working properly, I can suggest two options to see more detail:

  • Alter the .rule that is producing the log output, changing the when Item ItemName changed trigger to when Item ItemName received update - this will make the body of the then run every time the A1 is polled;
  • Increase the logging level for the Broadlink binding (see further up this thread) - if you change it to the maximum level of detail (TRACE) - you’ll see something like this every 30 seconds (or whatever your polling frequency is):
2019-01-14 11:40:58.674 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: updateItemStatus; checking host availability at 10.240.0.201
2019-01-14 11:40:59.081 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: A1 getStatusFromDevice
2019-01-14 11:40:59.086 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: building message with count: 23517, id: 02000000, key: 7DD2B603EAB8A362579F9041C4857D20
2019-01-14 11:40:59.093 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: Sending A1 device status to 10.240.0.201:80
2019-01-14 11:40:59.099 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: Sending A1 device status complete
2019-01-14 11:40:59.104 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: Receiving A1 device status
2019-01-14 11:40:59.128 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: Received A1 device status
2019-01-14 11:40:59.175 [TRACE] [broadlink.handler.BroadlinkA1Handler] - a1:403c9a3e[^]: A1 getStatusFromDevice got temperature 23.8

Notice that last line :slight_smile:

1 Like

Cato,
This sounds exactly like what I am looking for. Please send me a link to binding. Thank you!

I am a little confused about how to get this working. I followed the steps to get it setup (thanks, that was an excellent step by step walkthrough) but I’m having a hard time knowing how to use them.

Basically I want to use OH2 with HabPanel as a remote control. So I want to create a dashboard with buttons, and when I press the button I want it to execute the command.

I got a little lost on step 7. I’m not sure how to setup multiple buttons/commands. And I don’t know how to use the String to execute a command when the button is pressed. Could anyone please help me with this?

Hi John,

Actually I don’t have any rules that act on these kind of changes but I would like to push data from the sensor in an influx database and make a nice graph with grafana. The only problem is that I need that data every 30 seconds to push it into the database to be able to build a nice graph line.

I’m not really sure which strategy I should enter in my persistence file but like this it doesnt really work:

Strategies {
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
}

Items {
    BroadlinkA1192168112_Humidity, BroadlinkA1192168112_Temperature  : strategy = everyMinute
}

Can you please check my logs attached here? This is my output with TRACE enabled. The temperature is polling every 30 seconds but the Humidity is not?

openhab.log (80.4 KB)
events.log (2.5 KB)

Hi sorry, I was not in the post for a long time thanks @themillhousegroup
for all the hard work!

I am still using Cato version, as I am not sure how to update
so small Q, can I just replace the file in the addon folder
and make sure config is ok and I am good to go?

as I said I have Cato ver working great, but I want to test yours, so tell me for RM2 device was there any change or I am better off staying how I am

thanks again

Hi @bccrew,
I can’t help you with your persistence setup, I have no experience with that at all.
Don’t worry though, your A1 looks to be working perfectly.

Don’t worry about the humidity not being in the logs - only the temperature is logged out as a sanity-check - all the A1 values should be coming through fine as long as you have created an Item for each one.

Hi @Gad_Ofir,
You’re correct - just replace Cato’s broadlink.jar in your addons directory with the latest Beta release and everything should be fine (I’m assuming you’re using OpenHAB 2.4).

The main improvements over Cato’s version are around:

  • reliability of discovery (esp. when multiple Broadlink devices exist on the network)
  • correct identification of devices
  • detecting online/offline states more reliably
  • handling dynamically IP-addressed devices
  • handling communication over unreliable networks a bit better (retry - still more work to do here)

So if you’re not experiencing any issues with any of the above, probably no need :slight_smile:

its working with allot of erros

 Handler BroadlinkRemoteModel2Handler of thing broadlink:rm2:b4-43-0d-aa-88-b8 tried updating channel temperature although the handler was already disposed

but as i said its working … sounds like you did a great work i must test this :slight_smile:

Hi, John,

thanks for great work! I use this binding every day!
I would like to know one 2 things:

  1. If Alarm Hub S2 works with Binding?
  2. If i can catch codes of other 433 Mhz devices (just to identificate pressing of buttons on remote controls and actions from sensosrs like doorsensors) and follow them to OH item states? Yes i can make it with Sonoff Bridge RF, but unlike Broadlink RM Pro, Sonoff do not understand most of new 433 remote commenders.

Thanks a lot!

PS
Buy the way. I use OH 2.4 and 11 Beta (on 2 Beta was the same) of Binding and get this errors about every 15 mins

2019-01-19 23:46:21.773 [ERROR] [handler.BroadlinkRemoteModel2Handler] - rm2:b4-43-0d-fb-d5-cc[^]: Could not get status: {}

java.net.ProtocolException: Incoming packet from device is null.

	at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:193) ~[296:org.openhab.binding.broadlink:2.4.0.201901041112]

	at org.openhab.binding.broadlink.handler.BroadlinkRemoteModel2Handler.getStatusFromDevice(BroadlinkRemoteModel2Handler.java:39) [296:org.openhab.binding.broadlink:2.4.0.201901041112]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:204) [296:org.openhab.binding.broadlink:2.4.0.201901041112]

	at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:79) [296:org.openhab.binding.broadlink:2.4.0.201901041112]

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

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

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

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

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

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

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

2019-01-19 23:46:21.779 [ERROR] [handler.BroadlinkRemoteModel2Handler] - rm2:b4-43-0d-fb-d5-cc[^]: Problem getting status. Marking as offline ...

2019-01-19 23:46:21.782 [ERROR] [handler.BroadlinkRemoteModel2Handler] - rm2:b4-43-0d-fb-d5-cc[^]: updateItemStatus: Online -> Offline

==> /var/log/openhab2/events.log <==

2019-01-19 23:46:21.795 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm2:b4-43-0d-fb-d5-cc' has been updated.

2019-01-19 23:46:21.882 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm2:b4-43-0d-fb-d5-cc' has been updated.

2019-01-19 23:46:21.890 [hingStatusInfoChangedEvent] - 'broadlink:rm2:b4-43-0d-fb-d5-cc' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.21

2019-01-19 23:46:26.151 [vent.ItemStateChangedEvent] - ActualDateTime changed from 2019-01-19T23:45:26.133+0100 to 2019-01-19T23:46:26.137+0100

Hi @themillhousegroup

its working great thank you! no more errors in the logs :slight_smile:
so now if i want to add another RM3/2

its no issue now?

Should be fine to run as many devices as you like @Gad_Ofir - I should have mentioned that a restart of OpenHAB is probably a good idea between removing the old JAR and copying in the new one … but your system seems to have healed itself now :slight_smile:

1 Like

Hi @thisisIO,
There’s no mention of the S2 device in the binding code at the moment, so it’s unlikely to be detected in the device discovery phase.

You’re welcome to run a discovery - if you watch the logs, you should see an ERROR level message saying "Discovered a ??? but do not know how to support it at this time" - if you’d like to send me the device ID code (the ??? in the error message) I can add it to the next version of the binding, and I’ll treat it like the S1C device, and you can see if that works.

If it does, great, but otherwise it could prove quite difficult to develop support for it as I don’t have one.
Similarly, I don’t have an RM Pro device, so I don’t know what a 433MHz capture looks like.

This might be a good question for @alba who has developed a nice tool for working with the RM devices :slight_smile:

I have hunter pacific neoteric RF remotes anyone else using these successfully? i have no idea what frequency they are or how to find out.

Also does this model work with this binding?

https://www.gearbest.com/smart-home-controls/pp_255607.html

i am using the RM2 it looks the same as the RPO you just linked , not sure if there is any difference between them…

for RF , i was not able to get it to work , for RF i will recommend Sonff Bridge , you can get MQTT working on it…

I found great tool to learn ir codes from the remote. It works like a charm for my “RM mini 3”. Please download it from https://sourceforge.net/projects/broadlink-manager/files/Windows%207/Version%201.0.0.1/Broadlink%20Manager%201.0.0.1.zip/download
You can find discussion about it here https://community.home-assistant.io/t/broadlink-manager-nicer-way-to-learn-and-send-ir-rf-commands/58770

Note: You need to be connected to the same WiFi network as the Broadlink device for this application to work.

3 Likes

Hi All

Wondering how you deal with Split system Airconditions that use ‘state’ , ie in a single command they issue the temp, fan speed, on/off, swing etc etc.

It makes it difficult to display functions when units operate like this rather than having discrete codes for every function like a TV.

Cheers