Broadlink Manager - Nicer way to Learn and Send IR/RF commands

Hey
i have 1 rm3 mini, he is un living room, works ok with AC and TV, i have it in HA with Homekitstyle card
now i bout second rm3 mini, for bedroom, for AC and TV
i cant add it in e-control, first one is(i can see second, but cant do nothing with him˙) , dont know how did i manage add first
i added second in “ihc for eu”, then he shows in e-control,but dont work, and in IHC it works, first and second
added all for second as for first in HA but AC and TV dont respond
when scan with manager only shows first

I got more done with the Bond BD-1000 in a day trying to use RF than in a year with the Broadlink…

Hello, I´m really new in docker and althought I follow all the intructions, I´m still getting the same error broadlinkmanager | standard_init_linux.go:211: exec user process caused “exec format error” when I try to do the docker-compose up command. I modified the docker-compose file as you recommended but I do not know how to point to the github (I’m using a RPi 4 with rapsbian). Could you, pls, explain better what I have to do to solve the error? what are the commands/parameters that I have to modify? Thanks for your help!

Hi @gaosori
It’s already there:

``
Tomer,

I really appreciate your help. In summary, I installed docker in a Raspberry 4B with raspbian, and I installed a couple of containers to check that everything was working fine (rpi-monitor): After that, I tried to install broadlinkmanager, that is the tool that I really need and the only reason why I intalled docker, and I´m getting the following message when I try docker-compose up

  • I pulled again the container to be sure that I have the latest version, and I have both files in the broadlink directory.

My Dockerfile has:
ROM ubuntu:18.04

LABEL maintainer="[email protected]"

ENV PYTHONIOENCODING=utf-8

#install pip3
RUN apt update

RUN apt install python3-pip libffi-dev libssl-dev --yes

RUN pip3 install flask flask_restful cryptography==2.6.1 broadlink --no-cache-dir

#Create working directory
RUN mkdir /opt/broadlinkmanager
RUN mkdir /opt/broadlinkmanager/data

EXPOSE 7020

COPY broadlinkmanager /opt/broadlinkmanager

ENTRYPOINT ["/usr/bin/python3", “/opt/broadlinkmanager/broadlinkmanager.py”]

And the docker-compose.yaml

version: “3.6”
services:
broadlinkmanager:
image: techblog/broadlinkmanager
network_mode: host
container_name: broadlinkmanager
restart: always
restart: unless-stopped
volumes:
- ./broadlinkmanager:/opt/broadlinkmanager/data

What do you think is the problem? What am I missing? sorry for the basic questions, but really, this is my first time using docker… and thanks again for your help!!

Hi @gaosori,

@Tomer_Klein already updated his repository to support it. Try to use its GitHub directly to build your image. Replace this line in your docker-compose.yaml file from:

image: techblog/broadlinkmanager

To

build: https://github.com/t0mer/broadlinkmanager-docker.git

When running docker-compose up it should rebuild your image to raspberry pi.

Regards

Hi @gaosori ,
Alternatively you can git clone the project,
run the pip3 install command and then run

python3 broadlinkmanager.py

and it will run on your raspios without any need to use docker.

1 Like

@Tomer_Klein, @jrhbcn, Thanks!!! I did the suggested changes this afternoon and I was able to run the program!!! :slight_smile:

Running Docker-compose with host option for network

But I get the exact same problem as @alexspires. It’s scanning but can’t find any of my two RM4 on the same local network.
Tried the Winblows version (https://sourceforge.net/projects/broadlink-manager/) and that application can’t find them either…

Feels like Logitech Harmony, when they closed the API port in an update :-/

Hi @gaosori ,
Try running it with this setup (Dockerless):

1 Like

EDIT Reread the implementation guide for Broadlink…

Many users are experiencing problems with the new Broadlink RM Mini 3 and the entire RM4 series.
Once connected to the cloud, these devices lose their local capabilities and can no longer be controlled by Home Assistant.

Tried dockerless right now, same result. Got this from stdout:

.
.
192.168.254.200 - - [26/Jun/2020 11:18:47] "GET /autodiscover HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib/python3.8/site-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.8/site-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/cbdsadmin/git/broadlinkmanager-docker/broadlinkmanager/broadlinkmanager.py", line 384, in autodiscover
    if device.auth():
  File "/usr/lib/python3.8/site-packages/broadlink/__init__.py", line 225, in auth
    check_error(response[0x22:0x24])
  File "/usr/lib/python3.8/site-packages/broadlink/exceptions.py", line 97, in check_error
    raise exception(error_code)
broadlink.exceptions.AuthenticationError: Authentication failed

``
Thanks @tomer_Klein very clear instructions, easy to follow, and I installed the program in a couple of minutes. Just one comment, in the part B, the command sudo cd /opt does not work, it is just cd /opt
image

The sad part is that I´m having the same issue than @snis and @alexspires , the app stays scanning and never find the 2 remotes that I have in my network (RM mini 3 and RM4 Pro). Any suggestion how to solve that? Any help will be very appreciated :slight_smile:

Just as a reference: the old app (windows version) finds only the mini without issue, but when it finds the RM4 pro, it shows the message ¨Writing compatible device not detected¨, and I cannot connect to the RM4 that is the one with the RF commands that I need.
image

I

2 Likes

Hi Tomer,

Do you know when you release new version BM for Win? I have the same issue with RM 3 mini. Do you check this issue as a bug? 105968747_3275369365820605_1915209052183613751_n

Good Afternoon,

I have followed the link to TechBlog about installing Broadlink Manager on a Raspberry Pi. I was able to find my RM4 Pro(0x61a2). When I try and learn an RF code the webpage spits back that there was an Error while scanning, please try again. Looking at the command prompt, I see there is an issue with sweep_frequency. Any advice on how to proceed would be appreciated.

P.S. I also have issues trying to learn IR codes.


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/broadlinkmanager-docker/broadlinkmanager/broadlinkmanager.py", line 280, in sweep
    dev.sweep_frequency()
AttributeError: 'device' object has no attribute 'sweep_frequency'

I met the same as you. sad

ứng dụng này không thể điều khiển RM mini 3 và RM 4 pro. cả 2 thiết bị mà tôi có. hic hic

"
I also encountered this same application which cannot control RM mini 3 and RM 4 pro. both of the devices that I have. understand like you. sad"

I Figured I had started my Journey in this thread so I may as well post the solution I am using. 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]'
1 Like

Thanks for the instructions!

I got to the point where I’m attempting to capture RF sequences using the broadlink_cli command, but it seems like I don’t have it installed properly or something.

I get the following error instead
File "<stdin>", line 1 ./broadlink_cli --rfscanlearn --device "0x6026 [IP] [MAC]" ^ SyntaxError: invalid syntax

I installed python-broadlink via PIP, but I’m not sure where the files actually are to verify if the cli directory is in there.
I also downloaded the broadlink_cli and broadlink_discovery files to manually copy them if necessary, but again, I’m not sure where they should go.

Would appreciate any help here. Thanks!

@quagmired given it is responding with a syntax error it sound to me like it is recognising the command just not the parameters being passed. So I think the install is ok.

Just to be clear [IP] needs to be your devices IP address and [MAC] needs to be the devices MAC address so the actual command I run is

./broadlink_cli --rfscanlearn --device “0x6026 192.168.1.13 24dfa7b9c05a”

At work at the moment so I can’t confirm the location my files installed to. However, hoping the above might help. Keep in mind wherever i use [CAPITALS] it generally means replace with your values.