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

Little help with reverting code to correct format #1

Closed Paxy closed 7 years ago

Paxy commented 7 years ago

First of all, great job with this tool. As codes are usually distributed in different coded format (hex, base64, some other format), it would be useful to give a correct example of replaying your code to RM2.

I have tried to reply code learned with your tool with the following code:

!/usr/bin/python

import sys
import broadlink

mac="B4430DFBD380".decode('hex')
devices = broadlink.rm2(('172.16.1.167', 80),mac)

devices.auth()
code=sys.argv[1].decode('hex')
devices.send_data(code)

But device does not react at the command, unlike with e-control. Is it enough just to decode code string as hex, or I need something else ?

NightRang3r commented 7 years ago

@Paxy Which script did you use to dump the codes "econtrol-db-dump.py" or "getBroadlinkSharedData.py" ?

NightRang3r commented 7 years ago

@Paxy Actually, It doesn't matter.


import broadlink
import time
import sys

device = broadlink.rm(host=("10.0.0.2",80), mac=bytearray.fromhex("b4430fffffff"))

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

hex1 = "e90a4200df0909160916091616091609091616091609091616091609160916091609091616090916091616090916091616090916091609161609091616091609160909161609"
hex2 = "e90a4200df0909160916091616091609091616091609091616091609160916091609091616090916091616090916091616090916091609161609091616091609160909161609"
myhex = hex1 + hex2

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

This is an example of sending a command to the RM pro for controlling TC2 light switches For IR you should send the code once.

Paxy commented 7 years ago

Tnx NightRang3r ! Actually, problem was not with mine code, problem was in procedure. We need to Share (Share to other phones in WLAN) in order to update sdcard files with most current configs. Looks like I have tried to send some earlier code, so that was the reason why it wasn't working.

Anyway, great job. Include this sample code in repo, it could be useful.

NightRang3r commented 7 years ago

@Paxy Thanks, I updated the README and added the script to test codes.

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$

`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