Commit Graph

29 Commits (ba20ffdde71b5645301a5293054b273528027f15)

Author SHA1 Message Date
Bertbert 44cad7df30 Add Unit System Option For Fitbit (#11817)
* Add Unit System Option For Fitbit

* Update fitbit.py

* Update fitbit.py
2018-02-28 13:18:50 -08:00
awkwardDuck e96ac74b11 Fix formatting of minutes for sleep start in the fitbit sensor (#12664)
* fix formatting of minutes for sleep start

https://github.com/home-assistant/home-assistant/issues/12594

* Update fitbit.py
2018-02-25 19:28:41 -08:00
Markus Nigbur a83e741dc7 Refactored to new global json saving and loading (#10677)
* Refactored to new global json saving and loading

* Fixed emulated_hue tests

* Removed unnecassary error handling

* Added missing newline

* Remove unused imports

* Fixed linting error

* Moved _load_json wrapper out of the config class
2017-11-19 19:47:55 -08:00
happyleavesaoc b83059c828 move icon battery function from util to helpers (#9708) 2017-10-05 20:55:19 -07:00
happyleavesaoc fd97c23cde fitbit fixes (#9460) 2017-09-17 21:13:26 +02:00
Marcelo Moreira de Mello f76436f326 Fix fitbit error when trying to access token after upgrade. (#9183)
*   - Fixes Fitbit error when trying to refresh oauth token

  The 3rd python-fitbit module requires an extra kwarg on the FitBit
  constructor called refresh_cb. The value should be a function that
  accepts one argument token.

  This value will be a dictionary with the keys:

     'access_token', 'refresh_token', 'expires_at'

  This implements a lambda refresh_cb as required by the Fitbit module
  to work, however the new token will always be save manually on
  every update() call.

*  Simplified by calling  expires_at instead reading again from dict
2017-08-30 10:01:01 +02:00
Matt Schmitt c3d548a0dd Update fitbit.py (#9064)
Minor format update, set ‘type’ attribute to lowercase (Fitbit returns
all uppercase currently)
2017-08-21 07:15:15 +02:00
Matt Schmitt c059dfdb67 Update Fitbit sensor (icons, formatting, client update) (#9031)
* Update fitbit.py

Add variable icon for battery status, clean up formatting for resource
names and values

* Update fitbit.py and requirements_all.txt

Fix PR comments and update client

* Update fitbit.py

Add dict map for battery levels and use icon util
2017-08-19 22:47:31 +02:00
Adam Mills 19d1d748d4 Add support for Automatic OAuth2 authentication (#8962)
* Add support for Automatic OAuth2 authentication

* Fix async conversion of configurator

* Rename method for async

* Use hass.components to get configurator component

* Fix typo

* Move session data to hidden directory

* Make configurator callback optional
2017-08-13 22:37:50 -07:00
Marcelo Moreira de Mello 7c120748ce Fixes Fitbit sensor to report battery level with the expected device (#8647)
Add an optional extended description…
2017-07-26 11:05:48 +02:00
Marcelo Moreira de Mello ee153062ab Extends Fitbit sensors to track the device battery level (#8583)
* Extends Fitbit sensors to track the device battery level

* cleanup old stuff

* remove update from init
2017-07-21 10:19:26 +02:00
Paulus Schoutsen e68bd0457c Fix more deprecation warnings (#7778)
* Remove setting up an hbmqtt broker

* Don't pass loop to web.Application in tests

* Use .query instead of deprecated .GET for aiohttp requests

* Fix closing file resource

* Do not use asyncio mark

* Notify.html5 - PyJWT: Use options to disable verify

* Yamaha: Test was still using deprecated ip

* Remove pytest-asyncio
2017-05-26 13:12:17 -07:00
Fabian Affolter a4f1f6e724 Update docstrings (#7374)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstring

* Update docstrings

* Update docstrings

* Fix lint issues

* Update docstrings

* Revert changes in dict
2017-05-02 09:18:47 -07:00
Paulus Schoutsen 32ffd006fa Reorganize HTTP component (#4575)
* Move HTTP to own folder

* Break HTTP into middlewares

* Lint

* Split tests per middleware

* Clean up HTTP tests

* Make HomeAssistantViews more stateless

* Lint

* Make HTTP setup async
2016-11-25 13:04:06 -08:00
Fabian Affolter be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Paulus Schoutsen 519d9f2fd0 async HTTP component (#3914)
* Migrate WSGI to asyncio

* Rename wsgi -> http

* Python 3.4 compat

* Move linting to Python 3.4

* lint

* Lint

* Fix Python 3.4 mock_open + binary data

* Surpress logging aiohttp.access

* Spelling

* Sending files is a coroutine

* More callback annotations and naming fixes

* Fix ios
2016-10-23 23:48:01 -07:00
Marcelo Moreira de Mello 6330d9cde6 Fixed Fitbit resting heart rate attribute (#3835)
* Fixed Fitbit restingHeartRate field to grab the correct field from dictionary

In [31]: r['activities-heart'][-1].get('value')
Out[31]:
{'customHeartRateZones': [],
 'heartRateZones': [{'caloriesOut': 126.18348,
   'max': 94,
   'min': 30,
   'minutes': 67,
   'name': 'Out of Range'},
  {'caloriesOut': 27.21339,
   'max': 131,
   'min': 94,
   'minutes': 5,
   'name': 'Fat Burn'},
  {'caloriesOut': 0, 'max': 159, 'min': 131, 'minutes': 0, 'name': 'Cardio'},
  {'caloriesOut': 0, 'max': 220, 'min': 159, 'minutes': 0, 'name': 'Peak'}],
 'restingHeartRate': 69}

In [32]: r['activities-heart'][-1].get('value').get('restingHeartRate')
Out[32]: 69

* Renamed sensor to Resting Heart Rate to match it

* Fixed lint style
2016-10-13 09:22:05 -07:00
Fabian Affolter 7cf2c48175 Use voluptuous for FitBit (#3686)
* Migrate to voluptuous

* Fix default
2016-10-11 00:27:15 -07:00
Marcelo Moreira de Mello fb719f530a Upgraded fitbit to version 0.2.3 which fixed oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) (#3244) 2016-09-06 18:23:08 -07:00
Marcelo Moreira de Mello 0383da7af1 This patch makes use of the unit_system global configuration parameter to determine the mesurement system between 'metric' or 'imperial' for Fibit component. It also supports the fitbit accept-language when en_GB measurement is desired. (#2745) 2016-08-07 21:58:16 -07:00
Teagan M. Glenn 26526ca57a Add unit system support
Add unit symbol constants

Initial unit system object

Import more constants

Pydoc for unit system file

Import constants for configuration validation

Unit system validation method

Typing for constants

Inches are valid lengths too

Typings

Change base class to dict - needed for remote api call serialization

Validation

Use dictionary keys

Defined unit systems

Update location util to use metric instead of us fahrenheit

Update constant imports

Import defined unit systems

Update configuration to use unit system

Update schema to use unit system

Update constants

Add imports to core for unit system and distance

Type for config

Default unit system

Convert distance from HASS instance

Update temperature conversion to use unit system

Update temperature conversion

Set unit system based on configuration

Set info unit system

Return unit system dictionary with config dictionary

Auto discover unit system

Update location test for use metric

Update forecast unit system

Update mold indicator unit system

Update thermostat unit system

Update thermostat demo test

Unit tests around unit system

Update test common hass configuration

Update configuration unit tests

There should always be a unit system!

Update core unit tests

Constants typing

Linting issues

Remove unused import

Update fitbit sensor to use application unit system

Update google travel time to use application unit system

Update configuration example

Update dht sensor

Update DHT temperature conversion to use the utility function

Update swagger config

Update my sensors metric flag

Update hvac component temperature conversion

HVAC conversion for temperature

Pull unit from sensor type map

Pull unit from sensor type map

Update the temper sensor unit

Update yWeather sensor unit

Update hvac demo unit test

Set unit test config unit system to metric

Use hass unit system length for default in proximity

Use the name of the system instead of temperature

Use constants from const

Unused import

Forecasted temperature

Fix calculation in case furthest distance is greater than 1000000 units

Remove unneeded constants

Set default length to km or miles

Use constants

Linting doesn't like importing just for typing

Fix reference

Test is expecting meters - set config to meters

Use constant

Use constant

PyDoc for unit test

Should be not in

Rename to units

Change unit system to be an object - not a dictionary

Return tuple in conversion

Move convert to temperature util

Temperature conversion is now in unit system

Update imports

Rename to units

Units is now an object

Use temperature util conversion

Unit system is now an object

Validate and convert unit system config

Return the scalar value in template distance

Test is expecting meters

Update unit tests around unit system

Distance util returns tuple

Fix location info test

Set units

Update unit tests

Convert distance

DOH

Pull out the scalar from the vector

Linting

I really hate python linting

Linting again

BLARG

Unit test documentation

Unit test around is metric flag

Break ternary statement into if/else blocks

Don't use dictionary - use members

is metric flag

Rename constants

Use is metric flag

Move constants to CONST file

Move to const file

Raise error if unit is not expected

Typing

No need to return unit since only performing conversion if it can work

Use constants

Line wrapping

Raise error if invalid value

Remove subscripts from conversion as they are no longer returned as tuples

No longer tuples

No longer tuples

Check for numeric type

Fix string format to use correct variable

Typing

Assert errors raised

Remove subscript

Only convert temperature if we know the unit

If no unit of measurement set - default to HASS config

Convert only if we know the unit

Remove subscription

Fix not in clause

Linting fixes

Wants a boolean

Clearer if-block

Check if the key is in the config first

Missed a couple expecting tuples

Backwards compatibility

No like-y ternary!

Error handling around state setting

Pretty unit system configuration validation

More tuple crap

Use is metric flag

Error handling around min/max temp

Explode if no unit

Pull unit from config

Celsius has a decimal

Unused import

Check if it's a temperature before we try to convert it to a temperature

Linting says too many statements - combine lat/long in a fairly reasonable manner

Backwards compatibility unit test

Better doc
2016-08-04 22:02:19 -07:00
Paulus Schoutsen 3bbdd9fedd Remove unused import 2016-05-21 15:01:55 -07:00
Paulus Schoutsen 15e329a588 Tons of fixes - WIP 2016-05-21 15:01:33 -07:00
John Arild Berentsen 1eb3181c14 Fix fitbit KeyError (#2077)
* Fix fitbit KeyError

* Set units compared to temperature_unit

* Pass true or false for is_metric
2016-05-19 23:28:53 -07:00
Landrash 8163b986c9 Fixed minor miss-spelling (#2028)
Changed millileters to milliliters.
Changed case of mmol/l to mmol/L.
2016-05-09 23:48:48 -07:00
Robbie Trencheny a7292af3b1 Fitbit flake8 and pylint fixes. Forgot to do it before pushing :( 2016-05-09 15:33:04 -07:00
Robbie Trencheny c8cbc528eb Minor Fitbit tweaks. Correct the copy, dont require auth on the routes, get the client_id/client_secret from fitbit.conf instead of the YAML 2016-05-09 15:31:47 -07:00
Robbie Trencheny 25e8c7bc5f en_UK->en_GB. Closes #2019. 2016-05-09 15:14:33 -07:00
Robbie Trencheny 8cb48615af Fitbit Sensor Take Deux (#2002)
* Fitbit Sensor

* Add configurator image
2016-05-07 12:46:45 -07:00