Give august its own aiohttp session (#86404)

fixes undefined
This commit is contained in:
J. Nick Koston 2023-01-22 23:14:29 -10:00 committed by GitHub
parent 64535175b1
commit bfc19c8cc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -22,7 +22,10 @@ async def async_setup_entry(
) -> None:
"""Set up August cameras."""
data: AugustData = hass.data[DOMAIN][config_entry.entry_id]
session = aiohttp_client.async_get_clientsession(hass)
# Create an aiohttp session instead of using the default one since the
# default one is likely to trigger august's WAF if another integration
# is also using Cloudflare
session = aiohttp_client.async_create_clientsession(hass)
async_add_entities(
AugustCamera(data, doorbell, session, DEFAULT_TIMEOUT)
for doorbell in data.doorbells

View file

@ -30,7 +30,10 @@ class AugustGateway:
def __init__(self, hass):
"""Init the connection."""
self._aiohttp_session = aiohttp_client.async_get_clientsession(hass)
# Create an aiohttp session instead of using the default one since the
# default one is likely to trigger august's WAF if another integration
# is also using Cloudflare
self._aiohttp_session = aiohttp_client.async_create_clientsession(hass)
self._token_refresh_lock = asyncio.Lock()
self._access_token_cache_file = None
self._hass = hass