Closed mareskav closed 2 years ago
Hi @mareskav!
Neither millis()
nor SinricPro.handle()
block the sketch.
Basically, SinricPro.handle()
is responsible for processing incoming requests and calling the corresponding callback functions of the devices. It is also responsible for sending the events of the devices to the SinricPro server.
I could only think of two scenarios that would lead to blocking:
In general, your project can be implemented without any problems.
Thank you for quick response @sivar2311 ! And sorry for my slow one.
I tested several iterations of my code and I concluded that:
millis()
function "is blocking the code" was pretty inaccurate. Maybe, just slowing the code a little bit down, that´s all.NTPClient
(https://github.com/arduino-libraries/NTPClient) to effectively schedule tasks as I wish.Thank you for hints! I guess I should take care of "Your sketch sends excessive events. In this case an artificial delay takes place to protect the SinricPro server from flooding. This is made visible with a corresponding serial output." in the future. Especially when I would decide to handle more devices at once and in short time.
I guess I can close this. Thanks again!
Hi there!
Could I ask you for help please? I ran into a problem where I am not able to run
SinricPro.handle()
together withmillis()
and Blink Without Delay example (https://www.arduino.cc/en/Tutorial/BuiltInExamples/BlinkWithoutDelay). It looks like thatmillis()
function is too much blocking SinricPro task in loop(), so it stops to response to my switch button ON / OFF clicks.My goal is to keep running ESP 8266 for an hour (before
ESP.deepSleep(fooTime)
will be called) and enjoy SinricPro websocket communication with Google Home. I saw a few examples of non-blocking codes here in issues, but couldn´t find anything what could solve my problem. Is it maybe job for Cooperative Multitasking? 🤔I went through a few code iterations, so not posting the code, but I can show an example if it would be helpfull of course. Basically, I just want:
SinricPro.handle()
switch and "non-blocking delay" for 1 hour or more ❓Btw, thank you for the great work with SinricPro library! It´s amazing and soo easy to use! ❤️