1 """API for Ondilo ICO bound to Home Assistant OAuth."""
3 from asyncio
import run_coroutine_threadsafe
6 from ondilo
import Ondilo
8 from homeassistant
import config_entries, core
11 _LOGGER = logging.getLogger(__name__)
15 """Provide Ondilo ICO authentication tied to an OAuth2 based config entry."""
19 hass: core.HomeAssistant,
21 implementation: config_entry_oauth2_flow.AbstractOAuth2Implementation,
23 """Initialize Ondilo ICO Auth."""
26 self.
sessionsession = config_entry_oauth2_flow.OAuth2Session(
27 hass, config_entry, implementation
32 """Refresh and return new Ondilo ICO tokens using Home Assistant OAuth2 session."""
33 run_coroutine_threadsafe(
34 self.
sessionsession.async_ensure_token_valid(), self.
hasshass.loop
37 return self.
sessionsession.token
None __init__(self, core.HomeAssistant hass, config_entries.ConfigEntry config_entry, config_entry_oauth2_flow.AbstractOAuth2Implementation implementation)
dict refresh_tokens(self)