libretiny-eu / esphome-kickstart

Precompiled LibreTiny-ESPHome firmware allowing identification of device pins and OTA upgrading
35 stars 4 forks source link

ESPHome Kickstart does not start #3

Closed Francesco-Sch closed 11 months ago

Francesco-Sch commented 12 months ago

Hi,

I do not know if this is the right place to ask but I am glad for any help!

I am trying to flash this device with with tuya-cloudcutter and ESPHome: https://www.amazon.de/dp/B0B8HSJ4WG?psc=1&ref=ppx_yo2ov_dt_b_product_details

According to the Smart Life app the Main Module version is 1.0.10 and therefore I used 1.0.10 - BK7231N / bk7231n_lowpower_common_ty to flash the device. I then selected ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin as the firmware file.

As far as I can understand from the logs (it is the verbose version) everything looks good and it should be working:

root@raspberrypi:~/tuya-cloudcutter# ./tuya-cloudcutter.sh -r -v
Building cloudcutter docker image
[+] Building 0.7s (13/13) FINISHED                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                          0.0s
 => => transferring dockerfile: 460B                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                             0.0s
 => => transferring context: 2B                                                                                                                               0.0s
 => [internal] load metadata for docker.io/library/python:3.9.12-slim-buster                                                                                  0.5s
 => [base 1/2] FROM docker.io/library/python:3.9.12-slim-buster@sha256:830e161433edfe047a23ebc99c12ee0eb1dc0a50e6b5f1c98e869ac271786632                       0.0s
 => [internal] load build context                                                                                                                             0.0s
 => => transferring context: 3.02kB                                                                                                                           0.0s
 => CACHED [base 2/2] RUN apt-get -qq update && apt-get install -qy --no-install-recommends git hostapd rfkill dnsmasq build-essential libssl-dev iproute2 m  0.0s
 => CACHED [python-deps 1/4] RUN pip install --upgrade pipenv                                                                                                 0.0s
 => CACHED [python-deps 2/4] COPY src/Pipfile /src/                                                                                                           0.0s
 => CACHED [python-deps 3/4] COPY src/Pipfile.lock /src/                                                                                                      0.0s
 => CACHED [python-deps 4/4] RUN cd /src && PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy                                                                  0.0s
 => CACHED [cloudcutter 1/2] COPY src /src                                                                                                                    0.0s
 => CACHED [cloudcutter 2/2] WORKDIR /src                                                                                                                     0.0s
 => exporting to image                                                                                                                                        0.0s
 => => exporting layers                                                                                                                                       0.0s
 => => writing image sha256:b54b5f4552ed02961a70330def6f8a8b1afbdb90f2d000570b2d5124d6ebba29                                                                  0.0s
 => => naming to docker.io/library/cloudcutter                                                                                                                0.0s
Successfully built docker image
1) Detach from the cloud and run Tuya firmware locally
2) Flash 3rd Party Firmware
[?] Select your desired operation [1/2]: 2
[?] Select your desired operation [1/2]: 2
Loading options, please wait...
[?] How do you want to choose the device?: By firmware version and name
   By manufacturer/device name
 > By firmware version and name
   From device-profiles (i.e. custom profile)

[?] Select the firmware version and name: 1.0.10 - BK7231N / bk7231n_lowpower_common_ty
   1.0.1 - BK7231N / oem_bk7231n_strip_ffc_mk_ty
   1.0.1 - BK7231N / ua_app
   1.0.1 - BK7231T / HYS_03_010_RGB_soq7iunzlbpafjlm
   1.0.1 - BK7231T / oem_bk7231s_1_plug_arlec
   1.0.1 - BK7231T / oem_bk7231s_light_mix4to5_db_rmd
   1.0.1 - BK7231T / oem_bk7231s_ty_ffc_newdp
 > 1.0.10 - BK7231N / bk7231n_lowpower_common_ty
   1.0.10 - BK7231N / oem_bk7231n_gate_magnet
   1.0.10 - BK7231N / oem_bk7231n_light_pir_ty
   1.0.10 - BK7231N / ua_app
   1.0.10 - BK7231T / oem_bk7231s_light_ty_oldDp
   1.0.14 - BK7231N / oem_bk7231n_slide_strip_ty
   1.0.15 - BK7231N / oem_bk7231n_slide_strip_ty

Performing safety checks to make sure all required ports are available
Checking UDP port 53... Available.
Checking UDP port 67... Available.
Checking TCP port 80... Available.
Checking TCP port 443... Available.
Checking TCP port 1883... Available.
Checking TCP port 8886... Available.
Safety checks complete.

