Skip to content

Commit

Permalink
fix optionsflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneNulschDE committed Nov 25, 2024
1 parent 1747652 commit d90ba60
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions custom_components/mbapi2020/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
from homeassistant.helpers.selector import QrCodeSelector, QrCodeSelectorConfig, QrErrorCorrectionLevel
from homeassistant.helpers.storage import STORAGE_DIR

from .client import Client
from .const import (
CONF_ALLOWED_AUTH_METHODS,
CONF_ALLOWED_REGIONS,
CONF_AUTH_METHOD,
CONF_DEBUG_FILE_SAVE,
CONF_DELETE_AUTH_FILE,
CONF_ENABLE_CHINA_GCJ_02,
Expand Down Expand Up @@ -86,6 +89,18 @@ async def async_step_user(self, user_input=None):

LOGGER.error("Request PIN error: %s", errors)

# data_schema = SCHEMA_STEP_USER.extend(
# {
# vol.Optional("qr_code"): QrCodeSelector(
# config=QrCodeSelectorConfig(
# data="https://link.emea-prod.mobilesdk.mercedes-benz.com/device-login?userCode=OTdOTi1CTVhX&deviceType=watch",
# scale=6,
# error_correction_level=QrErrorCorrectionLevel.QUARTILE,
# )
# )
# }
# )

return self.async_show_form(
step_id="user",
data_schema=SCHEMA_STEP_USER,
Expand Down Expand Up @@ -160,9 +175,9 @@ async def async_step_init(self, user_input=None):
if user_input[CONF_DELETE_AUTH_FILE] is True:
auth_file = self.hass.config.path(STORAGE_DIR, f"{TOKEN_FILE_PREFIX}-{self.config_entry.entry_id}")
LOGGER.warning("DELETE Auth Information requested %s", auth_file)
new_config_entry_data = deepcopy(dict(self._config_entry.data))
new_config_entry_data = deepcopy(dict(self.config_entry.data))
new_config_entry_data["token"] = None
changed = self.hass.config_entries.async_update_entry(self._config_entry, data=new_config_entry_data)
changed = self.hass.config_entries.async_update_entry(self.config_entry, data=new_config_entry_data)

LOGGER.debug("%s Creating restart_required issue", DOMAIN)
async_create_issue(
Expand Down

0 comments on commit d90ba60

Please sign in to comment.