rsampayo / sleepme_thermostat

SleepMe Thermostat integration is a custom component for Home Assistant
8 stars 1 forks source link

Gracefully handle API 500 errors #19

Open mikesalz opened 2 months ago

mikesalz commented 2 months ago

When the API takes a dump, it produces some ugly errors in the log. Perhaps we can handle these a little more gracefully?

2024-08-29 00:09:42.510 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdke5ghn4o7c70mv1khg-1724904581] Exception occurred: Server error '500 Internal Server Error' for url 'https://api.developer.sleep.me/v1/devices/zx-cdke5ghn4o7c70mv1khg'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500. Passing to handle_error.
2024-08-29 00:09:42.510 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdke5ghn4o7c70mv1khg-1724904582] API request to devices/zx-cdke5ghn4o7c70mv1khg failed after all retries.
2024-08-29 01:13:17.772 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdp37u96epuc70v4m8u0-1724908391] Exception occurred: . Passing to handle_error.
2024-08-29 01:13:17.773 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdp37u96epuc70v4m8u0-1724908397] API request to devices/zx-cdp37u96epuc70v4m8u0 failed after all retries.
2024-08-29 01:22:05.687 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdp37u96epuc70v4m8u0-1724908919] Exception occurred: . Passing to handle_error.
2024-08-29 01:22:05.689 ERROR (MainThread) [custom_components.sleepme_thermostat.sleepme_api] [GET-devices/zx-cdp37u96epuc70v4m8u0-1724908925] API request to devices/zx-cdp37u96epuc70v4m8u0 failed after all retries.