Reduced polling interval for mutesync integration (#49884)

This commit is contained in:
Tom Toor
2021-04-29 22:55:51 -07:00
committed by Franck Nijhof
parent 41cf66c294
commit aa46549be9
2 changed files with 3 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def update_data(): async def update_data():
"""Update the data.""" """Update the data."""
async with async_timeout.timeout(5): async with async_timeout.timeout(2.5):
return await client.get_state() return await client.get_state()
coordinator = hass.data.setdefault(DOMAIN, {})[ coordinator = hass.data.setdefault(DOMAIN, {})[
@@ -35,7 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass, hass,
logging.getLogger(__name__), logging.getLogger(__name__),
name=DOMAIN, name=DOMAIN,
update_interval=timedelta(seconds=10), update_interval=timedelta(seconds=5),
update_method=update_data, update_method=update_data,
) )
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()

View File

@@ -26,7 +26,7 @@ async def validate_input(hass: HomeAssistant, data: dict[str, Any]) -> dict[str,
""" """
session = hass.helpers.aiohttp_client.async_get_clientsession() session = hass.helpers.aiohttp_client.async_get_clientsession()
try: try:
async with async_timeout.timeout(10): async with async_timeout.timeout(5):
token = await mutesync.authenticate(session, data["host"]) token = await mutesync.authenticate(session, data["host"])
except aiohttp.ClientResponseError as error: except aiohttp.ClientResponseError as error:
if error.status == 403: if error.status == 403: