sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
227 stars 121 forks source link

ESP8266 WebSocket disconnects and no data is sent #358

Closed nicovil closed 6 months ago

nicovil commented 6 months ago

Hello.

I'm trying to add temperature sensor to my ESP8266 project, and for some reason the websocket conecction is failing.

I tried to disable SSL (using SINRICPRO_NOSSL) to see if it was a free heap memory issue but similar problem happens (only the SSL handshake happens and then the same error is being thrown).

I'm using basically the same configuration from template project (removing onPowerState event handler that is not present anymore in 3.0+ version of the API).

Another detail that could be important is that I'm using AsyncWebServer instance to attend HTTP requests.

Below is the debug data, something I noticed that is a little weird for me is that the "sending header" event is taking 63495us (and with SSL up to 333713us!) due to the logs, but the log line appears only 5 or 6 seconds after the ESP8266 boots so that value doesn't makes too much sense to me (63/333 seconds is more than the time since the ESP is turned on)

Of course I removed APPKEY/DEVICEID and MAC from logs.

Without SSL

[SinricPro]: Device "XXXXXXXXXXXXXXXXXXXXXX" does not exist. Creating new device
[SinricPro:add()]: Adding device with id "XXXXXXXXXXXXXXXXXXXXXX".
.....
[SinricPro:Websocket]: Connecting to WebSocket Server (ws.sinric.pro)
[String] 'appkey:d96 ... 5:37:84:68': Reallocating large String(147 -> 165 bytes)
[String] 'appkey:d96 ... rm:ESP8266': Reallocating large String(165 -> 183 bytes)
[SinricPro:Websocket]: headers:
appkey:XXXXXXXXXXXXXXXXXXXXXX
deviceids:YYYYYYYYYYYYYYYYYYYYYYYY
restoredevicestates:false
ip:192.168.50.64
mac:4C:75:25:XX:YY:ZZ
platform:ESP8266
SDKVersion:3.0.1
[WS-Client] Websocket Version: 2.4.0
[WS-Client] connect ws...
[WS-Client] connected to ws.sinric.pro:80.
[WS-Client][sendHeader] sending header...
[String] 'GET / HTTP ... xK8oLQ==
': Reallocating large String(153 -> 177 bytes)
[String] 'GET / HTTP ... arduino
': Reallocating large String(186 -> 371 bytes)
[String] 'GET / HTTP ... on:3.0.1
': Reallocating large String(371 -> 409 bytes)
[WS-Client][sendHeader] handshake GET / HTTP/1.1
Host: ws.sinric.pro:80
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: Hc2gfVGzP6XQMd5UxK8oLQ==
Sec-WebSocket-Protocol: arduino
appkey:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
deviceids:YYYYYYYYYYYYYYYYYYYYYYY
restoredevicestates:false
ip:192.168.50.64
mac:4C:75:25:XX:YY:ZZ
platform:ESP8266
SDKVersion:3.0.1
User-Agent: arduino-WebSocket-Client
[write] n: 411 t: 14646
[WS-Client][sendHeader] sending header... Done (63495us).
pm open,type:2 0
[SinricProDevice::sendEvent]: The event could not be sent. No connection to the SinricPro server.
Something went wrong...could not send Event to server!

With SSL

