$ python2 getBroadlinkSharedData.py
Traceback (most recent call last):
File "getBroadlinkSharedData.py", line 20, in <module>
import simplejson as json
ImportError: No module named simplejson
FYI, I installed simplejson using pip3 install simplejson. When I tried to reinstall it using pip, it says…
$ pip install simplejson
Requirement already satisfied: simplejson in /usr/local/lib/python3.4dist-packages
I manage to install Python2 in my Windows PC and manage to generate the text file filed with the TC2 codes. Will try to use the codes in my configuration soon.
OK. If I understand correctly, that is code is in python. So, I modified getBroadlinkSharedData.py by adding from base64 import b64encode, b64decode on line 21 and then…
below…
code = ''.join('%02x' % (i & 0xff) for i in jsonIrCodeData[i]['code'])
@masterkenobi That’s exactly the issue other users are experiencing as well, the code format you get from " getBroadlinkSharedData.py" should work directly with “python-broadlink” (for the TC2 rf codes I found that you need to duplicate the code so it will be in the expected length and if you send it should work), but…I don’t know how python-broadlink was integrated into home assistant, the issue is still with the AES encryption, I believe it because of missing padding.
My script just dumps the codes from the e-Control app.
The first method for the rooted devices the codes stored in the rmt.db in binary, when you copy them in hex they work fine with the send_data function, you will still have the length issue (at least for TC2 switches) but if you duplicate the code and send it using the function it works great.
So for example if your code is: abcd you need to send abcdabcd
For the second script getBroadlinkSharedData.py the codes are stored in decimal format array so my script converts them to hex which should be the format to use with python-broadlink but you still need to send duplicate code.
Btw: I don’t have home assistant installed yet, tried yesterday on a rpi with the one click install script but it failed, I’ll try to install the hassbian so I could see what’s going on
Theoretically It should, but someone on another post mentioned he tried duplicating the code and it didn’t worked with HA, after I’ll install it I can do proper testing.
Ok, Test 1, Dumped the codes using my “getBroadlinkSharedData.py” script, sending it using the following code and it’s working, as you can see you need to duplicate the code, I am installing HA and now and hopefully I will be able to see if there’s any problem:
@masterkenobi Ok, all is working fine when using the library directly, i have tested with HA and having the same issue with length, It can be the version of the library or the way it was implemented int HA.
I guess we will have to wait for the updates and try again.
Great to hear that. I guess we just need to wait for @Danielhiversen to make it works on the next release. By the way, I can help you to test it. I just need to know how. Thanks guys!