Replace async_timeout library and simplify platform setup loop #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
async_timeout
is a third-party library installed through PyPI /pip install
. It was written in 2016, around the time when Python 3.6 was released. At that time, Python’sasyncio
built-in module had await_for()
function but not atimeout()
function. In 2022, Python 3.11 was released including a drop-in replacement for theasync_timeout
library through the built-inasyncio.timeout()
function. Other things equal, a built-in function is preferable to a third-party PyPI library.Meanwhile, Home Assistant dropped support for Python versions 3.10 and older in HASS version 2023.8.0 (Aug 2023). It now requires Python versions 3.11 or 3.12.
Also, the
async_timeout
library is not being declared as a dependency in this integration’smanifest.json
file, so Home Assistant is not making sure thatasync_timeout
is installed alongside this integration. It has been working so far because other common Home Assistant integrations still declareasync_timeout
as a dependency.This PR also proposes a simplification to the platform setup loop using the
async_forward_entry_setups()
function added to Home Assistant 2022.8.0 (Aug 2022), and a couple of log message amendments.