commit
5317f700d7
|
@ -1,5 +1,5 @@
|
||||||
Home Assistant |Build Status| |Coverage Status| |Join the chat at https://gitter.im/home-assistant/home-assistant| |Join the dev chat at https://gitter.im/home-assistant/home-assistant/devs|
|
Home Assistant |Build Status| |Coverage Status| |Join the chat at https://gitter.im/home-assistant/home-assistant| |Join the dev chat at https://gitter.im/home-assistant/home-assistant/devs|
|
||||||
==================================================================================================================
|
==============================================================================================================================================================================================
|
||||||
|
|
||||||
Home Assistant is a home automation platform running on Python 3. The
|
Home Assistant is a home automation platform running on Python 3. The
|
||||||
goal of Home Assistant is to be able to track and control all devices at
|
goal of Home Assistant is to be able to track and control all devices at
|
||||||
|
|
|
@ -85,15 +85,15 @@ FITBIT_MEASUREMENTS = {
|
||||||
"liquids": "fl. oz.",
|
"liquids": "fl. oz.",
|
||||||
"blood glucose": "mg/dL",
|
"blood glucose": "mg/dL",
|
||||||
},
|
},
|
||||||
"en_UK": {
|
"en_GB": {
|
||||||
"duration": "milliseconds",
|
"duration": "milliseconds",
|
||||||
"distance": "kilometers",
|
"distance": "kilometers",
|
||||||
"elevation": "meters",
|
"elevation": "meters",
|
||||||
"height": "centimeters",
|
"height": "centimeters",
|
||||||
"weight": "stone",
|
"weight": "stone",
|
||||||
"body": "centimeters",
|
"body": "centimeters",
|
||||||
"liquids": "millileters",
|
"liquids": "milliliters",
|
||||||
"blood glucose": "mmol/l"
|
"blood glucose": "mmol/L"
|
||||||
},
|
},
|
||||||
"metric": {
|
"metric": {
|
||||||
"duration": "milliseconds",
|
"duration": "milliseconds",
|
||||||
|
@ -102,8 +102,8 @@ FITBIT_MEASUREMENTS = {
|
||||||
"height": "centimeters",
|
"height": "centimeters",
|
||||||
"weight": "kilograms",
|
"weight": "kilograms",
|
||||||
"body": "centimeters",
|
"body": "centimeters",
|
||||||
"liquids": "millileters",
|
"liquids": "milliliters",
|
||||||
"blood glucose": "mmol/l"
|
"blood glucose": "mmol/L"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,8 @@ def request_app_setup(hass, config, add_devices, config_path,
|
||||||
else:
|
else:
|
||||||
setup_platform(hass, config, add_devices, discovery_info)
|
setup_platform(hass, config, add_devices, discovery_info)
|
||||||
|
|
||||||
start_url = "{}{}".format(hass.config.api.base_url, FITBIT_AUTH_START)
|
start_url = "{}{}".format(hass.config.api.base_url,
|
||||||
|
FITBIT_AUTH_CALLBACK_PATH)
|
||||||
|
|
||||||
description = """Please create a Fitbit developer app at
|
description = """Please create a Fitbit developer app at
|
||||||
https://dev.fitbit.com/apps/new.
|
https://dev.fitbit.com/apps/new.
|
||||||
|
@ -222,8 +223,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
access_token = config_file.get("access_token")
|
access_token = config_file.get("access_token")
|
||||||
refresh_token = config_file.get("refresh_token")
|
refresh_token = config_file.get("refresh_token")
|
||||||
if None not in (access_token, refresh_token):
|
if None not in (access_token, refresh_token):
|
||||||
authd_client = fitbit.Fitbit(config.get("client_id"),
|
authd_client = fitbit.Fitbit(config_file.get("client_id"),
|
||||||
config.get("client_secret"),
|
config_file.get("client_secret"),
|
||||||
access_token=access_token,
|
access_token=access_token,
|
||||||
refresh_token=refresh_token)
|
refresh_token=refresh_token)
|
||||||
|
|
||||||
|
@ -239,8 +240,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(dev)
|
add_devices(dev)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
oauth = fitbit.api.FitbitOauth2Client(config.get("client_id"),
|
oauth = fitbit.api.FitbitOauth2Client(config_file.get("client_id"),
|
||||||
config.get("client_secret"))
|
config_file.get("client_secret"))
|
||||||
|
|
||||||
redirect_uri = "{}{}".format(hass.config.api.base_url,
|
redirect_uri = "{}{}".format(hass.config.api.base_url,
|
||||||
FITBIT_AUTH_CALLBACK_PATH)
|
FITBIT_AUTH_CALLBACK_PATH)
|
||||||
|
@ -301,9 +302,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
setup_platform(hass, config, add_devices, discovery_info=None)
|
setup_platform(hass, config, add_devices, discovery_info=None)
|
||||||
|
|
||||||
hass.http.register_path("GET", FITBIT_AUTH_START, _start_fitbit_auth)
|
hass.http.register_path("GET", FITBIT_AUTH_START, _start_fitbit_auth,
|
||||||
|
require_auth=False)
|
||||||
hass.http.register_path("GET", FITBIT_AUTH_CALLBACK_PATH,
|
hass.http.register_path("GET", FITBIT_AUTH_CALLBACK_PATH,
|
||||||
_finish_fitbit_auth)
|
_finish_fitbit_auth, require_auth=False)
|
||||||
|
|
||||||
request_oauth_completion(hass)
|
request_oauth_completion(hass)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
|
|
||||||
__version__ = "0.19.2"
|
__version__ = "0.19.3"
|
||||||
REQUIRED_PYTHON_VER = (3, 4)
|
REQUIRED_PYTHON_VER = (3, 4)
|
||||||
|
|
||||||
PLATFORM_FORMAT = '{}.{}'
|
PLATFORM_FORMAT = '{}.{}'
|
||||||
|
|
Loading…
Reference in New Issue