Updating **custom component** took longer than the scheduled update interval

Is there a way to avoid this problem:


Updating **custom component** took longer than the scheduled update interval 0:00:01
Updating **custom component** took longer than the scheduled update interval 0:00:01
Updating **custom component** took longer than the scheduled update interval 0:00:01
Updating **custom component** took longer than the scheduled update interval 0:00:01

I am running Home Assistant 0.91.0 on Hassbian, on a Raspberry Pi 3B. I have this problem for a while on previous versions also… The only way I can restart/reboot correctly Home Assistant is to unplug the power (sudo reboot through SSH or restart through Lovelace does not work properly). It’s my RPi3B I use to develop my custom component, and up to now, I’ve only one custom component installed on it.

The update warning appears randomly after a day or more. Sometimes it takes several days to appear.

Here is my custom component:

If you have any proposal regarding the code to prevent this issue, or have an idea of what may be causing this problem, please let me know!

That update interval is too short for the raspi’s limited resources. Try 10 seconds.

And not sure if it’s correct or not but “component” is spelled wrong in the error. That might be an issue if your config is spelled that way.

:laughing: Oops, finity, you discovered me! English is not my first language! Sorry for this typo … I adjusted the title and the text. Thank-you,

tom_l, I will let you know my tests results…

After a few tests, I found the root cause of this problem. My custom component code does not correctly handle a network failure. Whenever I temporarily lost the connection with the interface of my spa (because of interference or others), the custom component code do not reinitialize the connection. I will have to reinforce the code to take into account the absence on the network of my custom component during the initialization of Home Assistant and the network instabilities in use.

If you have any suggestions for managing this, do not hesitate to make a Pull Request on GGitHub.

Hurray! I finally fixed the problem!

In the code, while I was trying to connect, receive, or send with my component, I were not dealing adequately errors / exceptions. I added try: and except: instructions to correctly handle .connect, .recv and .send commands. Also, I now manage different errno to condition adequately calls, variables! Hopefully these code changes will survive the next Hass.io updates! :wink:

Here is my updated code: