mirror of
https://github.com/ct-Open-Source/tuya-convert.git
synced 2026-03-19 23:06:57 +01:00
Merge pull request #147 from kueblc/new-intermediate-fw
Upgrade intermediate firmware to 1.1
This commit is contained in:
@@ -1 +0,0 @@
|
||||
esp8266-ota-flash-convert_upg.bin
|
||||
Binary file not shown.
Binary file not shown.
BIN
files/upgrade.bin
Normal file
BIN
files/upgrade.bin
Normal file
Binary file not shown.
@@ -1 +0,0 @@
|
||||
esp8266-ota-flash-convert.ino-0x81000.bin
|
||||
BIN
files/user2.bin
Normal file
BIN
files/user2.bin
Normal file
Binary file not shown.
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# encoding: utf-8
|
||||
"""
|
||||
backup.py
|
||||
|
||||
Created by nano on 2019-01-10.
|
||||
Copyright (c) 2019 VTRUST GmbH. All rights reserved.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import http.client
|
||||
from binascii import unhexlify
|
||||
import datetime
|
||||
|
||||
DEVICE_IP = "10.42.42.42"
|
||||
|
||||
|
||||
def main():
|
||||
print("Create backup of entire FLASH from %s" % DEVICE_IP )
|
||||
data = b""
|
||||
conn = http.client.HTTPConnection(DEVICE_IP)
|
||||
conn.request("GET","/flashsize")
|
||||
flashsize = int(conn.getresponse().read())
|
||||
print("Connected... Flashsize=",flashsize)
|
||||
for address in range(0,flashsize,1024):
|
||||
conn.request("GET", "/get?read=%X" % address )
|
||||
r1 = conn.getresponse()
|
||||
# print(r1.status, r1.reason)
|
||||
block = r1.read().split(b'\n')
|
||||
print(block[0])
|
||||
data += block[1]
|
||||
conn.close()
|
||||
bindata = unhexlify(data)
|
||||
f= open(datetime.datetime.now().strftime("../%Y-%m-%d_%H-%M-%S_readout.bin"),"wb")
|
||||
f.write(bindata)
|
||||
f.close
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
@@ -60,10 +60,7 @@ class JSONHandler(tornado.web.RequestHandler):
|
||||
b'{'
|
||||
b'"schema":"[{'
|
||||
b'\\"mode\\":\\"rw\\",'
|
||||
b'\\"property\\":{\\"type\\":\\"bool\\"},\\"id\\":1,\\"type\\":\\"obj\\"},'
|
||||
b'{\\"mode\\":\\"rw\\",'
|
||||
b'\\"property\\":{\\"min\\":0,\\"max\\":86400,\\"scale\\":0,\\"step\\":1,\\"type\\":\\"value\\"},'
|
||||
b'\\"id\\":9,\\"type\\":\\"obj\\"'
|
||||
b'\\"property\\":{\\"type\\":\\"bool\\"},\\"id\\":1,\\"type\\":\\"obj\\"'
|
||||
b'}]",'
|
||||
b'"uid":"00000000000000000000","devEtag":"0000000000","secKey":"0000000000000000","schemaId":"0000000000","localKey":"0000000000000000"'
|
||||
b'},'
|
||||
@@ -81,9 +78,9 @@ class JSONHandler(tornado.web.RequestHandler):
|
||||
print("Answer s.gw.upgrade")
|
||||
#Fixme
|
||||
#Calculate MD5 and Filesize
|
||||
file_md5 = hashlib.md5(file_as_bytes(open('../files/1.bin', 'rb'))).hexdigest()
|
||||
file_len = os.path.getsize('../files/1.bin')
|
||||
answer = b'{"result":{"auto":3,"fileSize":"%d","etag":"0000000000","version":"9.0.0","url":"http://10.42.42.1/files/1.bin","md5":"%s"},"t":100,"e":false,"success":true}' % (file_len,file_md5.encode('utf-8'))
|
||||
file_md5 = hashlib.md5(file_as_bytes(open('../files/upgrade.bin', 'rb'))).hexdigest()
|
||||
file_len = os.path.getsize('../files/upgrade.bin')
|
||||
answer = b'{"result":{"auto":3,"fileSize":"%d","etag":"0000000000","version":"9.0.0","url":"http://10.42.42.1/files/upgrade.bin","md5":"%s"},"t":100,"e":false,"success":true}' % (file_len,file_md5.encode('utf-8'))
|
||||
print(answer)
|
||||
self.set_header("Content-Type", "application/json;charset=UTF-8")
|
||||
self.set_header('Content-Length', str(len(answer)))
|
||||
|
||||
@@ -59,6 +59,9 @@ echo "======================================================"
|
||||
echo "Starting pairing procedure in screen"
|
||||
sudo ip route add 255.255.255.255 dev $WLAN
|
||||
$screen_with_log smarthack-smartconfig.log -S smarthack-smartconfig -m -d ./smartconfig/smartconfig.js
|
||||
|
||||
popd
|
||||
|
||||
echo "Waiting for the upgraded device to appear"
|
||||
echo "If this does not work have a look at the '*.log'-files in the 'scripts' subfolder!"
|
||||
|
||||
@@ -72,9 +75,7 @@ echo
|
||||
echo "IoT-device is online with ip 10.42.42.42"
|
||||
echo "Fetching firmware backup"
|
||||
sleep 2
|
||||
./backup.py
|
||||
|
||||
popd
|
||||
curl -JO http://10.42.42.42/backup
|
||||
|
||||
echo "======================================================"
|
||||
echo "Getting Info from IoT-device"
|
||||
|
||||
Reference in New Issue
Block a user