[SinricPro]: Device "XXXXXXXXXXXXXXXXXXXXXX" does not exist. Creating new device
[SinricPro:add()]: Adding device with id "XXXXXXXXXXXXXXXXXXXXXX".
.....
[SinricPro:Websocket]: Connecting to WebSocket Server using SSL (ws.sinric.pro)
[String] 'appkey:d96 ... 5:37:84:68': Reallocating large String(147 -> 165 bytes)
[String] 'appkey:d96 ... rm:ESP8266': Reallocating large String(165 -> 183 bytes)
[SinricPro:Websocket]: headers:
appkey:XXXXXXXXXXXXXXXXXXXXXXXXXX
deviceids:YYYYYYYYYYYYYYYYYYYYYYY
restoredevicestates:false
ip:192.168.50.64
mac:4C:75:25:XX:YY:ZZ
platform:ESP8266
SDKVersion:3.0.1
[WS-Client] Websocket Version: 2.4.0
[WS-Client] connect wss...
BSSL:_connectSSL: start connection
BSSL:CERT: 30 82 04 e7 30 82 03 cf a0 03 02 01 02 02 12 04 c4 bb be 4d e5 f5 48 7d 35 05 71 ba fc e5 8d 46 c0 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 32 31 0b 30 09 06 03 55 04 06 13 02 55 53 31 16 30 14 06 03 55 04 0a 13 0d 4c 65 74 27 73 20 45 6e 63 72 79 70 74 31 0b 30 09 06 03 55 04 03 13 02 52 33 30 1e 17 0d 32 33 31 31 30 39 30 37 30 38 32 34 5a 17 0d 32 34 30 32 30 37 30 37 30 38 32 33 5a 30 18 31 16 30 14 06 03 55 04 03 13 0d 77 73 2e 73 69 6e 72 69 63 2e 70 72 6f 30 82 01 22 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 0a 02 82 01 01 00 ab f8 06 e8 86 47 91 32 c6 71 cc 3a 4c 72 77 b7 e8 1b 46 01 b3 32 fd a2 f3 e2 78 fe b8 47 e0 80 35 88 45 3a c8 c1 a1 a5 5e 0f b2 55 59 75 3f 4a 12 8b 2d 67 e6 03 08 20 f1 a8 aa 88 cc 0f 57 63 87 BSSL:CERT: 92 c5 2c 31 37 3e 28 70 5b 6f 16 2a 2e 73 8c 83 72 91 08 1b df f2 b5 98 a5 98 23 9f af b5 cd d5 e7 e3 56 18 27 b5 12 55 9e 03 99 ed 34 fa b4 ac df 06 f8 04 81 be f0 c0 8a 04 a0 c2 11 85 da 7f 02 38 17 01 d7 f2 8b f0 d5 68 93 2c 2f 66 8c ee dc 5f 86 88 ae 1d 1d a2 70 90 4e f8 6f 8f eb 0e 64 52 30 86 95 2b b5 4e e9 2a 02 01 bb 97 2a 4b 82 c0 f5 7c 2d 2a 79 97 50 f9 c0 d8 62 47 8b 58 83 88 d1 54 a9 d9 fb 33 de f8 1c 65 f0 e4 67 a0 69 9e 5a d2 ba cd 2a e5 a4 f4 90 ea 2c 5a 6b fa ad 77 b4 c4 40 a3 cd 92 ce fd ea 57 f8 b1 66 12 bd 7f 71 b5 84 aa 81 4a 71 4a 36 e7 3b 7d b3 02 03 01 00 01 a3 82 02 0f 30 82 02 0b 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 BSSL:CERT: 1d 13 01 01 ff 04 02 30 00 30 1d 06 03 55 1d 0e 04 16 04 14 0f d2 80 40 bf cd c1 01 19 8e 66 df f4 c7 03 56 a6 4b 08 11 30 1f 06 03 55 1d 23 04 18 30 16 80 14 14 2e b3 17 b7 58 56 cb ae 50 09 40 e6 1f af 9d 8b 14 c2 c6 30 55 06 08 2b 06 01 05 05 07 01 01 04 49 30 47 30 21 06 08 2b 06 01 05 05 07 30 01 86 15 68 74 74 70 3a 2f 2f 72 33 2e 6f 2e 6c 65 6e 63 72 2e 6f 72 67 30 22 06 08 2b 06 01 05 05 07 30 02 86 16 68 74 74 70 3a 2f 2f 72 33 2e 69 2e 6c 65 6e 63 72 2e 6f 72 67 2f 30 18 06 03 55 1d 11 04 11 30 0f 82 0d 77 73 2e 73 69 6e 72 69 63 2e 70 72 6f 30 13 06 03 55 1d 20 04 0c 30 0a 30 08 06 06 67 81 0c 01 02 01 30 82 01 04 06 0a 2b 06 01 04 01 d6 79 02 04 02 04 81 f5 04 81 f2 00 f0 00 76 00 48 b0 e3 6b da a6 47 34 0f e5 6a 02 fa 9d 30 eb 1c 52 01 cb 56 dd BSSL:CERT: 2c 81 d9 bb bf ab 39 d8 84 73 00 00 01 8b b3 20 0f 0d 00 00 04 03 00 47 30 45 02 20 78 1d c1 5d cd b5 d6 b8 4f 39 5b 53 23 ee f3 e3 83 51 ea 1b 10 83 7d ba b1 34 d9 12 ba 26 bf ee 02 21 00 b7 be 78 aa 34 e1 20 a7 68 0f 8d 2f 87 06 1b a4 89 7d cd 4b 75 fc e4 c3 9f be e3 1b f8 f4 cd d5 00 76 00 3b 53 77 75 3e 2d b9 80 4e 8b 30 5b 06 fe 40 3b 67 d8 4f c3 f4 c7 bd 00 0d 2d 72 6f e1 fa d4 17 00 00 01 8b b3 20 0f 34 00 00 04 03 00 47 30 45 02 21 00 f2 ad 99 b3 91 17 60 27 94 1c 3c 80 8a e7 1c 78 b7 1b 20 74 8e 95 43 e1 e6 36 1a 61 3a 97 ab 0e 02 20 30 d7 28 bc 65 05 2d a4 53 f7 f2 e3 83 f7 68 a7 bf 23 c0 30 b3 85 17 8d 77 9b f5 77 11 38 ef c3 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 82 01 01 00 b3 4f 9d 34 fc 13 39 79 79 48 42 2f 79 3e ea 5f fa 58 61 83 1f BSSL:CERT: 6b 91 9d 16 bc 31 8c 36 24 11 79 c6 47 9a 10 fb d2 9c 47 18 58 91 36 05 31 18 52 1d 2f 2c df 32 a5 6a 5e 75 d2 45 f0 3d af f7 5b a6 dc bd 20 84 8d 12 47 fb 72 13 4e d8 c2 b2 de 22 95 0c 20 21 1f 5b cb db 9b e5 6c aa 20 45 82 42 de 02 33 bf b7 1c d0 f2 84 f0 8f c6 95 a9 67 33 c6 3c 8f 92 97 a8 6d 43 75 ad 2d f2 47 06 69 53 55 01 9b 06 3d 85 0f 32 55 89 c0 01 1b 2f 5e ed 1a 02 be 08 c7 d2 38 51 d1 26 76 af d8 63 1a c5 4b 17 83 7f 5e f0 ca ed 5d 80 ef c3 c4 c5 49 95 a4 78 d6 1b b2 2c de 38 8e f1 44 0c ed 59 6c 70 53 ce 05 d4 b7 63 0b ac 36 83 4f 88 6e 76 5a f1 13 9d f2 02 bd 33 05 b3 54 a4 6e 5e bf 79 cb 31 42 8c 63 00 31 c2 4e b2 60 02 cb 53 63 d7 26 f4 e0 d3 4f 62 6a c6 2f c4 79 83 0a f5 cf 3a 54 pm open,type:2 0
BSSL:Connected!
[WS-Client] connected to ws.sinric.pro:443.
[WS-Client][sendHeader] sending header...
[String] 'GET / HTTP ... cket-Key: ': Reallocating large String(128 -> 154 bytes)
[String] 'GET / HTTP ... 6njU3Q==
': Reallocating large String(154 -> 178 bytes)
[String] 'GET / HTTP ... arduino
': Reallocating large String(187 -> 372 bytes)
[String] 'GET / HTTP ... on:3.0.1
': Reallocating large String(372 -> 410 bytes)
[WS-Client][sendHeader] handshake GET / HTTP/1.1
Host: ws.sinric.pro:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: YRyKwFRFB6+g42776njU3Q==
Sec-WebSocket-Protocol: arduino
appkey:XXXXXXXXXXXXXXXXXXXXXXXXX
deviceids:YYYYYYYYYYYYYYYYYYYYYYY
restoredevicestates:false
ip:192.168.50.64
mac:4C:75:25:XX:YY:ZZ
platform:ESP8266
SDKVersion:3.0.1
User-Agent: arduino-WebSocket-Client
[write] n: 412 t: 18731
[WS-Client][sendHeader] sending header... Done (333713us).
[SinricProDevice::sendEvent]: The event could not be sent. No connection to the SinricPro server.
Something went wrong...could not send Event to server!
[MAIN] Free heap: 2904 bytes
[WS-Client][handleClientData] header response timeout.. disconnecting!
[WS-Client] client disconnected.
[SinricPro:Websocket]: disconnected

