-
Notifications
You must be signed in to change notification settings - Fork 173
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
Issues OTA DEMO connecting with local server #147
Comments
I have mounted another servir with a dedicated linux ubuntu PC and the error is the same. |
Hello @LUSAN54 Did you make sure copy root.pem under ota_dmo/main folder? You should overwrite root.pem of your server. After that, please clean and rebuild demo app. |
i´m sure i have copied de root.pem under ota_demo/main folder. I have repetead all the procces. The only strange thing I can see is that when I run $ python3 ../https_server.py lusan@lusan-linux:~/ota_demo/dir$ python3 ../https_server.py |
Hmm.. I think esp32 mbedtls is returning -0x7780 which is MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE. Maybe it's related with your esp32 mbedtls config and server tls config. Could you turn on mbedtls debug log and test it again? You can turn debug log on with below sequence.
In menu select page, |
thanks for your quick response. I attach the file with the logs |
Hmm.. We are facing another problem by enabling mbedtls debug. Due to lots of log, device can't connect to Cloud server(SmartThings server) because of timeout. To look into your local server connecting issue, could you delete below line and test it again?? under void ota_polling_task(void *arg) funcing In main.c
|
Goor morning, see attached the new logs after deleting lines 132 to 134. |
@LUSAN54 one thing to check. Did you change below IP info with your local server IP? In main/ota_util.c file |
yes, sure: #define CONFIG_OTA_SERVER_URL "https://192.168.67.249:4443/" |
From the log, looks like your local server refusing connection during ssl handshake. It can be they can't agree on connection setting problem.
Could you check why you local httpd server refusing connection if there is server log? Also could you check local server support tls 1.2? Maybe you could test it with below command |
Thanks for your quick response. lusan@DESKTOP-CL4R1HL:~/st-device-sdk-c-ref$ curl --tlsv1.2 --cacert ./root.crt "https://192.168.67.249:4443/" <title>Directory listing for /</title>Directory listing for /**Everything means that the server accepts the connection from another computer** |
Okay.. Can you use tcpdump command at your local server? If then, can you share tcpdump pcap output file between your server and esp32? You can refer below sites about how to use tcpdump. |
See attached the log between server and esp32. |
Could you run below command and test again with esp32? and share pcap output file?
Connection refusion happens during SSL handshake. We need to find out which cipher suites esp32(client) sent, what cipher suite your local server is supporting.
|
see attached the client-hello.pcad file. |
From pcap you shared, below is cipher suites esp32(client) sent. Maybe your local server don't support any cipher suite among those. You can select esp32 supporting cipher suites from menuconfig -> Component config -> mbedTLS. To find out which cipher suites your local server supports, I think you can get lists from below python script at your local server.
Or, If you share success case(your local server <-> another computer client) pcap file, let me check which cipher they used. |
Or, If you share success case(your local server <-> another computer client) pcap file, let me check which cipher they used. |
Looks like cipher suite they are using is I'm not sure esp32 support the TLS 1.3 cipher suite, but you can explore at esp32 mbedTLS component menuconfig. Also there must be some TLS 1.2 cipher suites local server supporting. Like I said above, you can try it with other key exchange method like DHE_RSA or ELLIPTIC_CURVE not RSA. |
Bingo! |
I have a new problem. What I can be doing wrong? |
As I know, SmartThings app blocks new firmware version update available for 1 hour since the last firmware update. |
Now is OK. |
Today I have a new problem.
After several months of testing my device, today the mobile application gives me this error:
Can you help me?
De: junyoun-kim ***@***.***>
Enviado el: miércoles, 28 de febrero de 2024 16:03
Para: SmartThingsCommunity/st-device-sdk-c-ref ***@***.***>
CC: LUIS ANTONIO SANCHEZ CANO ***@***.***>; Mention ***@***.***>
Asunto: Re: [SmartThingsCommunity/st-device-sdk-c-ref] Issues OTA DEMO connecting with local server (Issue #147)
As I know, SmartThings app blocks new firmware version update available for 1 hour since the last firmware update.
So you need to wait 1 hour to test next firmware update. To skip this, you may need to flush out SmartThings app data and cache in App Setting and relaunch SmartThings App.
—
Reply to this email directly, view it on GitHub<#147 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANYSG2AZYY2H5WWYMVVH6ZLYVXYRZAVCNFSM6AAAAABDTNZ3ZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGE3TKNZXGE>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Could you update error code again? It doesn't appear. |
I´m usign the example of the SmartThings sdk OTA-DEMO.
<title>Directory listing for /</title>The RaspberryPi is being used as an ubuntu machine as a local OTA server.
I have followed all the instructions to generate the necesary certificates and keys accordin to the OTA DEMO server.
At the end i have tested the server access from a computer with the command :
curl --cacert ./root.crt "https://192.168.67.35:4443"
And the result has been 👍
Directory listing for /
The i programmed the ESP32 device with de OTA-DEMO program and the device works correctly and i can send ON -OFF commands form the SmarThigns app.
The problem is that de device can´t connect to the server. You can see below the logs register.
i´m stuck and i don´t know where to go next in my produc devolopment:
lusan@DESKTOP-CL4R1HL:~/st-device-sdk-c-ref$ python build.py apps/esp32/ota_demo monitor
/bin/sh: 22: ./export.sh: [[: not found
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.12
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /home/lusan/.espressif/espidf.constraints.v5.0.txt
Requirement files:
Python being checked: /home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python
/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Python requirements are satisfied.
Updated PATH variable:
/home/lusan/st-device-sdk-c-ref/bsp/esp32/components/espcoredump:/home/lusan/st-device-sdk-c-ref/bsp/esp32/components/partition_table:/home/lusan/st-device-sdk-c-ref/bsp/esp32/components/app_update:/home/lusan/.espressif/tools/xtensa-esp-elf-gdb/11.2_20220823/xtensa-esp-elf-gdb/bin:/home/lusan/.espressif/tools/riscv32-esp-elf-gdb/11.2_20220823/riscv32-esp-elf-gdb/bin:/home/lusan/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin:/home/lusan/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin:/home/lusan/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin:/home/lusan/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin:/home/lusan/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/home/lusan/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin:/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools:/home/lusan/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu22.04LTS_2204.3.63.0_x64__79rhkp1fndgsc:/mnt/c/Program Files/Common Files/Oracle/Java/javapath:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/usbipd-win/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Python/Python312/Scripts/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Python/Python312/:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/LUSAN.DINUY/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin
Detected installed tools that are not currently used by active ESP-IDF version.
For removing old versions of riscv32-esp-elf, riscv32-esp-elf-gdb, xtensa-esp32-elf, esp32ulp-elf, esp-rom-elfs, xtensa-esp32s2-elf, xtensa-esp32s3-elf, xtensa-esp-elf-gdb, esp32s2ulp-elf, openocd-esp32 use command 'python /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_tools.py uninstall'
To free up even more space, remove installation packages of those tools. Use option 'python3 /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_tools.py uninstall --remove-archives'.
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
Executing action: monitor
Serial port /dev/ttyUSB0
Connecting.........
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting.....
Detecting chip type... ESP32
Running idf_monitor in directory /home/lusan/st-device-sdk-c-ref/apps/esp32/ota_demo
Executing "/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf_monitor.py -p /dev/ttyUSB0 -b 115200 --toolchain-prefix xtensa-esp32-elf- --target esp32 --revision 0 /home/lusan/st-device-sdk-c-ref/apps/esp32/ota_demo/build/ota_demo.elf -m '/home/lusan/.espressif/python_env/idf5.0_py3.10_env/bin/python' '/home/lusan/st-device-sdk-c-ref/bsp/esp32/tools/idf.py'"...
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6020
load:0x40078000,len:15932
load:0x40080400,len:3624
0x40080400: _init at ??:?
entry 0x400805d4
W (27) boot: Unicore bootloader
I (384) cpu_start: Unicore app
I (384) cpu_start: Pro cpu up.
I (384) cpu_start: Single core mode
I (396) cpu_start: Pro cpu start user code
I (396) cpu_start: cpu freq: 160000000 Hz
I (396) cpu_start: Application information:
I (401) cpu_start: Project name: ota_demo
I (406) cpu_start: App version: v1.8.7-2-ga8226c6-dirty
I (412) cpu_start: Compile time: Feb 20 2024 14:01:26
I (419) cpu_start: ELF file SHA256: 40b9c1caef97de27...
Warning: checksum mismatch between flashed and built applications. Checksum of built application is ed081d4c0160b123720b7111deaa1745971f44018c1e3032f6aac8f953f2affe
I (425) cpu_start: ESP-IDF: v5.0.2-376-g24b9d38a24
I (431) cpu_start: Min chip rev: v0.0
I (435) cpu_start: Max chip rev: v3.99
I (440) cpu_start: Chip rev: v3.0
I (445) heap_init: Initializing. RAM available for dynamic allocation:
I (452) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (458) heap_init: At 3FFB6B00 len 00029500 (165 KiB): DRAM
I (465) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (471) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (477) heap_init: At 40094FE8 len 0000B018 (44 KiB): IRAM
I (483) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (491) spi_flash: detected chip: generic
I (494) spi_flash: flash io: qio
I (499) cpu_start: Starting scheduler on PRO CPU.
I (511) [IoT]: _dump_device_info(746) > firmware_version: switch_example_001
I (511) [IoT]: iot_bsp_wifi_init(251) > [esp32] iot_bsp_wifi_init
I (531) wifi:wifi driver task: 3ffbff64, prio:23, stack:6656, core=0
I (531) system_api: Base MAC address is not set
I (531) system_api: read default base MAC address from EFUSE
I (541) wifi:wifi firmware version: 1cf2806
I (541) wifi:wifi certification version: v7.0
I (551) wifi:config NVS flash: enabled
I (551) wifi:config nano formating: disabled
I (551) wifi:Init data frame dynamic rx buffer num: 32
I (561) wifi:Init management frame dynamic rx buffer num: 32
I (561) wifi:Init management short buffer num: 32
I (571) wifi:Init dynamic tx buffer num: 32
I (571) wifi:Init static rx buffer size: 1600
I (581) wifi:Init static rx buffer num: 10
I (581) wifi:Init dynamic rx buffer num: 32
I (581) wifi_init: rx ba win: 6
I (591) wifi_init: tcpip mbox: 32
I (591) wifi_init: udp mbox: 6
I (591) wifi_init: tcp mbox: 6
I (601) wifi_init: tcp tx win: 2920
I (601) wifi_init: tcp rx win: 5840
I (611) wifi_init: tcp mss: 1436
I (611) wifi_init: WiFi IRAM OP enabled
I (611) wifi_init: WiFi RX IRAM OP enabled
I (621) [IoT]: iot_bsp_wifi_init(292) > [esp32] iot_bsp_wifi_init done
I (631) [IoT]: st_conn_init(1134) > stdk_version : 1.8.14
esta es la version numero 1
I (641) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (641) gpio: GPIO[26]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (651) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0
I (661) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1|I (2681) [IoT]: st_conn_start(1222) > st_conn_start start (no-pin)
I (2681) [IoT]: _check_prov_status(235) > Current deviceID: 6543a7c7-2d1c-4e86-8675-ba35fea2a1e9 (36)
I (2681) [IoT]: st_conn_start(1274) > st_conn_start done (0)
I (2691) [IoT]: _do_iot_main_command(586) > curr_main_cmd:0, curr_main_state:0
I (2701) [IoT]: _do_state_updating(435) > current state 0, new state 5
status: 1, stat: 0
I (2701) [IoT]: _do_state_updating(573) > Call usr status_cb with 0x01
I (2711) [IoT]: _do_iot_main_command(586) > curr_main_cmd:3, curr_main_state:5
I (2721) [IoT]: iot_bsp_wifi_set_mode(310) > iot_bsp_wifi_set_mode = 2
I (2731) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (2821) wifi:mode : sta (40:91:51:fc:f7:a4)
I (2831) wifi:enable tsf
I (2831) [IoT]: esp_wifi_event_post_to_user(106) > Station started
I (2831) [IoT]: iot_bsp_wifi_set_mode(410) > connect to ap SSID:dinfi
I (3681) wifi:new:<8,1>, old:<1,0>, ap:<255,255>, sta:<8,1>, prof:1
I (4251) wifi:state: init -> auth (b0)
I (4261) wifi:state: auth -> init (8a0)
I (4261) wifi:new:<8,0>, old:<8,1>, ap:<255,255>, sta:<8,1>, prof:1
I (4261) [IoT]: esp_wifi_event_post_to_user(119) > Disconnect reason : 202
I (4271) wifi:new:<8,1>, old:<8,0>, ap:<255,255>, sta:<8,1>, prof:1
I (4271) wifi:state: init -> auth (b0)
I (4291) wifi:state: auth -> assoc (0)
I (4291) wifi:state: assoc -> run (10)
I (4331) wifi:connected with dinfi, aid = 2, channel 8, 40U, bssid = d8:0d:17:75:6b:56
I (4331) wifi:security: WPA2-PSK, phy: bgn, rssi: -67
I (4331) wifi:pm start, type: 1
I (4331) [IoT]: esp_wifi_event_post_to_user(141) > Wifi Connected
I (4361) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (5841) [IoT]: esp_ip_event_post_to_user(196) > got ip:192.168.0.122
I (5841) [IoT]: iot_bsp_wifi_set_mode(415) > AP Connected
I (5841) esp_netif_handlers: sta ip: 192.168.0.122, mask: 255.255.255.0, gw: 192.168.0.1
I (5851) [IoT]: iot_bsp_wifi_set_mode(433) > Time is not set yet. Connecting to WiFi and getting time over NTP.
I (5861) [IoT]: _initialize_sntp(58) > Initializing SNTP
I (5861) [IoT]: _obtain_time(87) > Waiting for system time to be set... (1/10)
I (6191) wifi:idx:0 (ifx:0, d8:0d:17:75:6b:56), tid:6, ssn:2, winSize:64
I (6211) wifi:idx:1 (ifx:0, d8:0d:17:75:6b:56), tid:0, ssn:0, winSize:64
I (7871) [IoT]: _obtain_time(97) > [WIFI] system time updated by 1
I (7901) [IoT]: iot_es_connect(1086) > connect_type: log-in
I (7901) [IoT]: _iot_es_mqtt_connect(925) > url: mqtt-regional-euwest1.api.smartthings.com, port: 8883
I (7901) [IoT]: _iot_es_mqtt_connect(931) > mqtt connect,
id : 575b8553-014e-40cf-b24d-d3cf37c7536d
username : 6543a7c7-2d1c-4e86-8675-ba35fea2a1e9
password : eyJhbGciOiJFZERTQSIsImt0eSI6Ik9LUCIsImNydiI6IkVkMjU1MTkiLCJ0eXAiOiJKV1QiLCJ2ZXIiOiIwLjAuMSIsImtpZCI6IlNUREs4Wk5UNHFOcW5Za1oifQ==.eyJpYXQiOiIxNzA4NTM1MDE5IiwianRpIjoiZmQwOGU1NzEtOTU4YS00MmI2LWI0ODQtZjY5MmZlODkzMWY2IiwibW5JZCI6IjBCTEcifQ==.mJLuGEIOB5lebgfO5ipgFbAWGQQJCR3cfdzMME63OMj+uOtTKxF+5LjaMeeSYVZYaioKbd0ItBj+FWkOCOT2CQ==
I (7951) [IoT]: _iot_net_tls_connect(416) > Loading the CA root certificate 1317@0x3ffcd328
I (8681) [IoT]: iot_es_connect(1106) > MQTT connect success sucess/try : 1/1
I (8781) [IoT]: _check_connection_response(79) > Connection response payload {"target":"6543a7c7-2d1c-4e86-8675-ba35fea2a1e9","currentTime":1708535019,"event":"connect.success"}
I (8791) [IoT]: _do_iot_main_command(586) > curr_main_cmd:0, curr_main_state:5
I (8801) [IoT]: _do_state_updating(435) > current state 5, new state 6
I (8801) [IoT]: _get_device_preference(423) > Get device preference
I (8811) [IoT]: iot_cap_call_init_cb(1341) > Call init_cb for switch capability
I (8821) [IoT]: st_cap_send_attr(613) > publish event, topic : /v1/deviceEvents/6543a7c7-2d1c-4e86-8675-ba35fea2a1e9, payload :
{"deviceEvents":[{"component":"main","capability":"switch","attribute":"switch","value":"on","providerData":{"sequenceNumber":1,"timestamp":"1708535020023"}}]}
Sequence number return : 1
I (8851) [IoT]: iot_cap_call_init_cb(1341) > Call init_cb for firmwareUpdate capability
value is NULL
value is NULL
I (8861) [IoT]: st_cap_send_attr(613) > publish event, topic : /v1/deviceEvents/6543a7c7-2d1c-4e86-8675-ba35fea2a1e9, payload :
{"deviceEvents":[{"component":"main","capability":"firmwareUpdate","attribute":"currentVersion","value":"switch_example_001","providerData":{"sequenceNumber":2,"timestamp":"1708535020063"}}]}
Sequence number return : 2
value is NULL
value is NULL
value is NULL
status: 8, stat: 2
I (8891) [IoT]: _do_state_updating(573) > Call usr status_cb with 0x208
I (9111) [IoT]: _iot_parse_noti_data(650) > payload : {"target":"6543a7c7-2d1c-4e86-8675-ba35fea2a1e9","values":{},"event":"device.preferences"}
I (9111) [IoT]: _iot_parse_noti_data(749) > No references
I (9121) [IoT]: iot_noti_sub_cb(829) > Ignore notification
E (32701) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x7780
I (32701) esp-tls-mbedtls: Certificate verified.
E (32701) esp-tls: Failed to open new connection
E (32701) transport_base: Failed to open a new connection
E (32711) HTTP_CLIENT: Connection failed, sock < 0
HTTP_EVENT_ERROR
Failed to open HTTP connection: 28674
The text was updated successfully, but these errors were encountered: