Update fitbit device fetch to use a data update coordinator (#101619)

* Add a fitbit device update coordinator

* Remove unnecessary debug output

* Update comments

* Update fitbit coordinator exception handling and test coverage

* Handle reauth failures in other sensors

* Fix scope changes after rebase.
This commit is contained in:
Allen Porter 2023-10-08 23:12:59 -07:00 committed by GitHub
parent 6d1876394e
commit d78ee96e2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 389 additions and 132 deletions

View file

@ -134,10 +134,10 @@ class FitbitApi(ABC):
return await self._hass.async_add_executor_job(func)
except HTTPUnauthorized as err:
_LOGGER.debug("Unauthorized error from fitbit API: %s", err)
raise FitbitAuthException from err
raise FitbitAuthException("Authentication error from fitbit API") from err
except HTTPException as err:
_LOGGER.debug("Error from fitbit API: %s", err)
raise FitbitApiException from err
raise FitbitApiException("Error from fitbit API") from err
class OAuthFitbitApi(FitbitApi):