sivar2311 commented 6 months ago

I dug out my old NodeMCU and ran a test with SSL. No problems at all. Versions used:

What I did notice:

Do the problems also occur if you use the pure example sketch? So without AsyncWebServer etc?

nicovil commented 6 months ago

I dug out my old NodeMCU and ran a test with SSL. No problems at all. Versions used:

* Arduino: 3.1.2

* SinricPro: 3.0.1

* WebSockets: 2.4.1

What I did notice:

* SSL certificates appear in your log. Where does this certificate come from? (SinricPro does not use certificates.)

* Your WebSockets library version 2.4.0 is outdated (current version is 2.4.1)

Do the problems also occur if you use the pure example sketch? So without AsyncWebServer etc?

Hi and thanks for your response.

I guess the SSL certificates shown in the log come from the HTTPS request made to SinricPro server (the SSL handshake should retrieve a certificate from HTTPS site and exchange some messages using public key in that certificate to protect the communication). Not sure in deep how WebSockets api works internally, but

Regarding WebSockets library, 2.4.0 is the latest available one in Arduino IDE, not sure if that's important since it's a requirement that has been installed automatically by Sinric API (as dependency) and then it meets the minimum requirements for the Sinric API.

Regarding AsyncWebServer, I didn't tested a pure Sinric example since my project has a lot of other stuff, it could be possible that using the code provided as example should work, but the good thing of using Sinric is to make use of it in more complex projects.

