Broadlink Black Bean (RM 3 Mini) IR Controller - Integration in OpenHAB

Cato,

It’s working pretty good for R3mini, but it does not work with R3 Pro, do you know how to capture RM3 pro? I can’t find a way to do that…

Hello all,
although when running the command

python /home/openhabian/addons/BlackBeanControl/BlackBeanControl.py -c SamsungTVPower

from command line works, trying this from a rule

executeCommandLine("/usr/bin/python /home/openhabian/addons/BlackBeanControl/BlackBeanControl.py -c SamsungTVPower", 5000)

returns this to the log

File “/home/openhabian/addons/BlackBeanControl/BlackBeanControl.py”, line 5, in <module>
import configparser
ImportError: No module named configparser

User openhabian is added to visudo like so

root    ALL=(ALL:ALL) ALL
openhabian ALL=(ALL) NOPASSWD: ALL

What am I doing wrong ?

Regards

Hello!

Do you have Python 2.X and Python 3.X installed in parallel? Maybe calling python and /usr/bin/python calls different instances (one you’ve installed configparser to, and the other you haven’t. I’m not using Python on Linux, so, this is just a guess.

Best regards,
Davor

Hello @davorf,
I do have both but

[13:30:12] openhabian@openHABianPi:~$ ls /usr/bin/python*
/usr/bin/python   /usr/bin/python2.7         /usr/bin/python2-config  /usr/bin/python3.5   /usr/bin/python3m
/usr/bin/python2  /usr/bin/python2.7-config  /usr/bin/python3         /usr/bin/python3.5m  /usr/bin/python-config
[13:30:30] openhabian@openHABianPi:~$ which python
/usr/bin/python
[13:30:51] openhabian@openHABianPi:~$ python --version
Python 2.7.13

and also running python --version also replied

13:34:21.918 [INFO ] [ipse.smarthome.model.script.execTest] - Python 2.7.13

What can be wrong in this case ?

Regards

Hello!

As I’ve said, I don’t have Linux to test this on, but you can try and install/upgrade configparser in all the versions you have. By looking at the lines in your post above, I don’t know if there are 2.7 and 3.5 only, or there are python2 and python as separate installs too. So, to be sure you did this in 2.7 and 3.5 at least, start each version (so, you can see which one is it when Python shell is started), and use following commands to install/update configparser:

import pip._internal as pip
pip.main(['install'] + ['configparser'] + ['--upgrade'])

Best regards,
Davor

Hello @davorf,
I got the following errors

Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip._internal as pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named _internal
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip._internal as pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pip'

Is there anything else to try ?

Regards

Found the problem in my case. I am using openhabian and run the pip install commands from the openhabian user. The exec command though uses openhab user. For future reference you have to install the pip packages from the davorf github page above using this format

sudo -H -u openhab pip install --user package i.e.
sudo -H -u openhab pip install --user configparser

You do this for configparser, netaddr and pycrypto.

Thanks

1 Like

Hello, I get an error similar to yours and I can’t solve my problem.
My mistake:
sudo -u openhab /usr/share/openhab2/exec/BlackBeanControl/BlackBeanControl.py -c Tv_on

Traceback (most recent call last):
File “/usr/share/openhab2/exec/BlackBeanControl/BlackBeanControl.py”, line 3, in
import broadlink, configparser
ImportError: No module named configparser

Can you help me solve the problem? Thanks in advance

Hello Antonio,
did you run the sudo -H -u openhab pip install --user configparser, sudo -H -u openhab pip install --user netaddr and sudo -H -u openhab pip install --user pycrypto commands ? But first of all, are you on openhabian ?

Hello, first thank you very much for answering.
I don’t have openhabian, I have Raspbian. Do the commands change ?? thanks again

Solved the python problem. now it only remains to synchronize with openhab

i am not sure about the user permissions in raspbian but since the python problem is gone what do you mean synchronize with openhab?

Hi,

Can someone please tell me how I can learn the codes as this (http://rm-bridge.fun2code.de/rm_manage/code_learning.html) is giving me errors for all my devices.

Thanks,

Pim

You have the bridge app running? What is the error? Does the bridge website recognize your device? If you are getting an ERROR: 404 message then you might not be communicating with the app - make sure it is running and the code_learning page is pointed at the correct IP address/port.

The bridge is running, it’s just saying it’s not a RM2, which I am pretty sure it is. It did work before.

When I have everything running and I click ‘Load Devices’ on the code-learning page the page just auto-loads the Broadlink device info (chinese characters and Mac address) in the ‘Step 2’ section, it doesn’t say anything about what type of Broadlink it is. Did the phone that the bridge is running on get a new IP?

They load alright, it’s when I hit the learn button that I get this error. I did get a new phone so the IP address would be different.

Does your RM Pro’s orange light come on when you click on learn? Is it a 404 Error or a different code?

Hi Hardy,

First off, thank you for helping me.

Yes, the light goes on when I start the searching, but no codes come through.

Pim

Does RM4C mini work with OpenHAB ? Has anything changed since the post was started?

I have got it to work through MQTT.