Broadlink Integration - add support for RM4 Mini

the E-Control App won’t add the rm4 pro as a device…
I can only use the new broadlink app

HA version 0.109.4 released already
Does broadlink.send works for anyone with RM4C mini ?
It’s should be supported on version 0.109 already.

@alexmo - Are you defining it as a switch? The broadlink.send and .receive service use the switch definition, not the remote definition.

Sure,
It is not the first time that I’m using Broadlink RM mini,
I’ve only modified to '‘rm4c_mini’ instead of ‘rm_mini’ + the IP & MAC addressees
As following:

switch:
  - platform: broadlink
    host: !secret broadlink_host
    mac: !secret broadlink_mac
    timeout: 15
    type: 'rm2_pro_plus2'
    friendly_name: 'Broadlink kitchen'

  - platform: broadlink
    host: !secret broadlink_mini_host
    mac: !secret broadlink_mini_mac
    timeout: 15
    type: 'rm4c_mini' #'rm_mini'
    friendly_name: 'Broadlink parents bedroom'

Maybe I need to remove the device from Broadlink App first ?
I’ll check it later today.
Anyway did you manage to use the RM4C like I tried ?

I’m using the RM4 mini, but I had to:

  • remove it from the Broadlink app
  • re-enrol it on my network using python-broadlink and AP mode. The most succinct description of doing that is here: Broadlink RM4 Mini
  • run debug.py if you want, it will discover all local Broadlink devices - confirm local communication and create a file called debug.txt
1 Like

Thanks @zoogara

I used the python script, that you mention… and it’s finally working !!

Thanks again.

I am able to get so far to read from my RM4 Pro using the learn command. The light comes on and disappear after receiving an IR signal but I cannot find the command saved anywhere. This is not under STATES and also not under the Overview Page

Running HA 110.3

Please help

Thanks

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