What I see is that Sinric's WebSocket sends the headers and establishes a connection (I see how the device switches between ON and OFF states a lot of times in Sinric dashboard, so it's connecting with SINRIC in some way and then disconnected), but for some reason the connection get closed and then my sensor is not sending any data to server, it may be due to timeout or something like that.

sivar2311 commented 6 months ago

My log looks different:

WiFi connecting...
WiFi connected! IP:192.168.2.113
[SinricPro:Websocket]: Connecting to WebSocket Server using SSL (ws.sinric.pro)
[String] 'appkey:57c ... B:B7:BD:DA': Reallocating large String(147 -> 165 bytes)
[String] 'appkey:57c ... rm:ESP8266': Reallocating large String(165 -> 183 bytes)
[SinricPro:Websocket]: headers: 
appkey:xxx
deviceids:xxx
restoredevicestates:false
ip:192.168.2.113
mac:84:F3:EB:B7:BD:DA
platform:ESP8266
SDKVersion:3.0.1
[WS-Client] Websocket Version: 2.4.1
[WS-Client] connect wss...
[WS-Client] connected to ws.sinric.pro:443.
[WS-Client][sendHeader] sending header...
[String] 'GET / HTTP ... cket-Key: ': Reallocating large String(128 -> 154 bytes)
[String] 'GET / HTTP ... dODEJQ==
': Reallocating large String(154 -> 178 bytes)
[String] 'GET / HTTP ...  arduino
': Reallocating large String(187 -> 372 bytes)
[String] 'GET / HTTP ... on:3.0.1
': Reallocating large String(372 -> 410 bytes)
[WS-Client][sendHeader] handshake GET / HTTP/1.1
Host: ws.sinric.pro:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: a6pF+gNehxeyQ3G2dODEJQ==
Sec-WebSocket-Protocol: arduino
appkey:xxx
deviceids:xxx
restoredevicestates:false
ip:192.168.2.113
mac:84:F3:EB:B7:BD:DA
platform:ESP8266
SDKVersion:3.0.1
User-Agent: arduino-WebSocket-Client

