Skip to content

Commit

Permalink
refactor: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Dec 8, 2021
1 parent 22817bd commit cba719f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
17 changes: 0 additions & 17 deletions custom_components/tesla_custom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
)
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.httpx_client import SERVER_SOFTWARE, USER_AGENT
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
import httpx
from teslajsonpy import Controller as TeslaAPI
from teslajsonpy.const import AUTH_DOMAIN
from teslajsonpy.exceptions import IncompleteCredentials, TeslaException
import voluptuous as vol

from .config_flow import CannotConnect, InvalidAuth, validate_input
from .const import (
Expand All @@ -41,21 +39,6 @@

_LOGGER = logging.getLogger(__name__)

CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_TOKEN): cv.string,
vol.Optional(
CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL
): vol.All(cv.positive_int, vol.Clamp(min=MIN_SCAN_INTERVAL)),
}
)
},
extra=vol.ALLOW_EXTRA,
)


@callback
def _async_save_tokens(hass, config_entry, access_token, refresh_token, expiration):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tesla_custom/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def validate_input(hass: core.HomeAssistant, data):
)
result = await controller.connect(test_login=True)
config[CONF_TOKEN] = result["refresh_token"]
config[CONF_ACCESS_TOKEN] = result["access_token"]
config[CONF_ACCESS_TOKEN] = result[CONF_ACCESS_TOKEN]
config[CONF_EXPIRATION] = result[CONF_EXPIRATION]
config[CONF_USERNAME] = data[CONF_USERNAME]
config[CONF_DOMAIN] = data.get(CONF_DOMAIN, AUTH_DOMAIN)
Expand Down

0 comments on commit cba719f

Please sign in to comment.