Prevent speedtest from blocking startup or causing other intergations to fail setup (#38305)

When speedtest starts up, it would saturate the network interface and cause other
integrations to randomly fail to setup. We now wait to do the first speed test
until after the started event is fired.
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-07-27 22:57:36 -07:00
1 parent f06ae1fa95
commit 77b6f8c9f2
2 files changed
+27 -15

No files matched your search

@@ -12,7 +12,6 @@ from .const import (
ATTR_SERVER_ID,
ATTR_SERVER_NAME,
ATTRIBUTION,
CONF_MANUAL,
DEFAULT_NAME,
DOMAIN,
ICON,
@@ -97,10 +96,9 @@ class SpeedtestSensor(RestoreEntity):
async def async_added_to_hass(self):
"""Handle entity which will be added."""
await super().async_added_to_hass()
if self.coordinator.config_entry.options[CONF_MANUAL]:
state = await self.async_get_last_state()
if state:
self._state = state.state
state = await self.async_get_last_state()
if state:
self._state = state.state
@callback
def update():