[write] n: 412 t: 5325
[WS-Client][sendHeader] sending header... Done (92638us).
[WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS-Client][handleHeader] RX: Server: nginx
[WS-Client][handleHeader] RX: Date: Mon, 25 Dec 2023 20:07:04 GMT
[WS-Client][handleHeader] RX: Connection: upgrade
[WS-Client][handleHeader] RX: Upgrade: websocket
[WS-Client][handleHeader] RX: Sec-WebSocket-Accept: AE8MBpe4gKZAFaaqPyDnfVt5bKw=
[WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: arduino
[WS-Client][handleHeader] Header read fin.
[WS-Client][handleHeader] Client settings:
[WS-Client][handleHeader]  - cURL: /
[WS-Client][handleHeader]  - cKey: a6pF+gNehxeyQ3G2dODEJQ==
[WS-Client][handleHeader] Server header:
[WS-Client][handleHeader]  - cCode: 101
[WS-Client][handleHeader]  - cIsUpgrade: 1
[WS-Client][handleHeader]  - cIsWebsocket: 1
[WS-Client][handleHeader]  - cAccept: AE8MBpe4gKZAFaaqPyDnfVt5bKw=
[WS-Client][handleHeader]  - cProtocol: arduino
[WS-Client][handleHeader]  - cExtensions:
[WS-Client][handleHeader]  - cVersion: 0
[WS-Client][handleHeader]  - cSessionId: 
[WS-Client][handleHeader] Websocket connection init done.
[WS][0][headerDone] Header Handling Done.
[SinricPro:Websocket]: connected
Connected to SinricPro
[SinricPro:sendMessage()]: pushing message into sendQueue
[String] '{"header": ... ceId":"656': Reallocating large String(155 -> 186 bytes)
[String] '{"header": ... ","replyTo': Reallocating large String(186 -> 217 bytes)
[String] '{"header": ... be1-9b65-e': Reallocating large String(217 -> 248 bytes)
[String] '{"header": ... event","va': Reallocating large String(248 -> 279 bytes)
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 5508
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 24
[readCb] n: 24 t: 5531
[WS][0][handleWebsocket] text: {"timestamp":1703534824}
[SinricPro:Websocket]: receiving data
[SinricPro.handleReceiveQueue()]: 1 message(s) in receiveQueue
[SinricPro.handleReceiveQueue()]: Signature is valid. Processing message...
[SinricPro:extractTimestamp(): Got Timestamp 1703534824
[SinricPro:handleSendQueue()]: 1 message(s) in sendQueue
[SinricPro:handleSendQueue()]: Sending message...
[String] '{"action": ... 50-5d53-4b': Reallocating large String(155 -> 186 bytes)
[String] '{"action": ... ,"type":"e': Reallocating large String(186 -> 217 bytes)
[String] '{"action": ... ity":50,"t': Reallocating large String(217 -> 233 bytes)
[String] '{"header": ... 824,"devic': Reallocating large String(155 -> 186 bytes)
[String] '{"header": ... e133e8f02"': Reallocating large String(186 -> 217 bytes)
[String] '{"header": ... 50-5d53-4b': Reallocating large String(217 -> 248 bytes)
[String] '{"header": ... ,"type":"e': Reallocating large String(248 -> 279 bytes)
[String] '{"header": ... ity":50,"t': Reallocating large String(279 -> 310 bytes)
[String] '{"header": ... nature":{"': Reallocating large String(310 -> 341 bytes)
[String] '{"header": ... kR+O0f/vru': Reallocating large String(341 -> 364 bytes)
[String] '{"header": ... 824,"devic': Reallocating large String(155 -> 186 bytes)
[String] '{"header": ... e133e8f02"': Reallocating large String(186 -> 217 bytes)
[String] '{"header": ... 50-5d53-4b': Reallocating large String(217 -> 248 bytes)
[String] '{"header": ... ,"type":"e': Reallocating large String(248 -> 279 bytes)
[String] '{"header": ... ity":50,"t': Reallocating large String(279 -> 310 bytes)
[String] '{"header": ... nature":{"': Reallocating large String(310 -> 341 bytes)
[String] '{"header": ... kR+O0f/vru': Reallocating large String(341 -> 364 bytes)
{
  "header": {
    "payloadVersion": 2,
    "signatureVersion": 1
  },
  "payload": {
    "action": "currentTemperature",
    "cause": {
      "type": "PERIODIC_POLL"
    },
    "createdAt": 1703534824,
    "deviceId": "xxx",
    "replyToken": "68253650-5d53-4be1-9b65-e67a9dddaf76",
    "type": "event",
    "value": {
      "humidity": 50,
      "temperature": 25
    }
  },
  "signature": {
    "HMAC": "UrRPI/D3pl8FsBkR+O0f/vruGxsEuXOkkfHsGMuvrmY="
  }
}
[SinricPro:handleSendQueue]: Sending to websocket
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 364 headerToPayload: 0
[WS][0][sendFrame] text: {"header":{"payloadVersion":2,"signatureVersion":1},"payload":{"action":"currentTemperature","cause":{"type":"PERIODIC_POLL"},"createdAt":1703534824,"deviceId":"656221bb031135be133e8f02","replyToken":"68253650-5d53-4be1-9b65-e67a9dddaf76","type":"event","value":{"humidity":50,"temperature":25}},"signature":{"HMAC":"UrRPI/D3pl8FsBkR+O0f/vruGxsEuXOkkfHsGMuvrmY="}}
[WS][0][sendFrame] pack to one TCP package...
[write] n: 372 t: 5787
[WS][0][sendFrame] sending Frame Done (65986us).
[SinricPro:handleSendQueue()]: message sent.

There is no BSSL output in my log.

... but the log line appears only 5 or 6 seconds after the ESP8266 boots so that value doesn't makes too much sense to me (63/333 seconds is more than the time since the ESP is turned on)

Please not these values are us not ms! 63495us~= 63.5 milliseconds, not 63.5 seconds

To narrow down the cause, please test one of the pure SinricPro Temperature examples. Check if the error also appears there.

kakopappa commented 6 months ago

Most of the similar issues we had in the past were related to

  1. Not having enough memory

  2. have some blocking code (delay)

so the connection drops.

If you can provide an example to reproduce this issue we can try to help you

nicovil commented 6 months ago

Most of the similar issues we had in the past were related to 1. Not having enough memory 2. have some blocking code (delay) so the connection drops. If you can provide an example to reproduce this issue we can try to help you

I thought the same at first, I added a debug line to output the heap memory and sometimes it went down to about 5kb, so I disabled SSL (as troubleshooting page recommends) and again I have a disconnection.

I have a small delay of 250ms in main loop, and the tasks I'm doing in the loop are not blocking too much (just check temperature sensor, output data to a LCD screen, check some pushbuttons and handle 3 relays). The HTTP (alexa HUE emulation with fauxmoESP and a simple HTTP server) are using AsyncWebServer so they're not blocking and should not add any delay to main loop cycles (in fact, if no request is made, they're sleeping).

I will try to remove that delay of 250ms (I think it's too few to introduce a timeout to WebSocket, but who knows?) and back with the results.

Just to be sure, the NO SSL mode works correctly with latest API? I ask this just in case there is some change in server that removed the HTTP requests and now it only works with HTTPS or something like that.

nicovil commented 6 months ago

My log looks different:


There is no BSSL output in my log.

> > ... but the log line appears only 5 or 6 seconds after the ESP8266 boots so that value doesn't makes too much sense to me (63/333 seconds is more than the time since the ESP is turned on)

Please not these values are _us_ not _ms_! 63495us~= 63.5 milliseconds, not 63.5 seconds

To narrow down the cause, please test one of the pure SinricPro Temperature examples. Check if the error also appears there.

Oh, they're microseconds!... I just didn't noticed that, then the time looks fine for a SSL handshake.

Regarding the SSL, maybe you don't have SSL + HTTPS debug enabled in your Arduino IDE and that's why it's not logging the SSL certificate, could it be?

nicovil commented 6 months ago

Ok gentlemen, I figured out what the issue was. The delay of 250ms I had in the main loop was the root cause, I commented it out and things started to work in the first try.

Regarding SSL, I tried without SSL at first, and then with SSL, and worked in both cases, The only issue I noticed is that using SSL I have about 10kb of free heap memory, and without SSL about 40kb, so SSL is very very memory demanding and it's good to have in mind the "SINRICPRO_NOSSL" define to avoid those issues if more memory is required by any task.

I'm closing this issue now because removing that delay fixed the issue.

Thanks all for your help.-