Update __init__.py#14
Conversation
Home assistant uses this package and calls the get_devices function one or more times, depending on how many devices are defined in the home assistant configuration. If at the moment of initialization there is no internet or the joaoapps server temporarily blocks calls, the join integration is not initialized and the only way to initialize it again is to restart the home assistant. I made a change so that the response for each api_key is saved locally and in case the internet is not available, the function returns the saved data instead of False. In this way, it is possible to restart the home assistant even in moments when the internet is not available without being left without join integration.
Fixed typo at the end of get_devices function
Forgotten import
|
Hi Igor, Thank you very much for submitting this pull request! Improving offline resilience is a fantastic idea, and you are absolutely right that temporary network outages or API rate blocks during startup shouldn't completely prevent Home Assistant from initializing the Join integration. I like the concept, but during code review, I identified a few edge cases and implementation bugs that we need to address before this can be merged safely: 1. Unhandled Connection ExceptionsWhen there is no active internet connection, calling 2. Read-Only / Ephemeral Filesystem IssuesUsing
3. API Keys in Filenames (Security & OS Compatibility)Saving files using the raw Suggested ImplementationTo make this completely safe for all environments, we should:
|
Home assistant uses this package and calls the get_devices function one or more times, depending on how many devices are defined in the home assistant configuration. If at the moment of initialization there is no internet or the joaoapps server temporarily blocks calls, the join integration is not initialized and the only way to initialize it again is to restart the home assistant. I made a change so that the response for each api_key is saved locally and in case the internet is not available, the function returns the saved data instead of False. In this way, it is possible to restart the home assistant even in moments when the internet is not available without being left without join integration.
Please merge this pull request.
Best regards
Igor Simić