Broadlink Integration - add support for RM4 Mini

I use the Broadlink integration remote.learn_command service call, this places them in a file where you can either use them directly, or grab them for SmartIR or for scripts. See the linked text below.

Use the configuration editor to look at the files after capture.

did you find a way to connect the RM4 Pro to HA ?

Yes there are a bunch of threads oultling how to do it, looks like you found some of them… :slight_smile:

Did you ever figure this one out? I’m using a RM4 mini, and I seem to be encountering the same issue you did.

I’ve setup the RM4 mini to AP mode, connected to it successfully via WiFi, installed the Python-Broadlink script, and run broadlink.setup, but nothing seems to happen.

There is no output or any apparent process that ran in Python, and the RM4 mini light is still flashing slowly as it was before.

I’ve tried this on 2 brand new RM4 minis (never added to the app), and the result is the same.

Running the debug.py script that @zoogara shared shows that no devices have been detected too.

Would appreciate any assistance here. Thank you!

Making some progress but still unable to get the RM4C to operate, now running HA 0.112.0 I get the following error:

Log Details (ERROR)
Logger: homeassistant.core
Source: components/broadlink/__init__.py:114
First occurred: 11:45:14 PM (3 occurrences)
Last logged: 11:46:32 PM

Error executing service: <ServiceCall broadlink.send (c:be8a7d4d90664fb691c0b4e3a76109ce): host=10.0.1.125, packet=[b'&\x00\x92\x00\x00\x01)\x92\x175\x17\x10\x17\x11\x175\x175\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x10\x17\x11\x17\x11\x17\x10\x17\x11\x17\x11\x16\x11\x175\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x175\x17\x11\x166\x16\x11\x17\x11\x175\x17\x10\x17\x00\x02\x90\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x10\x17\x11\x17\x11\x17\x10\x17\x11\x17\x11\x17\x10\x175\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x16\x11\x17\x11\x17\x11\x165\x17\x11\x175\x17\x11\x16\x00\r\x05\x00\x00\x00\x00\x00\x00']>
Error executing service: <ServiceCall broadlink.send (c:8de93a9f8f4a4035887fa067641840c4): host=10.0.1.125, packet=[b'&\x00\x92\x00\x00\x01)\x93\x166\x16\x12\x16\x12\x15\x12\x16\x12\x166\x16\x12\x15\x12\x165\x17\x12\x15\x12\x165\x17\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x166\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x165\x17\x11\x165\x17\x12\x16\x12\x157\x15\x12\x16\x00\x02\x90\x17\x11\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x165\x17\x12\x16\x12\x15\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x12\x15\x12\x166\x165\x17\x12\x15\x00\r\x05\x00\x00\x00\x00\x00\x00']>
Error executing service: <ServiceCall broadlink.send (c:6bb2dd347b66448496faa3288abdefe7): host=10.0.1.125, packet=[b'&\x00\x92\x00\x00\x01)\x93\x166\x16\x12\x16\x12\x15\x12\x16\x12\x166\x16\x12\x15\x12\x165\x17\x12\x15\x12\x165\x17\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x166\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x165\x17\x11\x165\x17\x12\x16\x12\x157\x15\x12\x16\x00\x02\x90\x17\x11\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x16\x12\x16\x12\x15\x12\x165\x17\x12\x16\x12\x15\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x11\x16\x12\x16\x12\x16\x12\x15\x12\x166\x165\x17\x12\x15\x00\r\x05\x00\x00\x00\x00\x00\x00']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1276, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1295, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/broadlink/__init__.py", line 114, in async_send_packet
    device = hass.data[DOMAIN][call.data[CONF_HOST]]
KeyError: '10.0.1.125'

My set up code is

    - platform: broadlink 
      host: 10.0.1.125
      mac: '24:DF:7A:42:6D:56'
      friendly_name: 'rmmini4-1' # Master bedroom
      type: rm4c_mini

Hard to tell but have you defined it as a switch, not a remote?

yes, its defined as a switch. I have four other RM3 working well with the same configuration. Is the RM4C supposed to be defined differently?

No - that’s fine. That was just the mistake I made :rofl:

do you have it working with rm4c_mini ?

Mine’s the RM4 mini, not the RM4C, but I have seen other users get the RM4C working.

Maybe post a new question in the forums - someone with the RM4C may be able to assist?

So over the weekend I had some luck getting it all operational. Keeping in mind my issues was getting the RM4 Pro RF learning and sending. I was working with Felipe Martins Diel (Broadlink RM4 PRO is not able to learn or to send RF Signal ¡ Issue #358 ¡ mjg59/python-broadlink ¡ GitHub) who i believe has a fix however it is going to be a while till we see it production. So in the interim this is how I am using it.

Short Version
Ensure you have the latest HA (I am on 0.112.2) not sure which version brought in the first set of fixes

  • Python-broadlink to add the RM4 to the wifi without cloud integration

    broadlink.setup(‘myssid’, ‘mynetworkpass’, 3)

  • Broadlink_Cli to capture the RF codes

    ./broadlink_cli --rfscanlearn --device “0x6026 [IPADDRESS] [MAC]”

  • Add the device into home assistant configuration.yaml
script:
  name_of_the_script:
    sequence:
      - service: broadlink.send
        data:
          host: [RM4 IP ADDRESS]
          packet: sgAsAhEREhESEQIEhEBEhESERISERIRARIiEQESERISERESEhEAAF3AAAAAAAAA==

The Long Version
Installing python-broadlink
Use a device with wifi (so you can connect to the Production Wifi and RM4 AP)

git clone GitHub - mjg59/python-broadlink: Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs
cd python-broadlink
sudo python setup.py install

Factory Reset (Ensure it is not cloud joined)

  • Reset hold reset button till flashes
  • Hold reset button to get hot spot paring
  • Join Computer to Broadlink WiFi to connect to the RM4

Setup RM using python-broadlink

  • Configure device for Wifi

    python import broadlink
    broadlink.setup(‘myssid’, ‘mynetworkpass’, 3)

  • Allow device time to reboot and connect to wifi (LED should no longer flash)
  • Test device communications

    devices = broadlink.discover(timeout=5) devices[0].auth() > should return true devices[0].host[0]
    Should return IP of Device

Capture RF sequences
NB Fix is underway for RM4 Pro broadlink.learn however not available in HA yet Broadlink RM4 PRO is not able to learn or to send RF Signal ¡ Issue #358 ¡ mjg59/python-broadlink ¡ GitHub

Use broadlink_cli to capture RF codes

  • Capture RF Sequence

    ./broadlink_cli --rfscanlearn --device “0x6026 [IPADDRESS] [MAC]”

  • Test Sequence from HA: Developer Tools > Services
    • Service: broadlink.send

    host: 192.168.1.13
    packet: sTgaAAcQBxAHDwgIDhAHEAcPCA8HCA4IDgkOCQ7+AAAAA

    • If no action re-capture using broadlink_cli otherwise good to use it for the scripts/switches

Home Assistant Configuration
I am controlling fans so I have a bit more of a complex configuration for fan speed control sending sequence directly

Sending RF Sequences with scripts/automation

script:
  name_of_the_script:
    sequence:
      - service: broadlink.send
        data:
          host: [RM4 IP ADDRESS]
          packet: sgAsAhEREhESEQIEhEBEhESERISERIRARIiEQESERISERESEhEAAF3AAAAAAAAA==

Configuration.yaml Switch

switch:
  - platform: broadlink
    host: [RM4 IP ADDRESS]
    mac: [RM4 MAC ADDRESS]
    type: rm4_pro
    timeout: 15
    switches:
      tv_samsung_power:
        friendly_name: "Samsung TV Power"
        command_on: '[RF SEQUENCE]'
      tv_samsung_volume:
        friendly_name: "Samsung TV Volume"
        command_on: '[RF SEQUENCE]'
        command_off: '[RF SEQUENCE]'
2 Likes

Setup RM mini 4 into AP Mode to connect with Broadlink app:

1- Long press the reset button until the blue LED is blinking quickly (like 7 seconds).
2- Long press again until blue LED is blinking slowly (like 14 seconds).

Configure RM mini 4 with Broadlink mobile application

1- Install broadlink app in your cellphone: https://play.google.com/store/apps/details?id=cn.com.broadlink.econtrol.international
2- First Open Press plus sign (+) to open menu then press Add device
3- Press Add a new device then press Universal Remote
4- Select your RM Version then press Next (My case RM4 mini - 2019 version)
5- Press button to confirm you are already connected

Add Air conditioner to RM Mini 4

1- Press RM mini already configured then press plus sign (+) to open menu
2- Select AC Remote Full Display
3- Press Add appliance button

Unlock RM Mini and Get IP address for Home Assistant

1- Press RM mini already configured
2- Press elipsis sign (…) to open menu
3- Press property
4- Disable toggle with label Unlock device
5- Press Device information then get IP Address displayed into their corresponding section

Docker configuration

1- Install docker in Raspberry with get.docker.sh script with curl

curl -fsSL https://get.docker.com/ | sh

2- Verify docker installation

docker --version

  • Start Home Assistant using docker-compose.yml

docker compose up -d

Home Assistant configuration

1- Navigate to http://localhost:8123/ in the raspberry or http://<raspberry.pi.ip.address>:8123/
2- Let Home Assistant to autodetect your location
3- Add Broadlink integration and set RM mini’s ip address given by broadlink mobile application
4- Click the device labeled with Chinese characters then click the gear icon and finally set a better readable name (My case RM Mini 4)
5- Stop Home Assistant Container from domotic-server directory with command: docker compose down
6- Clone repo GitHub - smartHomeHub/SmartIR: Integration for Home Assistant to control climate, TV and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome)
7- Copy custom_components into container/config directory generated by docker
8- Open container/configuration.yml then paste example configuration, defined in smartir/configuration.yml, below existing configuration
9- Set name and unique_id with values set on Broadlink mobile app for the Air Conditioner device

Cool, well done.

Will it work on other Broadlink remotes?

Thanks, can you please explain how to import the “broadlink” module?

When running python3 rm_config.py -s “xxx” -p xxx -m 3

from the Terminal (Mac) I got this error:
image

EDIT: ok I had to run “sudo python3 setup.py install” from GitHub - mjg59/python-broadlink: Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs beforehand

My device is joined to my network and I can ping it, but impossible to use the cli tool, please let me know if you have any idea :slight_smile:

Traceback (most recent call last):
  File "rm_config.py", line 74, in <module>
    main()
  File "rm_config.py", line 64, in main
    devices = broadlink.discover(timeout=5)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/broadlink-0.14.1-py3.8.egg/broadlink/__init__.py", line 115, in discover
    s.connect(('8.8.8.8', 53))  # connecting to a UDP address doesn't send packets

EDIT2: I solved all my issues by joining my RC4 mini using broadlink.setup() of GitHub - mjg59/python-broadlink: Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs, then specifying type: rm4c_mini in my configuration.xml. For some reason if I don’t specify the type, nothing is working. So easy fix :slight_smile:

You are totally right sorry for not incluing that in the readme.md
This is the command you need to run in the directory downloaded

pip3 freeze -r requirements.txt

Seems to have been solved. I was able to integrate the RM4C Mini with HA 0.115.1 using the new Broadlink integration.

1 Like

Broadlink integration just fails for me with Device not supported on RM4 mini. HA version is 0.115.2

2020-10-09 10:32:48 ERROR (MainThread) [homeassistant.components.broadlink] Unsupported device: 0x653a. If it worked before, please open an issue at https://github.com/home-assistant/core/issues

image

image

Just updated to HA version 0.116.4 still exactly the same problem. Perhaps change the integration documentation to not show these devices as supported when they are not. Is there any way to find out when the support will be added so I don’t upgrade HA for no benefit.

I just bought and installed an RM4 mini on October 14th and was able to install it the same day. There was a bit of a learning curve with getting the stupid thing to give up it’s “lock”, but around 10 factory restarts later and me about to throw it against the wall, it worked. Obviously it looks like others are working as well, so removing a known working model from the support documentation seems like it may be a bit counter-intuitive.

Since you haven’t really posted any steps that you went through to troubleshoot, I’ll go over generally what I did. First I would factory reset it by sticking a small pin into the reset hole for around 30 seconds. After 10 or so seconds it should blink slowly with something like 4 blinks and the a pause, then after another few, it will blink faster, about 4 times per second. Eventually it will blink super fast and reboot. At that point you can take the pin out and wait for it to start up. I personally didn’t have any luck with doing the “smart” install, though that could be my UTM blocking some kind of communication, so I had to go straight to the AP install. If the led is blinking rapidly, push the reset button for 10 or so seconds until it blinks slowly (4 then pause). Install the app on your phone and add the RM4 mini, that part should be painless. As soon as it’s joined, check your router or whatever is handing out DHCP leases to see what the IP address is. Throw it in there and try it out.

I will say that at first it wasn’t working, but that was likely because I was skipping a step earlier, so I eventually got fed up and finished adding the RM4 mini all the way through the cloud bit. When I tried adding then, I got some kind of error (likely what you have) and noticed in the configuration for the RM4 mini in the app that it said it was locked. Once I factory reset and did everything again, it seemed to work fine.

EDIT - Oh! Also, if you get to the cloud bit, try updating the firmware. I did that too and might be part of why it started working. You can check your firmware version off of what HA was reporting in my screenshot above since I believe that app shows it as well (don’t know for sure since I uninstalled it)

1 Like

Thanks very much for your kind assistance, @jarvistek. I think there may be different models of RM4 Mini and mine, which I purchased from a dealer here in Australia, may be somehow different in some way and just will not install in HA. I bought two of these, both paired up with the broadlink app (using the AP install method) with no problem and I have the broadlink app linked with Alexa and both RM4 minis work fine in the Broadlink app and with Alexa. The firmware version of both units is the same as yours. As soon as I try to add the broadlink integration in HA for either of my units it comes back with “device not supported”. I can see the lock switch in the broadlink app and I have tried adding to HA with it locked and unlocked but every time I just get “Device not supported”. Here is a screenshot of one device details from the broadlink app.

Here is a screenshot of what I get in HA. I would love to know if you ever saw this message in HA when you were having problems.

Also, could you let me know your version of HA. It seems that perhaps this integration may have worked in older versions of HA (like 0.109) but was perhaps broken in more recent versions (I started with 0.115}

Thanks again for your assistance, I really appreciate it.

Edit: Also there is a lot of confusing (to me) advice on other forums which says to stop the broadlink app installation at the point where the RM4 attaches to the router and then do the HA integration setup.
I didn’t do this because I need the broadlink app integration with Alexa but I’d love to know if you did it this way or went right through with the broadlink app installation before doing the HA integration. I actually have an RM4c Mini on order with Aliexpress but it will probably take 3 months to get here with the Covid delays. I was waiting for that to arrive to see if my problems are just a version issue.