Funcionou que é uma beleza… Valeu!
any one have idea what this issue?
same problem for me under windows 10… have you solved?
Can someone help me to extract a RF code? I can’ run in win10 and I get error also under rasbian.
Traceback (most recent call last):
File “getBroadlinkSharedData.py”, line 39, in
jsonSubIrData = json.loads(jsonSubIr)
File “/home/pi/.local/lib/python2.7/site-packages/simplejson/init.py”, line 518, in loads
return _default_decoder.decode(s)
File “/home/pi/.local/lib/python2.7/site-packages/simplejson/decoder.py”, line 373, in decode
raise JSONDecodeError(“Extra data”, s, end, len(s))
simplejson.errors.JSONDecodeError: Extra data: line 1 column 3 - line 1 column 24 (char 2 - 23)
This is my files:
https://we.tl/t-JVRiXw54x3
It’s only a RF command
I’ve had success using the method described here.
Thankyou it works!
Updated code that supports recent updates of broadlink plugin:
# -*- coding: utf-8 -*-
'''
This script will "parse" the broadlink e-Control Android application "SharedData" json files 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
NO ROOT ACCESS REQUIRED
Just connect your Android device to your computer and browse the SD card / External Storage folder "/broadlink/newremote/SharedData/"
You need to get the following files:
jsonSubIr
jsonButton
jsonIrCode
and put them in the same folder as this script.
run: python getBroadlinkSharedData.py
'''
import simplejson as json
buttonIDS = []
buttonNames = []
jsonSubIr = open("jsonSubIr").read()
jsonSubIrData = json.loads(jsonSubIr)
for i in range(0, len(jsonSubIrData)):
print "ID:", jsonSubIrData[i]['id'], "| Name:", jsonSubIrData[i]['name']
choice = input("Select accessory ID: ")
for i in range(0, len(jsonSubIrData)):
if jsonSubIrData[i]['id'] == choice:
accessory_name = jsonSubIrData[i]['name']
print "[+] You selected: ", accessory_name
jsonButton = open("jsonButton").read()
jsonButtonData = json.loads(jsonButton)
for i in range(0, len(jsonButtonData)):
if jsonButtonData[i]['subIRId'] == choice:
buttonIDS.append(jsonButtonData[i]['id'])
buttonNames.append(jsonButtonData[i]['name'])
jsonIrCode = open("jsonIrCode").read()
jsonIrCodeData = json.loads(jsonIrCode)
print "[+] Dumping codes to " + accessory_name + ".txt"
print "[+] Dumping yaml to " + accessory_name + ".yaml"
codesFile = open(accessory_name + '.txt', 'w')
yamlFile = open(accessory_name + '.yaml', 'w')
groupstext = "\n\n\ngroup:\n"
groupstext = groupstext + " " + accessory_name + ":\n"
groupstext = groupstext + " name: " + accessory_name + "\n"
# groupstext = groupstext + " view: yes\n"
groupstext = groupstext + " entities:\n"
yamltext = " switches:\n"
for i in range(0, len(jsonIrCodeData)):
for j in range(0, len(buttonIDS)):
if jsonIrCodeData[i]['buttonId'] == buttonIDS[j]:
code = ''.join('%02x' % (i & 0xff) for i in jsonIrCodeData[i]['code'])
code_b64 = code.decode("hex").encode("base64")
result = "Button Name: " + buttonNames[j] + " | Button ID: " + str(jsonIrCodeData[i]['buttonId']) + " | Code: " + code
namepart = buttonNames[j].strip().replace(" ","_")
yamltext = yamltext + " - name: " + accessory_name.replace(" ","_") + "_" + namepart + "\n"
# yamltext = yamltext + " friendly_name: " + accessory_name + " " + buttonNames[j] + "\n"
yamltext = yamltext + " command_on: '" + code_b64[:-1] + "'" + "\n"
groupstext = groupstext + " - switch." + accessory_name.replace(" ","_") + "_" + namepart + "\n"
codesFile.writelines(result.encode('utf-8'))
yamlFile.writelines(yamltext.encode('utf-8'))
yamlFile.writelines(groupstext.encode('utf-8'))
Is it possible to use this approach for getting the codes from the newer Broadlink app e.g. not the e control app?
I am having problems connecting my Broadlink RM to e control for some reason.
I looked in the Broadlink folder for the Broadlink app on my phone and can see similar files but they are empty. e.g. jsonSubIr, jsonButton and jsonIrCode