I’ve been using the python code for a month now, it works great for many of my ir/rf devices but I have one peculiar action. I have an LED light strip that came with the RF remote, I have tried it with both the Broadlink app and the Blackbean script. Both work, but the script seems to randomly ‘bounce’ the code and the light switches momentarily and then switches back to its initial state (the code is for the power toggle since the remote doesn’t have a separate on/off). This is only the case for this remote (all other blackbean items work normally), and it works without the bounce effect in the broadlink app.
In the items file I just set the light’s ON and OFF to the same, I have also tried it with autoupdate=false to see if there was a difference. Switch Kitchen_led "Kitchen LED" {exec=">[ON:python /opt/openhab/BlackBeanControl/BlackBeanControl.py -c kitchen_led] >[OFF:python /opt/openhab/BlackBeanControl/BlackBeanControl.py -c kitchen_led]"}
Does anyone have insight as to what I might try differently?
Am I right in understanding that when you have two Blackbeans, for each you need to learn and store commands separately, since they will use different encryption? E.g. I want to tell my robotic vacuum to return to its base, and thus I fire the IR command on multiple blackbeans (I don’t know where the vacuum is). In that case, will I need to send different commands to each blackbean?
Yes, you are right. Broadlink uses something unit-specific to encrypt commands, so, there isn’t a way (at least to my knowledge) to share learned commands amongst Broadlink devices.
No I’m not sure this is right. I have two RM3s. I updated the broadlink-mqtt script to accept a mac address in the topic and it will fire the command at the specified device - but the command it sends is read from a file, and works on either device. So I can record a command on one, and fire the command out at the other one (if say learning commands for my stereo which is in another room).
Hello. I’m trying to use this python script… If I run the command from console, it works awesome and my tv turns on and off.
My problem is when I try to use it with Exec Binding. I actually have Openhab2, and the exec binding instructions are not clear.
I actually did so. Moreover, it happened to me that when I had to reset a rm3 because I changed the wifi ssid, all the previously stored commands were no longer working and I had to use the learn procedur again (basically canceling the content of the .ini file and sending commands through openhab again).
Edit: Davorf already pointed out this issue when he described the broadlink package
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.
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'])
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'
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
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 ?