mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix custom account config flow setup (#127750)
This commit is contained in:
parent
00a037c786
commit
d41b9beb71
@ -32,7 +32,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
client_session=async_get_clientsession(hass),
|
client_session=async_get_clientsession(hass),
|
||||||
)
|
)
|
||||||
|
|
||||||
if custom_account := entry.data.get(CONF_ACCOUNT) is not None:
|
if (custom_account := entry.data.get(CONF_ACCOUNT)) is not None:
|
||||||
client.custom_account_id = custom_account
|
client.custom_account_id = custom_account
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
|
|
||||||
async def async_update_data() -> OVODailyUsage:
|
async def async_update_data() -> OVODailyUsage:
|
||||||
"""Fetch data from OVO Energy."""
|
"""Fetch data from OVO Energy."""
|
||||||
if custom_account := entry.data.get(CONF_ACCOUNT) is not None:
|
if (custom_account := entry.data.get(CONF_ACCOUNT)) is not None:
|
||||||
client.custom_account_id = custom_account
|
client.custom_account_id = custom_account
|
||||||
|
|
||||||
async with asyncio.timeout(10):
|
async with asyncio.timeout(10):
|
||||||
|
@ -46,7 +46,7 @@ class OVOEnergyFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
client_session=async_get_clientsession(self.hass),
|
client_session=async_get_clientsession(self.hass),
|
||||||
)
|
)
|
||||||
|
|
||||||
if custom_account := user_input.get(CONF_ACCOUNT) is not None:
|
if (custom_account := user_input.get(CONF_ACCOUNT)) is not None:
|
||||||
client.custom_account_id = custom_account
|
client.custom_account_id = custom_account
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -117,6 +117,7 @@ async def test_full_flow_implementation(hass: HomeAssistant) -> None:
|
|||||||
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result2["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
|
assert result2["data"][CONF_USERNAME] == FIXTURE_USER_INPUT[CONF_USERNAME]
|
||||||
assert result2["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
|
assert result2["data"][CONF_PASSWORD] == FIXTURE_USER_INPUT[CONF_PASSWORD]
|
||||||
|
assert result2["data"][CONF_ACCOUNT] == FIXTURE_USER_INPUT[CONF_ACCOUNT]
|
||||||
|
|
||||||
|
|
||||||
async def test_reauth_authorization_error(hass: HomeAssistant) -> None:
|
async def test_reauth_authorization_error(hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user