Check if droplet exists (#6663)

* Check if droplet exists

* Add droplet to message and remove else
pull/6665/head
Fabian Affolter 2017-03-16 19:59:34 +01:00 committed by GitHub
parent a2365eccf6
commit 1ab47b5d2b
2 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
dev = []
for droplet in droplets:
droplet_id = digital_ocean.DIGITAL_OCEAN.get_droplet_id(droplet)
if droplet_id is None:
_LOGGER.error("Droplet %s is not available", droplet)
return False
dev.append(DigitalOceanBinarySensor(
digital_ocean.DIGITAL_OCEAN, droplet_id))

View File

@ -35,6 +35,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
dev = []
for droplet in droplets:
droplet_id = digital_ocean.DIGITAL_OCEAN.get_droplet_id(droplet)
if droplet_id is None:
_LOGGER.error("Droplet %s is not available", droplet)
return False
dev.append(DigitalOceanSwitch(
digital_ocean.DIGITAL_OCEAN, droplet_id))