[?] Select your custom firmware file for BK7231N chip: ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin
 > ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin
   OpenBeken-v1.17.230_bk7231n.ug.bin

Selected Device Slug: avatto-ds06-door-sensor
Selected Profile: bk7231n-lowpower-common-ty-1.0.10-sdk-2.3.1-40.00
Selected Firmware: ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin

================================================================================
Place your device in AP (slow blink) mode.  This can usually be accomplished by either:
Power cycling off/on - 3 times and wait for the device to fast-blink, then repeat 3 more times.  Some devices need 4 or 5 times on each side of the pause
Long press the power/reset button on the device until it starts fast-blinking, then releasing, and then holding the power/reset button again until the device starts slow-blinking.
See https://support.tuya.com/en/help/_detail/K9hut3w10nby8 for more information.
================================================================================

Wiping NetworkManager configs
Scanning for open Tuya SmartLife AP
..
Found access point name: "A-06FE", trying to connect...
Device 'wlan0' successfully activated with '8bcec9e6-5f5e-4932-9860-0aa332acba38'.
Connected to access point.
Waiting 1 sec to allow device to set itself up...
Running initial exploit toolchain...
Exploit run, saved device config too!
output=/work/configured-devices/qm1L6gazDpKT.deviceconfig
Saved device config in /work/configured-devices/qm1L6gazDpKT.deviceconfig

================================================================================
Power cycle and place your device in AP (slow blink) mode again.  This can usually be accomplished by either:
Power cycling off/on - 3 times and wait for the device to fast-blink, then repeat 3 more times.  Some devices need 4 or 5 times on each side of the pause
Long press the power/reset button on the device until it starts fast-blinking, then releasing, and then holding the power/reset button again until the device starts slow-blinking.
See https://support.tuya.com/en/help/_detail/K9hut3w10nby8 for more information.
================================================================================

Wiping NetworkManager configs
Scanning for open Tuya SmartLife AP
...
Found access point name: "A-06FE", trying to connect...
Error: Connection activation failed: (53) The Wi-Fi network could not be found.
Wiping NetworkManager configs
....
Found access point name: "A-06FE", trying to connect...
Device 'wlan0' successfully activated with 'eff3d797-5679-45f7-8430-878bb5432784'.
Connected to access point.
Configured device to connect to 'cloudcutterflash'
Device is connecting to 'cloudcutterflash' access point. Passphrase for the AP is 'abcdabcd' (without ')
Flashing custom firmware...

================================================================================
Wait for up to 10-120 seconds for the device to connect to 'cloudcutterflash'. This script will then show the firmware upgrade requests sent by the device.
================================================================================

Using WLAN adapter: wlan0
Sep  8 13:27:53 dnsmasq[15]: started, version 2.80 cachesize 150
Sep  8 13:27:53 dnsmasq[15]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Sep  8 13:27:53 dnsmasq-dhcp[15]: DHCP, IP range 10.42.42.10 -- 10.42.42.40, lease time 12h
Sep  8 13:27:53 dnsmasq-dhcp[15]: DHCP, sockets bound exclusively to interface wlan0
Sep  8 13:27:53 dnsmasq[15]: read /etc/hosts - 5 addresses
Configuration file: /dev/stdin
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr d8:3a:dd:43:e1:b2 and ssid "cloudcutterflash"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
[13:27:55.780094 MQTT] Connected
Sep  8 13:27:58 dnsmasq[15]: query[A] h3.iot-dns.com from 10.42.42.38
Sep  8 13:27:58 dnsmasq[15]: config h3.iot-dns.com is 10.42.42.1
Using PSK v1 - Received PSK ID version 01

[13:27:59.704717 Log (Client)] Request: HTTPServerRequest(protocol='https', host='h3.iot-dns.com', method='POST', uri='/v2/url_config', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:27:59.705039 LOG (Client)] ==== Request body ===
{"region":"AA","env":"","uuid":"qm1L6gazDpKT","ts":17,"sign":"nLOrdm/122jozQBT+4PGracW6ullZZZIp8giMknxsJI=","config":[{"key":"httpUrl","need_ca":false},{"key":"mqttUrl","need_ca":false},{"key":"httpsPSKUrl","need_ca":false},{"key":"mqttsPSKUrl","need_ca":false}]}
[13:27:59.705640 LOG (Client)] ==== End request body ===
[13:27:59.706517 LOG (Server)] Response:  {"caArr":null,"httpUrl":{"addr":"http://10.42.42.1/d.json","ips":["10.42.42.1"]},"mqttUrl":{"addr":"10.42.42.1:1883","ips":["10.42.42.1"]},"ttl":600}

[13:28:00.118513 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.active&et=1&t=18&uuid=qm1L6gazDpKT&v=4.4&sign=a63b8acab0b76d9a8ba589285119c57f', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:00.118763 LOG (Client)] ==== Request body ===
{"token":"AAAAAA","softVer":"1.0.10","productKey":"yqiqbaldtr0i7mru","protocolVer":"2.2","baselineVer":"40.00","productKeyStr":"keyr5qhaxgstx9ys","devId":"M8ByrwsTC1Qm0mm00d8K","hid":"1c90ff8506fe","modules":"[{\"otaChannel\":9,\"softVer\":\"1.1.6\",\"online\":true}]","devAttribute":579,"cadVer":"1.0.3","cdVer":"1.0.0","options":"{\"isFK\":false,\"otaChannel\":0}","t":18}
[13:28:00.119497 LOG (Client)] ==== End request body ===
[13:28:00.121399 LOG (Server)] Response:  {'result': {'schema': '[{"type":"obj","mode":"ro","property":{"type":"bool"},"id":1},{"type":"obj","mode":"ro","property":{"range":["low","middle","high"],"type":"enum"},"id":3}]', 'devId': 'c44aKuT2z9FxyIA3JCJI', 'resetFactory': False, 'timeZone': '+02:00', 'capability': 1025, 'secKey': '0iWfiEsk1qW9aCG8', 'stdTimeZone': '+01:00', 'schemaId': '000003agra', 'dstIntervals': [], 'localKey': 'c4l4LHpISFRUWTZp'}, 'success': True, 't': 1694179680}

[13:28:01.346058 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.dynamic.config.get&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179680&v=2.0&sign=1b5cf6af9790ecd31a457498bdf50e87', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:01.346288 LOG (Client)] ==== Request body ===
{"type":"[\"timezone\"]","t":1694179680}
[13:28:01.347109 LOG (Client)] ==== End request body ===
[13:28:01.351373 LOG (Server)] Response:  {'result': {'ackId': '0-0', 'validTime': 1800, 'time': 1694179681, 'config': {'stdTimeZone': '+01:00', 'dstIntervals': [[1648342800, 1667091600], [1679792400, 1698541200]]}, 'timezone': {'ackId': '0-0', 'validTime': 1800, 'time': 1694179681, 'config': {'stdTimeZone': '+01:00', 'dstIntervals': [[1648342800, 1667091600], [1679792400, 1698541200]]}}}, 't': 1694179681, 'success': True}
[13:28:03.521322 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":4,"t":1694179683,"data":{"dps":{"3":"high"}}}

[13:28:04.306300 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.uuid.pskkey.get&et=1&t=1694179683&uuid=qm1L6gazDpKT&v=1.0&sign=e4a17f74aa8967b238cdcdb8b9dc606a', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:04.306498 LOG (Client)] ==== Request body ===
{"t":1694179683}
[13:28:04.307311 LOG (Client)] ==== End request body ===
[13:28:04.308926 LOG (Server)] Response:  {'result': {'pskKey': ''}, 't': 1694179684, 'success': True}
[13:28:04.311790 MQTT Sending] Sending firmware update message {"data":{"firmwareType":0},"protocol":15,"t":1694179684} using protocol 2.2
[13:28:04.316777 MQTT Received] Topic: smart/device/in/c44aKuT2z9FxyIA3JCJI - Message: {"data":{"firmwareType":0},"protocol":15,"t":1694179684}
[13:28:04.317847 MQTT Sending] Triggering firmware update message.

[13:28:04.819584 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.dynamic.config.get&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179684&v=2.0&sign=00f2cc621bc17f306213193edd3185a8', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:04.819822 LOG (Client)] ==== Request body ===
{"type":"[\"timezone\",\"rateRule\"]","t":1694179684}
[13:28:04.819950 LOG (Client)] ==== End request body ===
[13:28:04.823952 LOG (Server)] Response:  {'result': {'ackId': '0-0', 'validTime': 1800, 'time': 1694179684, 'config': {'stdTimeZone': '+01:00', 'dstIntervals': [[1648342800, 1667091600], [1679792400, 1698541200]]}, 'timezone': {'ackId': '0-0', 'validTime': 1800, 'time': 1694179684, 'config': {'stdTimeZone': '+01:00', 'dstIntervals': [[1648342800, 1667091600], [1679792400, 1698541200]]}}}, 't': 1694179684, 'success': True}

[13:28:05.147816 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.dynamic.config.ack&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179684&v=2.0&sign=00b9a43be758cb060492ccfad86ac52b', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:05.148004 LOG (Client)] ==== Request body ===
{"ackList":[{"type":"timezone","ackId":"0-0"}],"t":1694179684}
[13:28:05.148127 LOG (Client)] ==== End request body ===
[13:28:05.149791 LOG (Server)] Response:  {'t': 1694179685, 'success': True}

[13:28:05.180591 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.upgrade.get&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179685&v=4.4&sign=466369995bd74243c9a32aac341b89da', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:05.180778 LOG (Client)] ==== Request body ===
{"type":0,"t":1694179685}
[13:28:05.180901 LOG (Client)] ==== End request body ===
[13:28:05.196550 LOG (Server)] Response:  {'result': {'url': 'http://10.42.42.1:80/files/ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin', 'hmac': '8FE6E331A1915C113996CBFA834B47E1BFD06729A2E8A5D82346F5918D448621', 'version': '9.0.0', 'size': '561888', 'type': 0}, 'success': True, 't': 1694179685}

[13:28:05.240362 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.upgrade.status.update&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179685&v=4.1&sign=fa2555b36ecf45cfca80a0538fed7c73', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:05.240498 LOG (Client)] ==== Request body ===
{"type":0,"upgradeStatus":2,"t":1694179685}
[13:28:05.240582 LOG (Client)] ==== End request body ===
[13:28:05.242046 LOG (Server)] Response:  {'t': 1694179685, 'success': True}

[13:28:05.265495 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='GET', uri='/files/ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:05.265653 LOG (Server)] Response:  bytes=0-561887
[13:28:05.302113 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"0","firmwareType":0}}
[13:28:09.535123 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"30","firmwareType":0}}
[13:28:13.106580 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"60","firmwareType":0}}
[13:28:13.134012 MQTT Received] Topic: log/log_seq/c44aKuT2z9FxyIA3JCJI - Message: http | 2.3.1 | 01-01 00:00:04 | erc:0 | [20:tuya.device.uuid.pskkey.get | 25:-2050]
[13:28:15.354138 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"72","firmwareType":0}}

[13:28:16.595679 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.timer.count&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179695&v=4.0&sign=d9fb155042ccf00e07a715823c0fcfc3', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:16.595868 LOG (Client)] ==== Request body ===
{"devId":"c44aKuT2z9FxyIA3JCJI","lastFetchTime":"0","t":1694179695}
[13:28:16.595990 LOG (Client)] ==== End request body ===
[13:28:16.598696 LOG (Server)] Response:  {'result': {'devId': 'c44aKuT2z9FxyIA3JCJI', 'count': 0, 'lastFetchTime': 0}, 't': 1694179696, 'success': True}

[13:28:17.000175 Log (Client)] Request: HTTPServerRequest(protocol='http', host='10.42.42.1', method='POST', uri='/d.json?a=tuya.device.upgrade.silent.get&devId=c44aKuT2z9FxyIA3JCJI&et=1&t=1694179696&v=4.4&sign=45dc6e3647f99facaa12094377fae711', version='HTTP/1.1', remote_ip='10.42.42.38')
[13:28:17.000453 LOG (Client)] ==== Request body ===
{"subId":null,"t":1694179696}
[13:28:17.000991 LOG (Client)] ==== End request body ===
[13:28:17.003659 LOG (Server)] Response:  {'t': 1694179697, 'success': True}
[13:28:17.019969 MQTT Received] Topic: log/log_seq/c44aKuT2z9FxyIA3JCJI - Message: upgrade | 2.3.1 | 09-08 13:28:17 | erc:0 | [13:0]
[13:28:17.213453 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"77","firmwareType":0}}
[13:28:19.310122 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"84","firmwareType":0}}
[13:28:21.383987 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"90","firmwareType":0}}
[13:28:22.333309 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"92","firmwareType":0}}
[13:28:22.691672 Firmware Upload] /files/ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin send complete, request range: bytes=0-561887/561888
[13:28:22.995197 MQTT Received] Topic: smart/device/out/c44aKuT2z9FxyIA3JCJI - Message: {"protocol":16,"data":{"progress":"98","firmwareType":0}}
Firmware file has been sent and MQTT reported a progress of nearly complete.  Waiting 15 seconds to ensure flashing completes.
Flashing should be complete.  It takes about 15 seconds for the device to reboot and verify the flash was valid.
Please wait about 30 seconds then look for signs of activity from the firmware you supplied (either watch for AP mode or check if it joined your network).
Device MAC address: 1c:90:ff:85:06:fe

But unfortunately the Wifi AP kickstart-BK7231N is not visible/appearing. Any idea what the reason could be? I would be very thankful for any tip.

Best Francesco

Francesco-Sch commented 11 months ago

This was solved here: https://github.com/tuya-cloudcutter/tuya-cloudcutter/issues/473