New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Unit System Option For Fitbit #11817
Conversation
authd_client.system = 'en_US' | ||
unit_system = config.get(CONF_UNIT_SYSTEM) | ||
if unit_system == 'default': | ||
authd_client.system = authd_client.user_profile_get()["user"]["locale"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (83 > 79 characters)
vol.In(['12H', '24H']) | ||
vol.In(['12H', '24H']), | ||
vol.Optional(CONF_UNIT_SYSTEM, default='default'): | ||
vol.In(['en_GB', 'en_US', 'metric','default']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
@@ -34,6 +34,7 @@ | |||
|
|||
CONF_MONITORED_RESOURCES = 'monitored_resources' | |||
CONF_CLOCK_FORMAT = 'clock_format' | |||
CONF_UNIT_SYSTEM = 'unit_system' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in const.py
. Please import that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
It's somehow weird that |
Yes, see here: https://dev.fitbit.com/build/reference/web-api/basics/#units Options are en_US => US So anything other than en_GB or en_US becomes metric. If they are using en_UK then that'll translate to metric in the API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, looking good! 👍
@tinloaf feel free to merge when you approve 👍 |
Description:
Allow overriding of the units to be used for the Fitbit sensor, e.g. allowing metric units to be used on an en_GB system.
Related issue (if applicable): fixes # n/a
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4469
Example entry for
configuration.yaml
(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass