Migrating HTTP request to aiohttp async, limiting bootstrap errors & Fixing #37
#40
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.
Description :
Actuellement, l’intégration utilise
requestsdanshass.async_add_executor_jobpour récupérer les fichiers CSV/JSON des tarifs EDF. Cette approche est bloquante et peut provoquer des timeouts lors du bootstrap (Global task timeout: Bootstrap stage 2 timeout), en particulier si le serveur répond lentement ou renvoie des redirections HTTP.Modifications proposées :
requestsparaiohttpen mode async (await get_remote_file_async(url)) - méthode actuellement recommandée par Home Assistantasync_timeoutpour limiter la durée d’attente des requêtesAvantages :
HTTP 3xx) → évite les erreurs sur certaines URLs.Impact attendu :
Bootstrap stage 2 timeoutet des warnings de blocage de l’event loop. - Fixing Redémarrage HA - Erreur d'initialisation #37Testé sur mon instance HA avec succès depuis maintenant plusieurs jours, sans aucune erreur, alors que j'avais des erreurs de blocage de thread (et donc de timeout Bootstrap stage 2) presque 9x sur 10