Allow scrape sensor to retry setting up platform if initial setup fails (#19498)

pull/19516/head
uchagani 2018-12-22 02:40:30 -05:00 committed by Martin Hjelmare
parent 30841ef4da
commit 3a3d488de3
1 changed files with 2 additions and 2 deletions

View File

@ -17,6 +17,7 @@ from homeassistant.const import (
CONF_PASSWORD, CONF_AUTHENTICATION, HTTP_BASIC_AUTHENTICATION,
HTTP_DIGEST_AUTHENTICATION)
from homeassistant.helpers.entity import Entity
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['beautifulsoup4==4.6.3']
@ -73,8 +74,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
rest.update()
if rest.data is None:
_LOGGER.error("Unable to fetch data from %s", resource)
return False
raise PlatformNotReady
add_entities([
ScrapeSensor(rest, name, select, attr, value_template, unit)], True)