ESPhome loop watchdog?


When creating a custom component in ESPhome, the loop() needs to finish/cycle within a certain amount of time…
How often should this happen ?

For example - I have a device, where I need to send 480 characters using 2400 8N1 trough a serial port - this will take 2 seconds, but I assume, that using 2 seconds in the loop() will cause the watchdog to trigger and reset the esp device ?

Is indeed much to much :joy:

I think 16ms is the typical loop - longer will cause at least a warning that a component is blocking :stop_sign:

Can you send just one character each loop without starving the loop? They’re not required to arrive without inter-character delay, just that the bit timing within each character has to fit the 2400 bpS 8/n/1 format.

The specs states to send 01010101 2400 8N1 for 2 seconds (or actually 2.2 seconds) in order to enbale communication via the IR port. I just need to make sure, that I can get a steady stream of data flowing - to make sure, that I get the IR port open for communcation.
Afterwards I need to figure out how to communicate with the device - in something that looks like the M-Bus protocol…

Hmmm. Yeah, that’s probably going to be tough to do without starving the loop.
Are you certain that it can’t tolerate a few inter-character pauses?
By definition, async RS-232 is not required to trail the characters immediately behind one another.
Since the device uses specs like it does, is it worth testing sending one char per loop(), for a total duration of 2.2S, just to see?