Skip to content

Commit

Permalink
Fix ConfigFlow, use new MySkoda class
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
dvx76 committed Sep 25, 2024
1 parent be64ec4 commit 1eef55f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/myskoda/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
from typing import Any

import voluptuous as vol

from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow as BaseConfigFlow,
ConfigFlowResult,
OptionsFlow,
callback,
)
from homeassistant.config_entries import ConfigFlow as BaseConfigFlow
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.schema_config_entry_flow import (
SchemaFlowFormStep,
SchemaOptionsFlowHandler,
)

from myskoda import RestApi
from homeassistant.util.ssl import get_default_context
from myskoda import MySkoda

from .const import DOMAIN

Expand All @@ -45,10 +46,9 @@

async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> None:
"""Check that the inputs are valid."""
hub = RestApi(async_get_clientsession(hass))
hub = MySkoda(async_get_clientsession(hass), get_default_context())

if not await hub.authenticate(data["email"], data["password"]):
raise InvalidAuth
await hub.connect(data["email"], data["password"])


class ConfigFlow(BaseConfigFlow, domain=DOMAIN):
Expand Down

0 comments on commit 1eef55f

Please sign in to comment.