Fix serial integration connection stability (#33067)
Fix serial integration connection stability (#33067)

* Fix serial integration connection stability

Retry to connect if serial device is not available on start, or connection is lost.
Added some more log entries upon connection or when errors are encountered.

* Updated code based on review

* Fixed exception indentation

* Handle SerialException

* Sort imports

* Update homeassistant/components/serial/sensor.py

Co-Authored-By: Martin Hjelmare <173b16105eb9b11d9c39631a02fb13474d673162@gmail.com>

* Update homeassistant/components/serial/sensor.py

Co-Authored-By: Martin Hjelmare <173b16105eb9b11d9c39631a02fb13474d673162@gmail.com>

* More clean up

* Format and delint

* Extract error handler

* Clean up stop handler

Co-authored-by: Martin Hjelmare <173b16105eb9b11d9c39631a02fb13474d673162@gmail.com>
balloob/home-assistant,rohitranjan1991/home-assistant,w1ll1am23/home-assistant,turbokongen/home-assistant,titilambert/home-assistant,sdague/home-assistant,jawilson/home-assistant,kennedyshead/home-assistant,mezz64/home-assistant,soldag/home-assistant,toddeye/home-assistant,mKeRix/home-assistant,soldag/home-assistant,balloob/home-assistant,adrienbrault/home-assistant,tboyce1/home-assistant,jawilson/home-assistant,tboyce1/home-assistant,tchellomello/home-assistant,sdague/home-assistant,Danielhiversen/home-assistant,partofthething/home-assistant,home-assistant/home-assistant,mKeRix/home-assistant,aronsky/home-assistant,nkgilley/home-assistant,tboyce021/home-assistant,rohitranjan1991/home-assistant,robbiet480/home-assistant,GenericStudent/home-assistant,sander76/home-assistant,mezz64/home-assistant,adrienbrault/home-assistant,robbiet480/home-assistant,tchellomello/home-assistant,lukas-hetzenecker/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,GenericStudent/home-assistant,tboyce021/home-assistant,titilambert/home-assistant,FreekingDean/home-assistant,nkgilley/home-assistant,lukas-hetzenecker/home-assistant,pschmitt/home-assistant,mKeRix/home-assistant,FreekingDean/home-assistant,balloob/home-assistant,tboyce1/home-assistant,tboyce1/home-assistant,toddeye/home-assistant,Danielhiversen/home-assistant,kennedyshead/home-assistant,sander76/home-assistant,partofthething/home-assistant,mKeRix/home-assistant,turbokongen/home-assistant,pschmitt/home-assistant,home-assistant/home-assistant,aronsky/home-assistant