lovelace-auto-entities
lovelace-auto-entities copied to clipboard
Race condition causes unreliable behavior with custom container cards
I believe there is a race condition in auto-entities code that causes it to behave unreliably (to occasionally fail to load and just display a blank card) especially with custom container cards, presumably because they are slower to load. This issue is likely the root cause of piitaya/lovelace-mushroom#698 and #286.
It appears that that is a lack on synchronization to wait for the container card to finish loading before we start adding entities to it.
Specifically, I have observed that adding a "sleep" (await new Promise(r => setTimeout(r, 200));
) before this line appears to work around the problem, although I don't know enough about JS to know what the proper fix is.
This comment by @jcwillox (thanks, Josh!) might have some clues as per the real cause.