Use async_forward_entry_setups so platforms can be loaded in a single
executor job instead of many:
Currently they all have to create a new job because it did not use
async_forward_entry_setups
```
2024-03-08 08:29:29.819 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[light] loop=[] took 12.12s
2024-03-08 08:29:29.822 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[number] loop=[] took 12.12s
2024-03-08 08:29:29.826 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[scene] loop=[] took 12.13s
2024-03-08 08:29:29.829 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[select] loop=[] took 12.13s
2024-03-08 08:29:29.833 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[sensor] loop=[] took 12.14s
2024-03-08 08:29:30.882 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[update] loop=[] took 13.18s
2024-03-08 08:29:30.948 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[button] loop=[] took 13.18s
2024-03-08 08:29:30.949 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[climate] loop=[] took 13.19s
2024-03-08 08:29:31.012 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[fan] loop=[] took 13.25s
2024-03-08 08:29:31.019 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[humidifier] loop=[] took 13.25s
2024-03-08 08:29:31.024 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[image] loop=[] took 13.26s
2024-03-08 08:29:31.034 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[lock] loop=[] took 13.27s
2024-03-08 08:29:31.045 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[vacuum] loop=[] took 13.28s
2024-03-08 08:29:31.050 DEBUG (MainThread) [homeassistant.loader] Importing platforms for mqtt executor=[valve] loop=[] took 13.28s
```
* Bump python-telegram-bot package version to the latest.
* PySocks is no longer required as python-telegram-bot doesn't use urllib3 anymore.
* Fix moved ParseMode import
* Update filters import to new structure.
* Refactor removed Request objects to HTTPXRequest objects.
* Update to support asyncc functions
* Update timeout to new kwarg
connect_timeout is the most obvious option based on current param description, but this may need changing.
* Compatibility typo.
* Make methods async and use Bot client async natively
* Type needs to be Optional
That's what the source types are from the library
Also handle new possibility of None value
* Add socks support version of the library
* Refactor load_data function
Update to be async friendly
Refactor to use httpx instead of requests.
* Refactor Dispatcher references to Application
This is the newer model of the same class.
* Make more stuff async-friendly.
* Update tests to refactor Dispatcher usage out.
* Remove import and reference directly
* Refactor typing method
* Use async_fire now we have async support
* Fix some over complicate inheritance.
* Add the polling test telegram_text event fired back in.
* Add extra context to comment
* Handler should also be async
* Use underscores instead of camelCase
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Renamed kwarg.
* Refactor current timeout param to be read timeout
Reading the old version of the library code I believe this matches the existing functionality best
* Combine unload methods into one listener
* Fix test by stopping HA as part of fixture
* Add new fixture to mock stop_polling call
Use this in all polling tests.
* No longer need to check if application is running
It was to stop a test failing.
* Make sure the updater is started in tests
Mock external call methods
Remove stop_polling mock.
* Use cleaner references to patched methods
* Improve test by letting the library create the Update object
* Mock component tear down methods to be async
* Bump mypy cache version
* Update dependency to install from git
Allows use as a custom component in 2024.3
Allows us to track mypy issue resolution.
* Update manifest and requirements for new python-telegram-bot release.
* Remove pytest filterwarnings entry for old version of python-telegram-bot library.
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Schedule periodic coordinator updates as background tasks.
Currently, the coordinator's periodic refreshes delay startup because they are not scheduled as background tasks. We will wait if the startup takes long enough for the first planned refresh. Another coordinator's scheduled refresh will be fired on busy systems, further delaying the startup. This chain of events results in the startup taking a long time and hitting the safety timeout because too many coordinators are refreshing.
This case can also happen with scheduled entity refreshes, but it's less common. A future PR will address that case.
* periodic_tasks
* periodic_tasks
* periodic_tasks
* merge
* merge
* merge
* merge
* merge
* fix test that call the sync api from async
* one more place
* cannot chain
* async_run_periodic_hass_job
* sun and pattern time changes from automations also block startup
* Revert "sun and pattern time changes from automations also block startup"
This reverts commit 6de2defa05.
* make sure polling is cancelled when config entry is unloaded
* Revert "Revert "sun and pattern time changes from automations also block startup""
This reverts commit e8f12aad55.
* remove DisabledError from homewizard test as it relies on a race
* fix race
* direct coverage