blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.81k stars 1.38k forks source link

Arduino Usb SER.sh ssl not working #573

Closed diliboy88 closed 1 year ago

diliboy88 commented 1 year ago

Libary link: Blynk.zip

Blynk library version: Cant tell IDE: Arduino IDE version: 2.0.1 Board type: Arduino_uno Additional modules: none

Scenario, steps to reproduce

Im trying to use blynk (btw im new) with usb so i try and it says (video) to use ser.sh but i get a ssl error and more

Expected Result

My device is online and works.

Actual Result

it says this

   1 ports found. You can specify port manually using -c option

Select serial port [ /dev/tty.usbmodem14201 ]: /dev/tty.usbmodem14201 Resetting device /dev/tty.usbmodem14201... [ Press Ctrl+C to exit ] Connecting: GOPEN:/dev/tty.usbmodem14201,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:443,cafile=/Users/......./Downloads/Blynk/scripts/certs/server.crt,nodelay 2022/11/03 18:55:30 socat[72122] N opening character device "/dev/tty.usbmodem14201" for reading and writing 2022/11/03 18:55:30 socat[72122] N opening connection to LEN=16 AF=2 139.59.206.133:443 2022/11/03 18:55:30 socat[72122] N successfully connected from local address LEN=16 AF=2 192.168.1.241:61523 2022/11/03 18:55:30 socat[72122] E SSL_connect(): error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 2022/11/03 18:55:30 socat[72122] N exit(1) Reconnecting in 3s...

John93-Blynk commented 1 year ago

Blynk IOT (the new one) or legacy (the old one) ?

diliboy88 commented 1 year ago

BLynk IOT

Karl2301 commented 1 year ago

Old Blynk > New Blynk

John93-Blynk commented 1 year ago

Make sure that you are using the latest version of the library (1.1.0) . After that, you should edit the blynk-ser.bat file and replace "blynk-cloud com" with "blynk.cloud".

diliboy88 commented 1 year ago

Now Im getting this

ports found. You can specify port manually using -c option Select serial port [ /dev/tty.usbmodem14201 ]: /dev/tty.usbmodem14201 Resetting device /dev/tty.usbmodem14201... [ Press Ctrl+C to exit ] Connecting: GOPEN:/dev/tty.usbmodem14201,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk.cloud:443,cafile=/Users/......../Downloads/blynk-library-master/scripts/certs/server.crt,nodelay 2022/11/06 09:17:33 socat[45415] N opening character device "/dev/tty.usbmodem14201" for reading and writing 2022/11/06 09:17:33 socat[45415] N opening connection to LEN=16 AF=2 159.65.55.83:443 2022/11/06 09:17:33 socat[45415] N successfully connected from local address LEN=16 AF=2 192.168.1.241:65250 2022/11/06 09:17:33 socat[45415] E SSL_connect(): error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 2022/11/06 09:17:33 socat[45415] N exit(1) Reconnecting in 3s...

diliboy88 commented 1 year ago

here is my ser script: blynk-ser.txt

and here is my library:

blynk-library-master.zip

John93-Blynk commented 1 year ago

you should edit the batch file Capture so it should look like this

@echo off
setlocal EnableDelayedExpansion

REM === Edit these lines to match your need ===

set COMM_PORT=COM4
set COMM_BAUD=9600
set SERV_ADDR=blynk.cloud
set SERV_PORT=80

REM === Edit lines below only if absolutely sure what you're doing ===

rem Get command line options
set SCRIPTS_PATH=%~dp0

:loop
IF NOT "%1"=="" (
    IF "%1"=="-c" set COMM_PORT=%2& SHIFT & SHIFT & GOTO :loop
    IF "%1"=="-b" set COMM_BAUD=%2& SHIFT & SHIFT & GOTO :loop
    IF "%1"=="-s" set SERV_ADDR=%2& SHIFT & SHIFT & GOTO :loop
    IF "%1"=="-p" set SERV_PORT=%2& SHIFT & SHIFT & GOTO :loop

    CALL :usage
    GOTO :eof
)

rem Find ports
set PORTS=
for /f "tokens=4 delims=: " %%A in ('mode^|findstr "COM[0-9]*:"') do IF not [%%A] == [] set PORTS=!PORTS! %%A
set PORTS=!PORTS:~1!

rem Check port
rem Skip check if no ports at all - Windows bug?
if not "x%PORTS%"=="x~1" (
    if "x!PORTS:%COMM_PORT%=!"=="x%PORTS%" (
        echo %COMM_PORT% not found, or may be busy.
        set /p COMM_PORT="Select serial port [ %PORTS% ]: "
    )
)

rem Create exe
if not exist "%SCRIPTS_PATH%\com2tcp.exe" (
    copy "%SCRIPTS_PATH%\com2tcp.bin" "%SCRIPTS_PATH%\com2tcp.exe" > NUL
)

rem Do the job
echo Connecting device at %COMM_PORT% to %SERV_ADDR%:%SERV_PORT%...

rem Try resetting board
rem mode %COMM_PORT%:%COMM_BAUD%,N,8,1 >nul

:restart
  "%SCRIPTS_PATH%\com2tcp.exe" --baud %COMM_BAUD% --ignore-dsr \\.\%COMM_PORT% %SERV_ADDR% %SERV_PORT%
  echo Reconnecting in 3s...
  timeout /T 3
goto restart

goto:eof

:usage
    echo.
    echo.   This script redirects serial communication to the server.
    echo.
    echo.   You can specify port, baud rate, and server endpoint like this:
    echo.     blynk-ser.bat -c ^<serial port^> -b ^<baud^> -s ^<server^> -p ^<port^>
    echo.
    echo.   The defaults are:
    echo.     -c    /dev/ttyUSB0       (on Linux)
    echo.           COM1               (on Windows)
    echo.           /dev/tty.usbserial (on OSX)
    echo.     -b    9600
    echo.     -s    blynk-cloud.com
    echo.     -p    80
    echo.
    echo.   If the specified serial port is not found, it will ask to enter another one.
    echo.   The script also tries to reestablish connection if it was lost.
goto:eof
diliboy88 commented 1 year ago

Im using mac/darwin

John93-Blynk commented 1 year ago

This might help you https://docs.blynk.io/en/legacy-platform/legacy-articles/usb-serial If that doesn't help, I'd suggest that you go to the blynk community and open a new "need help with my project" thread.

diliboy88 commented 1 year ago

Thank you