NightRang3r / Broadlink-e-control-db-dump

These two scripts will "parse" the broadlink e-Control Android application database or SharedData and dump the IR / RF codes for selected accessories into a text file which can be later used with broadlink-python to send the codes to the RM PRO hub
149 stars 52 forks source link

TC2 Dump Code Replay #5

Closed jeylites closed 6 years ago

jeylites commented 7 years ago

Hi NightRang3r, thanks for putting together a great tool. I'm not a coder and I'm making this happen base on your instructions. I got as far as dumping the code using getBroadlinkSharedData.py as listed below. the problem is I'm trying to replay the code using sendCode.py but not getting any success running it. In addition, I'm getting errors. I have double check the IP, MAC and installed mjg59/python-broadlink.

Last login: Tue Apr 4 19:48:55 on ttys001 JK-MacAir:~ JK$ /Users/JK/Desktop/sendCode.py /Users/JK/Desktop/sendCode.py: line 1: import: command not found /Users/JK/Desktop/sendCode.py: line 2: import: command not found /Users/JK/Desktop/sendCode.py: line 3: import: command not found /Users/JK/Desktop/sendCode.py: line 6: syntax error near unexpected token (' /Users/JK/Desktop/sendCode.py: line 6:device = broadlink.rm(host=("192.168.1.67",80), mac=bytearray.fromhex("b4430dfbe507"))' Jeys-Air:~ JK$

getBroadlinkSharedData.py

`import broadlink import time import sys

settings

device = broadlink.rm(host=("192.168.1.67",80), mac=bytearray.fromhex("b4430dfbe507"))

print "Connecting to Broadlink device...." device.auth() time.sleep(1) print "Connected...." time.sleep(1) device.host

Replace with your code

codeData = "e9144600df091609160909161609160909160916160916091609160909160916160909160916091609161609160916091609160909160916160916091609160916090916091609000148"

device.send_data(codeData.decode('hex')) print "Code Sent...."`

# DUMP CODE

Button Name: SPOT | Button ID: 39 | Code: e9144600df091609160909161609160909160916160909160916091609161609091616090916091616091609160909160916091609161609091609161609160916091609160909000148Button Name: 1-Gang | Button ID: 40 | Code: e9144600df091609160909161609160909160916160916091609160909160916160909160916091609161609160916091609160909160916160916091609160916090916091609000148Button Name: WHITE | Button ID: 41 | Code: e9144600df090916160909161609160909161609091609160916160916090916091616091609160909161609091609161609160916091609160909161609091609160916091609000148Button Name: 2-Gang | Button ID: 42 | Code: e9144600df090916091609160916091616090916091616091609160916091609160909160916091609161609091609160916160916091609160909160916091616090916091609000148Button Name: FAN | Button ID: 43 | Code: e9144600df091609160916090916091616091609160916091609160909161609091616091609091609160916091609161609091616090916160916091609160909161609091609000148Button Name: 3-Gang | Button ID: 44 | Code: e9144600df090916091609161609160909160916091609161609091616091609160909160916091609160916160909161609160916090916160909161609160916090916091609000148Button Name: | Button ID: 45 | Code: e9144600df091609160916090916160909161609091609161609091609161609160909161609160916090916091609161609091609160916091616091609091616090916091609000148Button Name: | Button ID: 46 | Code: e9144600df090916160916090916091609160916091616090916160916090916091616090916160916091609091616090916091609160916160909161609091616091609091609000148

jeylites commented 7 years ago

I gave a second glance, looks like I forgot to include JK:~ JK$ python /script

But now I'm getting the following message... The other thing I realize is my Broadlink code ends with ...148 which is different from what all of you have.

Broadlink Code e9144600df091609160909161609160909160916160916091609160909160916160909160916091609161609160916091609160909160916160916091609160916090916091609000148

Terminal

JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 229, in send_packet payload = aes.encrypt(bytes(payload)) File "build/bdist.macosx-10.12-intel/egg/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 229, in send_packet payload = aes.encrypt(bytes(payload)) File "build/bdist.macosx-10.12-intel/egg/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 229, in send_packet payload = aes.encrypt(bytes(payload)) File "build/bdist.macosx-10.12-intel/egg/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 229, in send_packet payload = aes.encrypt(bytes(payload)) File "build/bdist.macosx-10.12-intel/egg/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 229, in send_packet payload = aes.encrypt(bytes(payload)) File "build/bdist.macosx-10.12-intel/egg/Crypto/Cipher/blockalgo.py", line 244, in encrypt ValueError: Input strings must be a multiple of 16 in length JK:~ JK$ python /Users/JK/Desktop/sendCode.py Connecting to Broadlink device.... Connected.... Traceback (most recent call last): File "/Users/JK/Desktop/sendCode.py", line 21, in <module> device.send_data(codeData.decode('hex')) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data self.send_packet(0x6a, packet) File "/Library/Python/2.7/site-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 250, in send_packet response = self.cs.recvfrom(1024) socket.timeout: timed out JK:~ JK$

NightRang3r commented 6 years ago

Please read instructions in the main page, it looks like length issues