custom-components / grocy

Custom Grocy integration for Home Assistant
Apache License 2.0
163 stars 50 forks source link

Handle Grocy not ready/running with ConfigEntryNotReady #296

Open TomBrien opened 11 months ago

TomBrien commented 11 months ago

Raise approriate Exceptions for Home Assistant to know to retry when Grocy is not running or ready.

I've observed two cases:

  1. Connection error, this can happen when there is no response, either due to some connection issue or (more likely) after a HAOS update and if the nginx reverse proxy addon is being used to handle SSL for grocy and hasn't started up yet and/or local DNS (again running under HAOS) hasn't started up after an update (this is when I first spotted the issue).
  2. Invlaid/empty response, pygrocy doesn't check the content is present before trying to decode the json so we see JSONDecodeError at our end. This happens if the addon is not running.
TomBrien commented 11 months ago

I didn't see #295 before making this. This slightly extends that PR by covering the second case too