1616from homeassistant .const import EVENT_HOMEASSISTANT_STOP
1717from homeassistant .core import HomeAssistant
1818from homeassistant .exceptions import ConfigEntryAuthFailed , ConfigEntryNotReady
19- from homeassistant .helpers import config_entry_oauth2_flow , device_registry as dr
19+ from homeassistant .helpers import device_registry as dr
20+ from homeassistant .helpers .config_entry_oauth2_flow import (
21+ ImplementationUnavailableError ,
22+ OAuth2Session ,
23+ async_get_config_entry_implementation ,
24+ )
2025
2126from .const import DOMAIN , PLATFORMS
2227from .data import YaleData
@@ -30,14 +35,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: YaleConfigEntry) -> bool
3035 """Set up Yale from a config entry."""
3136 session = async_create_yale_clientsession (hass )
3237 try :
33- implementation = (
34- await config_entry_oauth2_flow .async_get_config_entry_implementation (
35- hass , entry
36- )
37- )
38- except ValueError as err :
38+ implementation = await async_get_config_entry_implementation (hass , entry )
39+ except ImplementationUnavailableError as err :
3940 raise ConfigEntryNotReady ("OAuth implementation not available" ) from err
40- oauth_session = config_entry_oauth2_flow . OAuth2Session (hass , entry , implementation )
41+ oauth_session = OAuth2Session (hass , entry , implementation )
4142 yale_gateway = YaleGateway (Path (hass .config .config_dir ), session , oauth_session )
4243 try :
4344 await async_setup_yale (hass , entry , yale_gateway )
0 commit comments