I forgot to mention that you will need to install pycrypto and netaddr packages in Python besides packages required for previous version.
Best regards,
Davor
I forgot to mention that you will need to install pycrypto and netaddr packages in Python besides packages required for previous version.
Best regards,
Davor
Hi davor,
We also need to install broadlink module, right?
Also, how does learning process work? Will it automatically write learned codes in the .ini file with particular command names?
Thanks
EDIT: ignore the question. Missed the last paragraph from your previous post
Hello Farhanito!
Yes, I forgot to mention youāll have to install broadlink module too. The easiest way to do it would be downloading it from github, and running setup.py. If youāre using both Python 2.X and Python 3.X make sure you install all additional modules to the right version (2.X)
Best regards,
Davor
By the way, you should download latest version with some code cleanup.
Best regards,
Davor
Hi Guys,
I have a RM3 Mini and have been watching this thread develop and all the work that has gone into it⦠what determination!
Iāve trying to duplicate some of the methods that have been suggested without success so far.
For my latest efforts -
installed e-Control app and captured the power toggle command for my AVR, which works from the app
installed tPatcketCapture on my phone
started e-Control
started tPacketCapture and put in running state with VPN
toggled power from e-Control to AVR (AVR powered off)
stopped tPacketCapture
Copied the file to my (windows) laptop for analysis with wireshark.
When looking at the packets in wireshark I can see traffice to and from my phone, and some broadcast packets, but no packets directed to the IP address of the RM3.
My phone is connected to the same wireless network as the RM3.
Did I miss something in my procedure?
Also, it seems from the latest posts that the python script can now be used to capture packets during learning, is that correct? If so, could someone give the steps for how this is setup? ie, what has to be connected to network, wireless etc?
Thanks,
Hello Will!
Since Farhanito posted a broadlink package few days ago Iāve changed my script to use that package instead of intercepted UDP payload. Now itās also possible to learn commands directly within a script, so you can avoid usage of e-Control app and packet sniffer. Youāll need to download a broadlink package from the github (you can find a link in a post from Farhanito), and run setup.py to install it. Note that you must use Python 2.X, because said package doesnāt work with Python 3.X. Besides manually installing broadlink package, you must install netaddr and pycrypto (you can do this via pip install). After that, just fill in IPAddress, Port, MACAddress and Timout in BlackBeanControl.ini and run BlackBeanControl.py with switch -c CommandName. That will put RM 3 into learning mode for X seconds (Timeout parameter in BlackBeanControl.ini - should be less than 60 seconds). After that, you should use the button on the remote you wish to learn from. Finally, just call BlackBeanControl.py -c CommandName with a name of the command youāve learned and it will trigger that command.
Best regards,
Davor
Hi Davor
do you know if it works with RM2 devices?
thanks
Hello Diego!
The broadlink package Farhanito posted is meant for RM2 (as far as I know). Regarding my script, itās pretty easy to set it up and test on your device, so you should just try and see if it works. I donāt have RM2, so I canāt tell you from my experience.
Best regards,
Davor
Thanks a lot
I installed and i can confirm it works with RM2
Ok so just to clarify Farhanitoās script does support RM3 Mini? In the description it says RM2.
Thanks
Also, is the idea here that we will always use the python script via the EXEC binding to use the RM3 with openhab? Or is the intention here to use the python script to get (learn) the code which we extract and use in UDP send command?
I have python 3 running on my raspi which is also running openhab. Iām not sure how well an install of python2 will co-exist on the same device. Can I install as you have suggested above onto my Ubuntu machine, learn the codes, then use them with UDP send or some other method that will work? Or will it be fine to also install python2 on my raspi and they will live happily together?
Will.
Python 2.7 is already installed in raspbian, at least in my raspberry v3. The davorf script worked out of the box in my case. I simply used the exec binding.
The udp binding that I tested had some problems, though: the binding tries to process the udp packet sent back by the mini, therefore the status of the associated items is undefined. They can be solved by writing a javascript function, instead of a simple map file.
The script should read the configuration file written by a suitably modified davorf python script, split the packet randomly modifying the required bytes and finally process the return packet, in order to let the item keep the right state. Unfortunately. Iām not a javascript programmer therefore I cannot actually implement it. I found easier, in my application to awitch to exec byinding with python But if someone is willing to try Iām more than happy to help.
Lionello
Hello!
Having Python 2.X and 3.X on the same machine is feasible, but you should either use Python launcher and add shebang #!python2 to the beginning of my script, or explicitly call Python 2.X executable before the script name. Regarding usage of UDP payload from the Command section of the BlackBeanControl.ini, Iām not sure if it will work (actually, Iām pretty sure it will not). To be able to save a payload to the .ini, I have to add 4 bytes to the beginning, decrypt it, convert it to hex stream and then write it via configparser to the .ini file. Then, when I read a command payload from the .ini, I convert it back from hex, encrypt it again, cut the first 4 bytes of the payload and send it via broadlink send_data(). Even if a payload would work just without first four bytes (manually deleted from a payload), there still remains a problem with 4 bytes which canāt be the same for 2 consecutive commands, so, fixed payload could only work with the very first solution (using dummy command before actual payload). All in all, it seams much easier to use exec binding and call python script, than doing all this āgymnasticsā just to be able to send command via TCP binding.
Best regards,
Davor
Hi,
First Iād like to clarify that itās not my script at all
I just happened to find that on github and posted it here. All credit goes to @mjg59 the developer.
Yes, it works with RM3, RM2/Pro (including Temperature reading and RF), and probably more Broadlink devices, as it also finds my SPcc (Contros) socket too. Canāt control the socket yet, though.
Hopefully @mjg59 will continue with the development to support even more Broadlink devices. Or maybe you guys here can help him @github.
Regards
Are there any special networking requirements as to how the RM3 and device with python installed are setup, in order to successfully capture the data?
I have the raspi with python and blackbean capture on a wired network, and the blackbean is on my wireless network connected via an access point which is on the same subnet as the raspi.
In my previous attempts to capture packets using wireshark installed on a windows laptop also connected to the wireless network I have never been able to observe/capture any data directed towards the IP address of the RM3. Iāve seen internet traffic to various addresses during the capture, which come from my phone when using e-Control, but never traffic directly to the blackbean.
Iāll try the python capture during learning and see how it goes.
The only way to capture packets to and from the mini that I found was to install wireshark directly on the android device where the broadlink app was installed. In your case, you have to capture packets on the raspberry.
trying to get it work on sp mini.
wellā¦wow⦠it works!
installed broadlink package, got the blackbean.py scripts, used the learning mode⦠the light comes on the RM3 thats a good sign, captured command, replayed command to test⦠yep it works
awesome! going to get another one of these for another room in the house.
Now to integrate the python commands into EXEC binding in openhab, shouldnt be too hard
thanks everyone
Hello Will!
Iām glad it works. Integrating it into OpenHAB should be fairly easy. The only problem Iāve had was access to PATH environment variable in Windows. Iāve had to put full paths for both, Python 2.7 executable and BlackBeanControl.py. Here is my Exec binding configuration in .items file:
{exec=">[ON:C:\\Python27\\python.exe@@C:\\OpenHAB\\external\\BlackBeanControl\\BlackBeanControl.py@@-c@@Mute]"}
Remember that, if you are using Exec binding in Windows, you should use @@ instead of blanks in command line (so, two āatā signs instead of one blank).
Best regards,
Davor
I forgot to mention that, if youāre going to use BlackBeanControl.py in OpenHAB, you donāt have to learn commands before connecting them via Exec binding to an item. You just set your item up and the first time you use it, it will trigger a learning mode. Thatās the reason I didnāt want to make an additional switch in the script for entering learning mode explicitly.
Best regards,
Davor