Closed decaffeinatedcoffee closed 6 months ago
Does this also happen if you use a pure example sketch, e.g. the switch example?
Does this also happen if you use a pure example sketch, e.g. the switch example?
the switch example worked fine
Okay, for some reason the problem is a conflict with Http requests, when i run setup without http requests sinric connects fine, also it still makes all the http on loop stop, what could cause http and sinricpro conflict?
I will try to reproduce it. Unfortunately, your code is a bit "messy". Therefore I first have to clean up the code to understand what's intended to do and what happens where.
Oh wait. One thing just popped into my head!
You are using WiFiClientSecure!
SinricPro also uses an SSL connection by default.
It is known that the ESP can only handle one SSL connection at a time.
SinricPro runs over WebSocket and has a persistent (SSL) connection!
Try to switch to a simple WiFiClient or use #define SINRICPRO_NOSSL
before #include SinricPro.h
.
Oh wait. One thing just popped into my head! You are using WiFiClientSecure! SinricPro also uses an SSL connection by default. It is known that the ESP can only handle one SSL connection at a time. SinricPro runs over WebSocket and has a persistent (SSL) connection! Try to switch to a simple WiFiClient or use
#define SINRICPRO_NOSSL
before#include SinricPro.h
.
OMG you are a genius it worked fine! thank you so much
okay just one more thing now sometimes i get a problem with sinric websocket where it just never connect:
here is the logs
[SinricPro:Websocket]: Connecting to WebSocket Server (ws.sinric.pro)
[SinricPro:Websocket]: headers:
appkey:XXXXXXXXXXXXXXXXXXX
deviceidsXXXXXXXXXXXXXXXXX
restoredevicestates:false
ip:192.168.0.26
mac:48:55:19:0B:48:50
platform:ESP8266
SDKVersion:3.0.1
[SinricPro:Websocket]: disconnected
[SinricPro:Websocket]: disconnected
and in dashboard i get
A debug log could help here.
To activate debugging, insert this code block before #include <SinricPro.h>
:
#define DEBUG_ESP_PORT Serial
#define NODEBUG_WEBSOCKETS
#define NDEBUG
A debug log could help here.
To activate debugging, insert this code block before
#include <SinricPro.h>
:#define DEBUG_ESP_PORT Serial #define NODEBUG_WEBSOCKETS #define NDEBUG
Yep debug log only drops this
[SinricPro:Websocket]: Connecting to WebSocket Server (ws.sinric.pro)
[SinricPro:Websocket]: headers:
appkey:XXXXXXXXXXXXXXXXXXX
deviceidsXXXXXXXXXXXXXXXXX
restoredevicestates:false
ip:192.168.0.26
mac:48:55:19:0B:48:50
platform:ESP8266
SDKVersion:3.0.1
[SinricPro:Websocket]: disconnected
[SinricPro:Websocket]: disconnected```
The connection is managed and established by SinricPro.handle()
not by SinricPro.begin()
.
While SinricPro.handle() is called periodically the underlying WebSocket client tries to connect.
Regarding to your code (SinricPro.onConnected([]() { Serial.println("[NETWORK] Connected to SinricPro"); });
) you should see "[NETWORK] Connected to SinricPro" after a few seconds.
The connection is managed and established by
SinricPro.handle()
not bySinricPro.begin()
. While SinricPro.handle() is called periodically the underlying WebSocket client tries to connect. Regarding to your code (SinricPro.onConnected([]() { Serial.println("[NETWORK] Connected to SinricPro"); });
) you should see "[NETWORK] Connected to SinricPro" after a few seconds.
yep but its not happening i only get
[SinricPro:Websocket]: disconnected
every few seconds
I assume that it doesn't happen with the pure switch example?
yes the example works fine, btw ill test example with the #define SINRICPRO_NOSSL
line since it started after this
Then the cause lies somewhere in your code.
I suggest breaking it down into individual functional parts and activating them one by one. This is the best way to find the problematic part.
okay the example works ill do some tests on my code
I'll see if I can find out something tomorrow. It's already too late for today and your code is unfortunately written very complicated to perform a quick analysis.
ok, apparently sinric cant connect while the esp is using the http to send info to my own API
ok, apparently sinric cant connect while the esp is using the http to send info to my own API
It's a limitation of the ESP, not SinricPro.
Can you describe in words what the sketch is supposed to do? (It's very hard to read from the code). Maybe together we can find a better way to handle things that leads to a stable connection.
I'm creating a project that consists in my own API with its own APP and SinricPro, its a smart light switch, the code was working fine some time ago but now sinric just takes too long to connect and after connected all my code stops working and only sinric related part works, i can't find a solution for this right now
on setup after wifi connected i have
i also have
SinricPro.handle();
on loop and im using millis instead of delay on my whole codei can't understand why it takes too long to connect and after this makes my code stop working
also the whole code can be found here https://github.com/decaffeinatedcoffee/GeminiPro/tree/main/MCU