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

getBroadlinkSharedData.py KeyError: 0 #23

Closed andreibanaru closed 6 years ago

andreibanaru commented 6 years ago

Did they change the formatting of jsonSubIr?

root@f7135252136a:/shareTemp# python -V
Python 2.7.15

root@f7135252136a:/shareTemp# ls -lah
total 84K
drwxr-xr-x. 3 root root 4.0K Jul 22 09:23 .
drwxr-xr-x. 1 root root  142 Jul 22 09:23 ..
-rw-r--r--. 1 root root 2.3K Jul 22 09:23 getBroadlinkSharedData.py
drwxr-xr-x. 2 root root   26 Jul 22 09:23 images
-rw-r--r--. 1 root root 1.5K Jul 22  2018 jsonButton
-rw-r--r--. 1 root root 1.2K Jul 22  2018 jsonIrCode1
-rw-r--r--. 1 root root  807 Jul 22  2018 jsonIrCode10
-rw-r--r--. 1 root root 1.2K Dec 15  2015 jsonIrCode110
-rw-r--r--. 1 root root  808 Dec 15  2015 jsonIrCode111
-rw-r--r--. 1 root root  808 Dec 15  2015 jsonIrCode112
-rw-r--r--. 1 root root  808 Dec 15  2015 jsonIrCode113
-rw-r--r--. 1 root root  808 Dec 15  2015 jsonIrCode114
-rw-r--r--. 1 root root  809 Dec 15  2015 jsonIrCode115
-rw-r--r--. 1 root root  803 Jul 22  2018 jsonIrCode2
-rw-r--r--. 1 root root  803 Jul 22  2018 jsonIrCode3
-rw-r--r--. 1 root root  804 Jul 22  2018 jsonIrCode4
-rw-r--r--. 1 root root  805 Jul 22  2018 jsonIrCode5
-rw-r--r--. 1 root root  804 Jul 22  2018 jsonIrCode6
-rw-r--r--. 1 root root  805 Jul 22  2018 jsonIrCode7
-rw-r--r--. 1 root root  805 Jul 22  2018 jsonIrCode8
-rw-r--r--. 1 root root  803 Jul 22  2018 jsonIrCode9
-rw-r--r--. 1 root root   84 Jul 22  2018 jsonSubIr
-rw-r--r--. 1 root root   33 Jul 22  2018 phone_dpi

root@f7135252136a:/shareTemp# python getBroadlinkSharedData.py
ID:
Traceback (most recent call last):
  File "getBroadlinkSharedData.py", line 43, in <module>
    print "ID:", jsonSubIrData[i]['id'], "| Name:", jsonSubIrData[i]['name']
KeyError: 0

root@f7135252136a:/shareTemp# cat jsonSubIr
{"id":1,"deviceId":1,"icon":"device_1.png","name":"AR12HSFNCWKN","type":5,"order":0}
andreibanaru commented 6 years ago

Nevermind...

I followed this post to fetch the jsons https://github.com/mjg59/python-broadlink/issues/74#issuecomment-348691799 which seemd to offer the same data but apparently it's formatted in a different way.

Meaning, jsonIrCode is now splitted into multiple files but that can be mitigated by: cat jsonIrCode* | sed 's/\]\[/, /g > jsonIrCode

and regarding jsonSubIr we have a single file (cause we downloaded a single remote file from their cloud). For that I've made some changes to your getBroadlinkSharedData.py script.

In the end I've managed to obtain the hex-pronto codes. Thanks!