Protect bloomsky platform setup (#12316)
This commit is contained in:
parent
247edf1b69
commit
3e150bb2b3
3 changed files with 12 additions and 0 deletions
|
@ -31,6 +31,10 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the available BloomSky weather binary sensors."""
|
||||
# Protect against people having setup the bloomsky platforms
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
bloomsky = get_component('bloomsky')
|
||||
# Default needed in case of discovery
|
||||
sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES)
|
||||
|
|
|
@ -17,6 +17,10 @@ DEPENDENCIES = ['bloomsky']
|
|||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up access to BloomSky cameras."""
|
||||
# Protect against people having setup the bloomsky platforms
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
bloomsky = get_component('bloomsky')
|
||||
for device in bloomsky.BLOOMSKY.devices.values():
|
||||
add_devices([BloomSkyCamera(bloomsky.BLOOMSKY, device)])
|
||||
|
|
|
@ -45,6 +45,10 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the available BloomSky weather sensors."""
|
||||
# Protect against people having setup the bloomsky platforms
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
bloomsky = get_component('bloomsky')
|
||||
# Default needed in case of discovery
|
||||
sensors = config.get(CONF_MONITORED_CONDITIONS, SENSOR_TYPES)
|
||||
|
|
Loading…
Add table
Reference in a new issue