Add Dexcom Integration (#33852)

* Initial commit for Dexcom integration

* Dexcom config flow testing

* Clarify errors during setup

* Resolve minor test issues

* Update sensor availability, resolve linting issues

* Add sensor tests

* Remove title due to 0.109, add abort

* >94.97% codecov/patch

* Move .translations/ to translations/

* Add constants for servers and unit of measurements

* Bump pydexcom version

* Updated domain schema, Dexcom creation

* Support for different units of measurement

* Update tests

* Remove empty items from manifest

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

* Raise UpdateFailed if fetching new session fails

* Switch everything over to required

* Simplify state information

* Simplify async_on_remove

* Pydexcom package now handles fetching new session

* Only allow config flow

* Remove ternary operator

* Bump version, pydexcom handling session refresh

* Using common strings

* Import from test.async_mock

* Shorten variable names

* Resolve tests after removing yaml support

* Return false if credentials are invalid

* Available seems to handle if data is empty

* Now using option flow, remove handling import

* Add fixture for JSON returned from API

* Overhaul testing

* Revise update options

* Bump pydexcom version

* Combat listener repetition

* Undo update listener using callback

* Change sensor availability to use last_update_success

* Update sensor availability and tests

* Rename test

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Gage Benne 2020-07-01 20:14:54 -04:00 committed by GitHub
parent 3498882fe1
commit bcabf6da91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 792 additions and 0 deletions

View file

@ -0,0 +1,30 @@
"""Constants for the Dexcom integration."""
DOMAIN = "dexcom"
PLATFORMS = ["sensor"]
GLUCOSE_VALUE_ICON = "mdi:diabetes"
GLUCOSE_TREND_ICON = [
"mdi:help",
"mdi:arrow-up-thick",
"mdi:arrow-up",
"mdi:arrow-top-right",
"mdi:arrow-right",
"mdi:arrow-bottom-right",
"mdi:arrow-down",
"mdi:arrow-down-thick",
"mdi:help",
"mdi:alert-circle-outline",
]
MMOL_L = "mmol/L"
MG_DL = "mg/dL"
CONF_SERVER = "server"
SERVER_OUS = "EU"
SERVER_US = "US"
COORDINATOR = "coordinator"
UNDO_UPDATE_LISTENER = "undo_update_listener"