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


(John Marshall) #653

I reckon we go with a completely clean slate - option 2. Then I’ll write one big post to head up the “Next-Gen” topic, with everything up-to-date as of now; installation, discovery, how to store IR codes on IR blaster devices, known issues, etc.


(John Marshall) #654

One (possibly!) last announcement on this thread - BETA-9 is now available:

https://dl.bintray.com/themillhousegroup/generic/org.openhab.binding.broadlink-2.4.0-BETA-9.jar

The main feature of this version is support for Dynamic IP Addresses.
There is a new switch available under the advanced Thing properties (open the SHOW MORE area in PaperUI) - it’s marked “Static IP” and it defaults to ON. If you are on a network where your Broadlink device might periodically be issued a different IP address, move it to the OFF position.

Now, if we lose communications with this Thing, rather than mark it OFFLINE, we’ll go into a mini-Discovery mode, and attempt to find the device on the network again, using its MAC address (which never changes).
If we find the device, we update its current IP address in its Thing config, and everything continues without a hiccup. If we fail to find it, it goes OFFLINE as normal.

I should give credit to the LIFX binding which uses a very similar scheme - by chance I happened to come across it and realised it would be great for Broadlink devices too. As an extra bonus, it prompted me to redesign the entire discovery system and make it asynchronous; as a result it is now MUCH more reliable at finding devices (particularly if you have multiple Broadlink devices on your network) without having to scan repeatedly.

I know there have been people in this thread who were looking for this feature - hopefully they can give this a try and give some feedback!


(Smhgit) #655

@themillhousegroup
Thx for your continues improvements!!! I have just downloaded the new version and will report


(Gad Ofir) #656

agree with DIM i want to help pepole here , and i am not even able to find the orginal instractions …


(Angelos) #657

Give John some time to complete his stuff and he will create a new, nice, clean thread for his developments :slight_smile: See here: Broadlink binding for RMx, A1, SPx and MP. Any interest?

I like his blog posts by the way :slight_smile: http://blog.themillhousegroup.com/2018/12/green-millhouse-ok-google-turn-on.html


(Smhgit) #658

@themillhousegroup

I still have issue with my second rm3 (rm3-2). I suspect it is related to the fact that the connection to the device is not “perfect” (see pings below). Is this something that can be handled in the binding (e.g., increase wit time for response etc.)?

2018-12-07 11:43:12.359 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e0-b2-44: updateItemStatus; checking host availability at rm3-1.lan
2018-12-07 11:43:18.497 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateItemStatus; checking host availability at rm3-2.lan
2018-12-07 11:53:12.369 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e0-b2-44: updateItemStatus; checking host availability at rm3-1.lan
2018-12-07 11:53:21.506 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateItemStatus; checking host availability at rm3-2.lan
2018-12-07 11:53:21.924 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: We've never actually successfully authenticated with this device in this session. Doing so now
2018-12-07 11:53:21.926 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Authenticating with packet count = 52609
2018-12-07 11:53:21.931 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Sending authentication to rm3-2.lan:80
2018-12-07 11:53:21.934 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Sending authentication complete
2018-12-07 11:53:21.936 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Receiving authentication
2018-12-07 11:53:21.976 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Authenticated with id '02000000' and key 'F991BF12F991BF122F0536026678AC71'.
2018-12-07 11:53:21.979 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Authenticated with newly-detected device, will now get its status
2018-12-07 11:53:21.980 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-e3-c1-ca' has been updated.
2018-12-07 11:53:21.982 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateStatus: Offline -> Online
2018-12-07 11:53:21.983 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-e3-c1-ca' has been updated.
2018-12-07 11:53:21.994 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-e3-c1-ca' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address rm3-2.lan to ONLINE
2018-12-07 12:03:12.377 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e0-b2-44: updateItemStatus; checking host availability at rm3-1.lan
2018-12-07 12:03:21.987 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateItemStatus; checking host availability at rm3-2.lan
2018-12-07 12:03:24.999 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Statically-IP-addressed device not found at rm3-2.lan
2018-12-07 12:03:25.003 [ERROR] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateItemStatus: Online -> Offline
2018-12-07 12:03:25.013 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-e3-c1-ca' has been updated.
2018-12-07 12:03:25.022 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-e3-c1-ca' has been updated.
2018-12-07 12:03:25.031 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-e3-c1-ca' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address rm3-2.lan
2018-12-07 12:13:12.390 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e0-b2-44: updateItemStatus; checking host availability at rm3-1.lan
2018-12-07 12:13:25.028 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: updateItemStatus; checking host availability at rm3-2.lan
2018-12-07 12:13:25.441 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: We've never actually successfully authenticated with this device in this session. Doing so now
2018-12-07 12:13:25.444 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Authenticating with packet count = 52610
2018-12-07 12:13:25.449 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Sending authentication to rm3-2.lan:80
2018-12-07 12:13:25.452 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Sending authentication complete
2018-12-07 12:13:25.455 [TRACE] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Receiving authentication
2018-12-07 12:13:30.465 [DEBUG] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: No further authentication response received for device
2018-12-07 12:13:30.468 [ERROR] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Authenticate - failed to receive.
2018-12-07 12:13:30.473 [ERROR] [nk.handler.BroadlinkBaseThingHandler] - broadlink:rm3:34-ea-34-e3-c1-ca: Attempting to authenticate prior to getting device status FAILED


PING rm3-2.lan (192.168.0.102): 56 data bytes
64 bytes from 192.168.0.102: icmp_seq=0 ttl=255 time=51.937 ms
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
64 bytes from 192.168.0.102: icmp_seq=3 ttl=255 time=59.792 ms
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6

(John Marshall) #659

Wow @smhgit that’s certainly going to be a challenge to handle!

In order to deal with such an unreliable connection, every single time we send a packet to the device, we’ll have to be able to retry it if we didn’t receive a reply.

I’ll admit my first instinct was “too hard, don’t do it” … but … my goal for this binding has always for it to be really robust and reliable. Dealing with lossy networks is definitely something that reliable software does. So leave it with me, and let’s see what I can do for BETA-10 :slight_smile:


(Smhgit) #660

@themillhousegroup

Great, thx! i thought of trying to improve the connection but I will keep it that way so you will have a debug site for your next version :slight_smile:


(Smhgit) #661

@themillhousegroup

One more thing, currently I check for broadlink device online with network binding:

Switch Rm3_1_Online "RM3 [MAP(online.map):%s]" { channel="network:pingdevice:34-ea-34-e0-b2-44:online" }

Can something like LIFX thing status can be added to the binding?


(Bud Kernell) #662

You are a myth John !
Thank you for your time and your interest!


(Bud Kernell) #663

Hi.
I have a strong connection and 2 rm3.
But randomly i lost connection with my black beans.
Maybe the problem is not only a poor connection.
:confused:


(Dario) #664

Hey @themillhousegroup

I have a question that might be of use.

Once sorted the rules and groups, i shoudl be able to command 3 fans+3dimmable lights+3led nightlights with your binding.

Whereas if i issue a group command like “switch all the sockets on” that conearns z-wave devices, each with its own timing, but they will switch on, i wander what would happen if i was going to make a group of the rf433 fans and issue the command “turn all the fans on”.
Is there some kind of a buffer of queueing of commands included within the binding (as the RM3 suerly can’t send 3 rf433 signals at once) or would it be better to chain such a command in a rule with a staggered start?

thank you for your hard work, really appreciated.


(Jorg Coevert) #665

I’ve got the same issue with the errors in the log file.
The SP3 works ok manually and with rules, also status of the device seems ok, but these communication errors stay in the logs…

2018-12-09 07:30:58.125 [.event.RuleStatusInfoEvent] - 02e707eb-7160-4b21-871e-2dab536ac5de updated: IDLE
2018-12-09 07:30:58.131 [vent.ItemStateChangedEvent] - BroadlinkSW_B changed from ON to OFF
2018-12-09 07:46:08.758 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 07:46:38.966 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 09:16:57.097 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 09:17:27.232 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 09:38:04.929 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 09:38:35.062 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 11:14:22.922 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 11:14:53.081 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 13:48:24.617 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 13:48:54.817 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 14:38:06.372 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 14:38:36.582 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE

2018-12-09 14:48:13.330 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13
2018-12-09 14:48:43.460 [hingStatusInfoChangedEvent] - 'broadlink:sp2:34-ea-34-f5-aa-72' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.178.13 to ONLINE
2018-12-09 16:30:10.081 [.event.RuleStatusInfoEvent] - b8777c82-9aa2-4b48-a410-ec6855f71e98 updated: RUNNING
2018-12-09 16:30:10.095 [ome.event.ItemCommandEvent] - Item 'BroadlinkSW_B' received command ON
2018-12-09 16:30:10.100 [.event.RuleStatusInfoEvent] - b8777c82-9aa2-4b48-a410-ec6855f71e98 updated: IDLE
2018-12-09 16:30:10.116 [vent.ItemStateChangedEvent] - BroadlinkSW_B changed from OFF to ON

(John Marshall) #666

Hmmm it looks like it’s flip-flopping every polling interval. @Jorg, could I get you to set the log level to TRACE for the Broadlink binding so (hopefully) I can see why it’s doing that? In the OpenHAB console:

log:set TRACE org.openhab.binding.broadlink

Thanks!


(John Marshall) #667

While I’m here; BETA-10 is now available:

https://dl.bintray.com/themillhousegroup/generic/org.openhab.binding.broadlink-2.4.0-BETA-10.jar

This version fixes a few small issues:

  • RM3 devices can now have a polling frequency specified (this was an omission from the thing-types.xml configuration file)
  • Thing logging extracted to its own class and improved: Device status ONLINE/OFFLINE/undetermined shown in logs as ^/v/? respectively
  • Each ThingHandler’s network socket is now explicitly closed when we lose contact with the device. This seems to help subsequent reconnections.

(Rhapen) #668

Hello guys,
created little tutorial based on my experience setting up RM3 mini. hope it can help someone :wink:
https://diyiot.000webhostapp.com/2018/12/controling-universal-remote-control-broadlink-rm3-by-openhab


(Smhgit) #669

Hi @themillhousegroup

I thought the pollingInterval was already there (or at least I use it and it seems working)

Thx for your hard work!!! will download, check and update


(Mihai Badea) #670

Just wanna share that it works with a Broadlink SC1 (https://m.banggood.com/Broadlink-SC1-DIY-Smart-Switch-WiFi-APP-Control-Box-Timing-Switch-Wireless-Remote-Controller-p-1143214.html)
Using beta10, device is found as SP2 - probably the same hardware.
Everything works properly after putting the authentication and IV key.


(Bud Kernell) #671

Hi people,
3 hours without disconnections…it seems this beta is working very well :smile:
I keep watching the logs…
:slight_smile:


(Bud Kernell) #672

One black bean go down…but after that…go up again and works…
thats great :smiley:
Logs:

2018-12-10 22:47:09.347 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-58-b9-ba' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.2.120

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

2018-12-10 22:47:24.154 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:78-0f-77-18-3c-81[^]: updateItemStatus; checking host availability at 192.168.2.121

2018-12-10 22:47:39.339 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: updateItemStatus; checking host availability at 192.168.2.120

2018-12-10 22:47:39.747 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: We've never actually successfully authenticated with this device in this session. Doing so now

2018-12-10 22:47:39.752 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Authenticating with packet count = 58181

2018-12-10 22:47:39.756 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: building message with count: 58182, id: 00000000, key: 097628343FE99E23765C1513ACCF8B02

2018-12-10 22:47:39.763 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Sending authentication to 192.168.2.120:80

2018-12-10 22:47:39.769 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: No existing socket ... creating

2018-12-10 22:47:39.774 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Sending authentication complete

2018-12-10 22:47:39.779 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Receiving authentication

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

2018-12-10 22:47:39.828 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-58-b9-ba' has been updated.

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

2018-12-10 22:47:39.879 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Authenticated with id '01000000' and key '821FA60FB9921C7FEF05936E2679095E'.

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

2018-12-10 22:47:39.881 [me.event.ThingUpdatedEvent] - Thing 'broadlink:rm3:34-ea-34-58-b9-ba' has been updated.

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

2018-12-10 22:47:39.885 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: Authenticated with newly-detected device, will now get its status

2018-12-10 22:47:39.890 [DEBUG] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[v]: updateStatus: Offline -> Online

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

2018-12-10 22:47:39.898 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-58-b9-ba' changed from OFFLINE (COMMUNICATION_ERROR): Could not find device at IP address 192.168.2.120 to ONLINE

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

2018-12-10 22:47:54.565 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:78-0f-77-18-3c-81[^]: updateItemStatus; checking host availability at 192.168.2.121

2018-12-10 22:48:09.897 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:34-ea-34-58-b9-ba[^]: updateItemStatus; checking host availability at 192.168.2.120

2018-12-10 22:48:24.975 [TRACE] [.handler.AbstractLoggingThingHandler] - broadlink:rm3:78-0f-77-18-3c-81[^]: updateItemStatus; checking host availability at 192.168.2.121