Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.fitbit.api.FitbitApi Class Reference
Inheritance diagram for homeassistant.components.fitbit.api.FitbitApi:
[legend]
Collaboration diagram for homeassistant.components.fitbit.api.FitbitApi:
[legend]

Public Member Functions

None __init__ (self, HomeAssistant hass, FitbitUnitSystem|None unit_system=None)
 
dict[str, Any] async_get_access_token (self)
 
list[FitbitDeviceasync_get_devices (self)
 
dict[str, Any] async_get_latest_time_series (self, str resource_type)
 
FitbitUnitSystem async_get_unit_system (self)
 
FitbitProfile async_get_user_profile (self)
 

Private Member Functions

Fitbit _async_get_client (self)
 
_T _T (self, Callable[[], _T] func)
 

Private Attributes

 _hass
 
 _profile
 
 _unit_system
 

Detailed Description

Fitbit client library wrapper base class.

This can be subclassed with different implementations for providing an access
token depending on the use case.

Definition at line 27 of file api.py.

Constructor & Destructor Documentation

◆ __init__()

None homeassistant.components.fitbit.api.FitbitApi.__init__ (   self,
HomeAssistant  hass,
FitbitUnitSystem | None   unit_system = None 
)
Initialize Fitbit auth.

Definition at line 34 of file api.py.

Member Function Documentation

◆ _async_get_client()

Fitbit homeassistant.components.fitbit.api.FitbitApi._async_get_client (   self)
private
Get synchronous client library, called before each client request.

Definition at line 48 of file api.py.

◆ _T()

_T homeassistant.components.fitbit.api.FitbitApi._T (   self,
Callable[[], _T]  func 
)
private
Run client command.

Definition at line 129 of file api.py.

◆ async_get_access_token()

dict[str, Any] homeassistant.components.fitbit.api.FitbitApi.async_get_access_token (   self)
Return a valid token dictionary for the Fitbit API.

Reimplemented in homeassistant.components.fitbit.api.ConfigFlowFitbitApi, and homeassistant.components.fitbit.api.OAuthFitbitApi.

Definition at line 45 of file api.py.

◆ async_get_devices()

list[FitbitDevice] homeassistant.components.fitbit.api.FitbitApi.async_get_devices (   self)
Return available devices.

Definition at line 97 of file api.py.

◆ async_get_latest_time_series()

dict[str, Any] homeassistant.components.fitbit.api.FitbitApi.async_get_latest_time_series (   self,
str  resource_type 
)
Return the most recent value from the time series for the specified resource type.

Definition at line 113 of file api.py.

◆ async_get_unit_system()

FitbitUnitSystem homeassistant.components.fitbit.api.FitbitApi.async_get_unit_system (   self)
Get the unit system to use when fetching timeseries.

This is used in a couple ways. The first is to determine the request
header to use when talking to the fitbit API which changes the
units returned by the API. The second is to tell Home Assistant the
units set in sensor values for the values returned by the API.

Definition at line 75 of file api.py.

◆ async_get_user_profile()

FitbitProfile homeassistant.components.fitbit.api.FitbitApi.async_get_user_profile (   self)
Return the user profile from the API.

Definition at line 61 of file api.py.

Member Data Documentation

◆ _hass

homeassistant.components.fitbit.api.FitbitApi._hass
private

Definition at line 40 of file api.py.

◆ _profile

homeassistant.components.fitbit.api.FitbitApi._profile
private

Definition at line 68 of file api.py.

◆ _unit_system

homeassistant.components.fitbit.api.FitbitApi._unit_system
private

Definition at line 42 of file api.py.


The documentation for this class was generated from the following file: