Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed BitBucketConverter.py to work with newer Tasmota firmwares #142

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions BitBucketConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# Editor: Portisch, henfri
#-------------------------------------------------------------------------------

# Requires pillow and pycurl python packages from pip or your favourite package manager

# Interactive Process to learn Codes:
# -Run rfraw 177 in your SonOff console -Push all your remote (each Button 2-3 times)
# -Save everything from the console that happened after rfraw 177 to a file, e.g. console.txt
Expand All @@ -32,6 +34,12 @@
from PIL import Image, ImageFont, ImageDraw
from os.path import exists
from time import sleep
try:
# python 3
from urllib.parse import urlencode
except ImportError:
# python 2
from urllib import urlencode

# Output:
# Example: AA B0 23 04 14 0224 03FB 0BF4 1CAC 23011010011001010110101001100101011010100101100110 55
Expand Down Expand Up @@ -69,8 +77,11 @@ def sendCommand(szOutFinal, mydevice):
#buffer = StringIO()
mydevice.replace("http://","").replace("/","")
buffer = BytesIO()
url = str("http://{}/ax?c2=191&c1=RfRaw%20".format(mydevice))
url += szOutFinal.replace(" ","%20")
baseurl = str("http://{}/cm?".format(mydevice))
query = {
"cmnd": "BackLog RfRaw {}; RfRaw 0".format(szOutFinal)
}
url = baseurl + urlencode(query)
print(url)
print("Sending command to bridge")
c = pycurl.Curl()
Expand Down Expand Up @@ -284,7 +295,7 @@ def parse_file(fn):
commands={}
with open(fn) as f:
for line in f:
if '{"RfRaw":{"Data":"AA B1' in line:
if '"RfRaw":{"Data":"AA B1' in line:
print("###### Processing line {0} ######".format(line))
res=main(filterInputStr(line)
, options.repeat)
Expand Down