vanstinator / hass-raincloud

Melnor Raincloud Home Assistant Integration
6 stars 1 forks source link

Not handling service unavailable properly #5

Open eavanvalkenburg opened 4 years ago

eavanvalkenburg commented 4 years ago

Hi,

Overnight my HA with your custom component running started logging all of these:

2020-06-28 22:28:06 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/raincloud/__init__.py", line 142, in hub_refresh
    hass.data[DATA_RAINCLOUD].data.update()
  File "/usr/local/lib/python3.7/site-packages/raincloudy/core.py", line 178, in update
    controller.update()
  File "/usr/local/lib/python3.7/site-packages/raincloudy/controller.py", line 76, in update
    faucet.update()
  File "/usr/local/lib/python3.7/site-packages/raincloudy/faucet.py", line 141, in update
    req.raise_for_status()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://wifiaquatimer.com/get_cu_and_fu_status?controller_serial=5410ec286a83&faucet_serial=ad20

Looks like the code doesn't handle this gracefully, and keeps trying, would be good to put a check in and then also backoff the refreshes until it responds normally again.

vanstinator commented 4 years ago

This is reasonable request. I'll try to make some time for it.