1414from homeassistant .const import EVENT_HOMEASSISTANT_STOP
1515from homeassistant .core import HomeAssistant
1616from homeassistant .exceptions import ConfigEntryAuthFailed , ConfigEntryNotReady
17- from homeassistant .helpers import (
18- config_entry_oauth2_flow ,
19- device_registry as dr ,
20- issue_registry as ir ,
17+ from homeassistant .helpers import device_registry as dr , issue_registry as ir
18+ from homeassistant .helpers .config_entry_oauth2_flow import (
19+ ImplementationUnavailableError ,
20+ OAuth2Session ,
21+ async_get_config_entry_implementation ,
2122)
2223
2324from .const import DEFAULT_AUGUST_BRAND , DOMAIN , PLATFORMS
@@ -37,14 +38,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: AugustConfigEntry) -> bo
3738
3839 session = async_create_august_clientsession (hass )
3940 try :
40- implementation = (
41- await config_entry_oauth2_flow .async_get_config_entry_implementation (
42- hass , entry
43- )
44- )
45- except ValueError as err :
41+ implementation = await async_get_config_entry_implementation (hass , entry )
42+ except ImplementationUnavailableError as err :
4643 raise ConfigEntryNotReady ("OAuth implementation not available" ) from err
47- oauth_session = config_entry_oauth2_flow . OAuth2Session (hass , entry , implementation )
44+ oauth_session = OAuth2Session (hass , entry , implementation )
4845 august_gateway = AugustGateway (Path (hass .config .config_dir ), session , oauth_session )
4946 try :
5047 await async_setup_august (hass , entry , august_gateway )
0 commit comments