Commit Graph

77 Commits (f28f2e4ed46cd00647c8df63cc957aa2bfd163b3)

Author SHA1 Message Date
Allen Porter 2e4c4729c4
Improve fitbit authentication error handling (#106885) 2024-01-02 17:51:15 +01:00
Erik Montnemery 0c2485bc03
Freeze integration entity descriptions (#105984)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-12-18 16:28:13 -10:00
Allen Porter 4752d37df7
Fix fitbit oauth reauth debug logging (#105450) 2023-12-10 23:09:58 +01:00
Allen Porter 64c9aa0cff
Update Fitbit to avoid a KeyError when `restingHeartRate` is not present (#103872)
* Update Fitbit to avoid a KeyError when `restingHeartRate` is not present

* Explicitly handle none response values
2023-11-12 12:49:49 -08:00
Jan Bouwhuis f94167a4bb
Fix invalid oauth2_unauthorized translation ref (#103873)
* Fix invalids oauth2_unauthorized translation ref

* Fix oauth2_failed
2023-11-12 21:13:38 +01:00
Allen Porter 96a19d61ab
Fix bug in Fitbit config flow, and switch to prefer display name (#103869) 2023-11-12 19:27:02 +01:00
Allen Porter 787fb3b954
Improve OAuth error handling in configuration flows (#103157)
* Improve OAuth error handling in configuration flows

* Update strings for all integrations that use oauth2 config flow

* Remove invalid_auth strings

* Revert change to release

* Revert close change in aiohttp mock
2023-11-11 11:02:51 +01:00
Allen Porter fe482af561
Add modernized fitbit battery level sensor (#102500)
* Add modernized fitbit battery level sensor

* Use entity names for existing battery sensors

* Use icon from device class

* Update homeassistant/components/fitbit/strings.json

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Update tests with lower case naming

* Swap the names of the device battery sensors

* Revert "Swap the names of the device battery sensors"

This reverts commit c9516f6d06.

* Update homeassistant/components/fitbit/sensor.py

Co-authored-by: Jan Vaníček <janvanicek@post.cz>

* Improve typing

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Jan Vaníček <janvanicek@post.cz>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-11-02 10:22:27 +01:00
Allen Porter 04dfbd2e03
Improve fitbit oauth token error handling in config flow (#103131)
* Improve fitbit oauth token error handling in config flow

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests with updated error reason

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-10-31 19:48:33 -07:00
Allen Porter d75f1b2b3e
Fix bug in fitbit credential import for expired tokens (#103024)
* Fix bug in fitbit credential import on token refresh

* Use stable test ids

* Update homeassistant/components/fitbit/sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-10-29 14:26:10 -07:00
Allen Porter 8703621c64
Improve fitbit oauth import robustness (#102833)
* Improve fitbit oauth import robustness

* Improve sensor tests and remove unnecessary client check

* Fix oauth client id/secret config key checks

* Add executor for sync call
2023-10-28 17:20:44 +02:00
Allen Porter c4f562ff6a
Reduce unnecessary fitbit RPCs on startup (#102504)
* Reduce unnecessary fitbit RPCs on startup

* Update comment about racing user profile rpcs
2023-10-21 22:00:40 -07:00
Allen Porter d78ee96e2a
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.
2023-10-09 08:12:59 +02:00
Allen Porter 7d202f78f5
Add fitbit nutrition sensors (#101626)
* Add fitbit nutrition sensors

* Add test coverage for unit systems
2023-10-08 10:09:26 +02:00
Allen Porter c7d533d427
Update fitbit error handling (#101304)
* Update fitbit error handling

* Update exceptions to inherit HomeAssistantError and add reason code

* Revert config flow exception mapping hack
2023-10-05 22:38:15 -07:00
Allen Porter 74b3c5c690
Modernize fitbit sensors (#101179)
* Improve fitbit sensors with state class and entiy category

* Revert sensor format changes
2023-10-02 16:56:46 +02:00
Allen Porter 4e4b8de448
Add reauth support in fitbit (#101178)
* Add reauth support in fitbit

* Update tests/components/fitbit/test_config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Improve http status error code handling

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-10-02 08:09:08 +02:00
Allen Porter bd2fee289d
Update Fitbit integration to allow UI based configuration (#100897)
* Cleanup fitbit sensor API parsing

* Remove API code that is not used yet

* Configuration flow for fitbit

* Code cleanup after manual review

* Streamline code for review

* Use scopes to determine which entities to enable

* Use set for entity comparisons

* Apply fitbit string pr feedback

* Improve fitbit configuration flow error handling

* Apply suggestions from code review

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Fix typo in more places

* Revert typing import

* Revert custom domain back to default

* Add additional config flow tests

* Add         breaks_in_ha_version to repair issues

* Update homeassistant/components/fitbit/api.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Increase test coverage for token refresh success case

* Add breaks_in_ha_version for sensor issue

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Simplify translations, issue keys, and token refresh

* Config flow test improvements

* Simplify repair issue creation on fitbit import

* Remove unused strings

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-09-30 16:56:39 -07:00
Allen Porter 822251a642
Update fitbit client to use asyncio (#100933) 2023-09-26 07:50:42 -07:00
Allen Porter 18f29993c5
Simplify fitbit unit system and conversions (#100825)
* Simplify fitbit unit conversions

* Use enum values in unit system schema

* Use fitbit unit system enums
2023-09-25 20:08:59 -04:00
Allen Porter 66ebb479ea
Rewrite fitbit sensor API response value parsing (#100782)
* Cleanup fitbit sensor API parsing

* Remove API code that is not used yet

* Remove dead code for battery levels

Small API parsing cleanup

* Address PR feedback

* Update homeassistant/components/fitbit/sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-09-24 22:37:48 +02:00
Allen Porter 781bc5b3bc
Add tests for fitbit integration (#100765)
* Add tests for fitbit integration

* Update coveragerc

* Update test requirements
2023-09-23 12:04:44 -07:00
Allen Porter d833c1a598
Add myself as a fitbit codeowner (#100766) 2023-09-23 20:32:52 +02:00
Joost Lekkerkerker 123cf07920
Clean up fitbit const (#95545) 2023-07-22 13:07:34 +02:00
Franck Nijhof 3e85a29b86
Move overlapping pylint rules to ruff, disable mypy overlap (#94359) 2023-06-27 17:42:46 +02:00
Carlos Cristobal 3614114a8f
Revert "Replace Fitbit weight SensorStateClass measurement with total" (#89126) 2023-03-05 13:36:25 +01:00
epenet 50f908ce2d
Use load_json_object in fitbit (#88585)
* Use load_json_object in fitbit

* Remove unnecessary cast
2023-03-01 07:44:29 +01:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
Carlos Cristobal 9756131473
Replace Fitbit weight SensorStateClass measurement with total (#88118)
* Remove SensorStateClass.MEASUREMENT from weight

* Using SensorStateClass.TOTAL for weight
2023-02-14 16:15:09 -05:00
Erik Montnemery 78c9b70c8d
Sort manifests 3 (#87024) 2023-02-08 20:19:19 +01:00
Carlos Cristobal 8bb5763ea0
Fix Fitbit state for values over 999 (#85251)
* Remove comma thousands formatting

* Add calorie and bpm to units

* Updating device and state classes

* Revert "Updating device and state classes"

This reverts commit ae77cf3cd7.

* Revert "Add calorie and bpm to units"

This reverts commit 7d82bb1c12.

* Removing unnecessary formatting
2023-01-06 14:12:41 +01:00
Franck Nijhof cb13418bab
String formatting and max line length - Part 2 (#84393) 2022-12-22 11:38:59 +01:00
epenet 62d22d7a2d
Refactor fitbit descriptions to use device classes (#83936) 2022-12-13 21:49:41 +01:00
Jean-François Paris 532c6b74d4
Enable long term stats for fitbit entities (#81934) 2022-11-16 09:27:51 +01:00
epenet c717fd19de
Move attribution to standalone attribute [e-g] (#80513) 2022-10-18 10:04:54 +02:00
epenet 1445e08090
Replace `is_metric` with `is METRIC_SYSTEM` (#80262) 2022-10-14 12:22:11 +02:00
Nathan Broadbent 1907b87666
Add unique ID to fitbit (#79587)
* Set unique ID for fitbit sensors, including the user ID

* Remove fitbit_ from unique ids (see: https://developers.home-assistant.io/docs/entity_registry_index/#unique-id)

* change fitbit user_profile type to dict[str, Any]

* Fitbit: define a default unique ID, and add battery info if present

* No need for trailing _battery in unique ID, since it already contains "devices/battery_"
2022-10-04 14:28:00 +02:00
Nathan Broadbent 9d2ba7c008
Use constant in fitbit messages (#79586)
Use FITBIT_CONFIG_FILE constant in configurator messages and buttons
2022-10-04 12:13:40 +02:00
Martin Hjelmare c05905ebda
Remove callback decorator from coroutine functions (#75626)
* Remove callback decorator from coroutine functions

* Remove some more callback decorators
2022-07-22 19:09:02 +02:00
J. Nick Koston 5b755b74fb
Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
epenet 81461832c3
Import configurator (#64211)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-18 10:18:37 -08:00
Martin Hjelmare ff530dce0d Fix fitbit no SSL URL handling (#62270) 2021-12-18 15:00:07 +01:00
Marc Mueller 184e0d7fdf
Use assignment expressions 26 (#58187) 2021-10-22 11:31:17 +02:00
Jason Nader 628e59ff11
Clarify that only HTTPS can be used in fitbit (#57116) 2021-10-13 08:45:59 -07:00
Marc Mueller fed5f5e3b9
Use EntityDescription - fitbit (#55925) 2021-09-23 20:08:47 +02:00
Erik Montnemery 6de6a5dc14
Move temperature conversions to sensor base class (3/8) (#54469)
* Move temperature conversions to entity base class (3/8)

* Fix FritzBox sensor

* Fix tests
2021-08-12 14:23:56 +02:00
Michael 8c5c8ed153
Add strict type annotations to fitbit (#50740)
* add strict type annotations

* cast json_load()

* apply suggestions

* move SCAN_INTERVAL back to platform file

* apply suggestion

* apply suggestion

* apply suggestions

* rename to PARENT_PLATFORM_SCHEMA
2021-05-21 13:33:54 +01:00
Vincent Le Bourlot 219ad5cd9e
Fix fitbit RuntimeError: I/O must be done in the executor (#50058) 2021-05-05 09:19:51 +02:00
Franck Nijhof 055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Erik Montnemery 339a56e434
Migrate integrations f-h to extend SensorEntity (#48212) 2021-03-22 19:45:17 +01:00