diff --git a/homeassistant/components/tesla/__init__.py b/homeassistant/components/tesla/__init__.py index 51090d342718a1f1f688fa7c0720ea7b82e1ab62..8981b269a56d9e6744c33651285bf0e9c22322f9 100644 --- a/homeassistant/components/tesla/__init__.py +++ b/homeassistant/components/tesla/__init__.py @@ -103,6 +103,8 @@ async def async_setup(hass, base_config): _update_entry( email, data={ + CONF_USERNAME: email, + CONF_PASSWORD: password, CONF_ACCESS_TOKEN: info[CONF_ACCESS_TOKEN], CONF_TOKEN: info[CONF_TOKEN], }, @@ -136,6 +138,8 @@ async def async_setup_entry(hass, config_entry): try: controller = TeslaAPI( websession, + email=config.get(CONF_USERNAME), + password=config.get(CONF_PASSWORD), refresh_token=config[CONF_TOKEN], access_token=config[CONF_ACCESS_TOKEN], update_interval=config_entry.options.get( diff --git a/homeassistant/components/tesla/config_flow.py b/homeassistant/components/tesla/config_flow.py index debe896c9cf6820f7b6db69028b51c9aa847d462..683ef314a0642693fab15186540edbde181a7370 100644 --- a/homeassistant/components/tesla/config_flow.py +++ b/homeassistant/components/tesla/config_flow.py @@ -140,6 +140,8 @@ async def validate_input(hass: core.HomeAssistant, data): (config[CONF_TOKEN], config[CONF_ACCESS_TOKEN]) = await controller.connect( test_login=True ) + config[CONF_USERNAME] = data[CONF_USERNAME] + config[CONF_PASSWORD] = data[CONF_PASSWORD] except TeslaException as ex: if ex.code == HTTP_UNAUTHORIZED: _LOGGER.error("Invalid credentials: %s", ex) diff --git a/homeassistant/components/tesla/manifest.json b/homeassistant/components/tesla/manifest.json index 3679c0f74d101215c548433cdda67135eeb4f6dc..9236aae7fb6eea6f8fa497134a9a82c3ca7d82d8 100644 --- a/homeassistant/components/tesla/manifest.json +++ b/homeassistant/components/tesla/manifest.json @@ -3,11 +3,11 @@ "name": "Tesla", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/tesla", - "requirements": ["teslajsonpy==0.10.4"], + "requirements": ["teslajsonpy==0.11.5"], "codeowners": ["@zabuldon", "@alandtse"], "dhcp": [ - {"hostname":"tesla_*","macaddress":"4CFCAA*"}, - {"hostname":"tesla_*","macaddress":"044EAF*"}, - {"hostname":"tesla_*","macaddress":"98ED5C*"} + { "hostname": "tesla_*", "macaddress": "4CFCAA*" }, + { "hostname": "tesla_*", "macaddress": "044EAF*" }, + { "hostname": "tesla_*", "macaddress": "98ED5C*" } ] } diff --git a/requirements_all.txt b/requirements_all.txt index 202049341e5b6662bebd75ebb76772df420874fc..d0959d87e8fe356beab37a719e909ac9cde2cf9f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2184,7 +2184,7 @@ temperusb==1.5.3 tesla-powerwall==0.3.3 # homeassistant.components.tesla -teslajsonpy==0.10.4 +teslajsonpy==0.11.5 # homeassistant.components.tensorflow # tf-models-official==2.3.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 143ec43a5d44668ef0c3708109cb8e757a9bbb26..ec4bce771f6f91a5a0d8d35e5f1801e5e629379e 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1105,7 +1105,7 @@ tellduslive==0.10.11 tesla-powerwall==0.3.3 # homeassistant.components.tesla -teslajsonpy==0.10.4 +teslajsonpy==0.11.5 # homeassistant.components.toon toonapi==0.2.0 diff --git a/tests/components/tesla/test_config_flow.py b/tests/components/tesla/test_config_flow.py index 7fb308ecc43ef4aa7e6da7cffa7717f6aa170af9..136633c9a5cea0e2d35e9c6bdfe8c9954c011eef 100644 --- a/tests/components/tesla/test_config_flow.py +++ b/tests/components/tesla/test_config_flow.py @@ -48,6 +48,8 @@ async def test_form(hass): assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result2["title"] == "test@email.com" assert result2["data"] == { + CONF_USERNAME: "test@email.com", + CONF_PASSWORD: "test", CONF_TOKEN: "test-refresh-token", CONF_ACCESS_TOKEN: "test-access-token", }