Broadlink Manager - Docker version

Tags: #<Tag:0x00007f739ed4b2c8>

Hi All,
Happy to present the new Braodlink Manager Version.
This one runs on Docker Container and accessible via any web browser.
This version has more capabilities than the old one:

  1. Scaning for devices.
  2. Learn & Send RF.
  3. Learn & Send IR.
  4. Generate Random RF Code (315/433).
  5. Livolo Code Generator.
  6. Energenie Code Generator.
  7. Change number of repeats in existing code (RF/IR).
  8. Convert Hex to Base64 and Base64 to Hex.

Todo:

  • Import data from Broadlink app.
  • convert IRDB/Lirc codes to Broadlink Format.
  • Add Rest API

You can find all the information in my Git Repo:

Update
I have added support for the following:

  • Saving / Loading devices list from/ json file
  • Added data folder (for saved fils)
  • added the abillity with changing devices names

Cheers

11 Likes

Nice work! Are you planning to make a Hassio addon from this docker image as well?

7 Likes

That would be awesome!

Nice work!

Hi Tomer and many thanks for creating this! :smile:
I’ve been trying for months on and off to learn RF codes from my RM2 Pro Plus3 without success, and your software is a welcome new avenue.
I’ve installed it in Docker on my Linux PC and it finds my RM2 device fine. When I try to learn RF code it goes through the first stage of scanning frequency, and asks me to press the ‘continue’ button, but comes back with

Error occurred while scanning, please try again

I feel I must be doing something wrong - any ideas or suggestions please? Can I supply any further information to help diagnose the problem?

EDIT: I found this in the log through Portainer…


192.168.1.12 - - [10/Jun/2020 20:55:06] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:07] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:08] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:09] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:10] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:11] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:11] "GET /rf/continue HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:12] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:13] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:14] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:15] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:16] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:17] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:18] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:19] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:20] "GET /rf/status HTTP/1.1" 200 -


192.168.1.12 - - [10/Jun/2020 20:55:21] "GET /rf/status HTTP/1.1" 200 -


/usr/local/lib/python3.6/dist-packages/werkzeug/filesystem.py:60: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ascii'


  BrokenFilesystemWarning,


192.168.1.12 - - [10/Jun/2020 20:55:22] "GET /rf/learn?type=0x279d&host=192.168.1.143&mac=780f77b94241 HTTP/1.1" 500 -

The line about broken file system doesn’t look right, and it comes soon after I pressed Continue, but after googling the warning, I’m not sure it matters.

Hi @AndrewJ,
I have found the problem.
Add this to your docker-compose:

    environment:
      - PYTHONIOENCODING=utf-8

It will fix your problem.

I’m adding it by default to the next update

Cheers

Thanks for fast reply, Tomer. I’ll try this later and let you know how it goes.

Hello again Tomer,
I just tried the revised docker-compose file as per your suggestion, but sadly I’m still getting the same error in the web interface…

Error occurred while scanning, please try again

In the container log (via Portainer) I see this…


192.168.1.12 - - [11/Jun/2020 19:34:58] "GET /rf/status HTTP/1.1" 200 -


/usr/local/lib/python3.6/dist-packages/werkzeug/filesystem.py:60: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ascii'


  BrokenFilesystemWarning,

This is my edited docker-compose file, including the change you suggested. Have I understood your suggestion correctly?

version: "3.6"
services:
  broadlinkmanager:
    image: techblog/broadlinkmanager
    network_mode: host
    container_name: broadlinkmanager
    restart: always
    restart: unless-stopped
    environment:
      - PYTHONIOENCODING=utf-8

Actually, now I look again, I noticed on the next line of the log I get…


192.168.1.12 - - [11/Jun/2020 19:34:59] "GET /rf/learn?type=0x279d&host=192.168.1.143&mac=780f77b94241 HTTP/1.1" 500 -

I think this is a network error. I’m not very familiar with http error codes, but the “500” looks like some kind of server error (I guess in this case the “server” is the Broadlink RM2Pro Plus3??) Is this perhaps the Error referred to in the web interface, and the reason that no code is learned?
Any further ideas how to debug this, please?

Hi @AndrewJ,
Still working on it.
Hope to solve it soon/

Hi, Tomer,
Thanks for the update.

Hi @AndrewJ,
Please pull the latest version.
I have fixed the bug and it’s working like charm.

Cheers

Hi @Tomer_Klein,
I still get the error, although I updated to the last version (version of June 16).
Here’s my container log:

* Serving Flask app "broadlinkmanager" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:7020/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 303-923-301
192.168.2.2 - - [16/Jun/2020 14:51:12] "[37mGET / HTTP/1.1[0m" 200 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /css/adminlte.min.css HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/bootstrap.bundle.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/jquery.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /css/all.min.css HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/adminlte.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/hex.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/home.js?V=4 HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:12] "[36mGET /js/clipboard.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:16] "[36mGET /img/broadlink.png HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:51:16] "[37mGET /img/clippy.svg HTTP/1.1[0m" 200 -
192.168.2.2 - - [16/Jun/2020 14:51:23] "[37mGET /discover HTTP/1.1[0m" 200 -
/usr/local/lib/python3.6/dist-packages/werkzeug/filesystem.py:60: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ascii'
BrokenFilesystemWarning,
192.168.2.2 - - [16/Jun/2020 14:51:30] "[35m[1mGET /ir/learn?type=0x2733&host=192.168.2.13&mac=34ea34f5aa72 HTTP/1.1[0m" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/broadlinkmanager/broadlinkmanager.py", line 201, in learnir
dev.enter_learning()
AttributeError: 'sp2' object has no attribute 'enter_learning'
192.168.2.2 - - [16/Jun/2020 14:51:32] "[35m[1mGET /rf/learn?type=0x2733&host=192.168.2.13&mac=34ea34f5aa72 HTTP/1.1[0m" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/broadlinkmanager/broadlinkmanager.py", line 247, in sweep
dev.sweep_frequency()
AttributeError: 'sp2' object has no attribute 'sweep_frequency'
192.168.2.2 - - [16/Jun/2020 14:53:27] "[37mGET / HTTP/1.1[0m" 200 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /css/all.min.css HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/bootstrap.bundle.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/hex.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /css/adminlte.min.css HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/jquery.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/adminlte.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/home.js?V=4 HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:27] "[36mGET /js/clipboard.min.js HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:31] "[36mGET /img/broadlink.png HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:53:31] "[36mGET /img/clippy.svg HTTP/1.1[0m" 304 -
192.168.2.2 - - [16/Jun/2020 14:55:13] "[35m[1mGET /ir/learn?type=0x2733&host=192.168.2.13&mac=34ea34f5aa72 HTTP/1.1[0m" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/broadlinkmanager/broadlinkmanager.py", line 201, in learnir
dev.enter_learning()
AttributeError: 'sp2' object has no attribute 'enter_learning'
192.168.2.2 - - [16/Jun/2020 14:55:15] "[35m[1mGET /rf/learn?type=0x2733&host=192.168.2.13&mac=34ea34f5aa72 HTTP/1.1[0m" 500 -
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
return original_handler(e)
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/broadlinkmanager/broadlinkmanager.py", line 247, in sweep
dev.sweep_frequency()
AttributeError: 'sp2' object has no attribute 'sweep_frequency'
192.168.2.2 - - [16/Jun/2020 14:55:30] "[37mGET /about HTTP/1.1[0m" 200 -
192.168.2.2 - - [16/Jun/2020 14:55:40] "[37mGET / HTTP/1.1[0m" 200 -

As it seems from the log you are trying to Sweep (Learn RF) using Broadlink SP2 .
SP2 cannot be used for learning RF Signal.

I got it up and running, nicely done! But for some reason it’s still searching for device… but my HA can see and communicate with it just fine.

Hi @firestrife, please run the docker with host mode network,
that should fix it.

Unfortunately I get this error with both ‘Learn IR code’ and with ‘Learn RF code’.
It is also strange that:

  • my device is a SP3 (see picture attachment)
  • Broadlink manager thinks it’s a SPMini
  • the error says “sp2 object has no attribute”

Could this be the cause of the problem?


@Tomer_Klein, you are the greatest! Thank you so much, it is now working. When I first tried it, I still got an error, but after completely removing everything and starting afresh, it worked! :grinning:

@Tomer_Klein
Is there any way to solve this?

Hi @Tomer_Klein,

Thank you for this awesome contribution! Though I can’t seem to be able to discover any devices on my network, even though my RM4C Pro is available on the network and Home Assistant can send IR commands to it. I hope I get this working too, but I’m getting this error below:

/usr/local/lib/python3.6/dist-packages/werkzeug/filesystem.py:60: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ascii'
  BrokenFilesystemWarning,
172.16.10.30 - - [21/Jun/2020 13:56:05] "GET /discover HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask_restful/__init__.py", line 272, in error_router
    return original_handler(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/broadlinkmanager/broadlinkmanager.py", line 311, in discover
    timeout=5, local_ip_address=None, discover_ip_address="255.255.255.255")
  File "/usr/local/lib/python3.6/dist-packages/broadlink/__init__.py", line 79, in discover
    local_ip_address = socket.gethostbyname(socket.gethostname())
socket.gaierror: [Errno -2] Name or service not known

I’m running the docker container on the same Hassio Host through Portainer, with the mentioned container setup on Github (i.e. host network). I also added the ENV variable you mentioned earlier here, by adding PYTHONIOENCODING=utf-8 but that doesn’t seem to do anything.

I hope we can work this out and squash the bugs on this one!

Thank you in advance for your help.

Cheers

I could not understand it.
I installed HASS rasperry Pi. After I installed the docker on my Pi, I installed it on the BroadLink Manager.
So what do I do with HASS to configure device drivers on roadLink?
Would you mind explaining and helping?

I’ve installed the docker image but I am getting ‘refused to connect’. Probably something basic I am overlooking.

Chrome says “ERR_CONNECTION_REFUSED”. I just go to ip address:7020 right?

It is running on the same docker installation as Home Assistant.

Perhaps this is useful:

Container looks like this: