Merge pull request #682 from happyleavesaoc/s20-update

Orvibo updates
This commit is contained in:
Paulus Schoutsen 2015-11-29 14:13:31 -08:00
commit 343b5bd2b8
2 changed files with 19 additions and 11 deletions

View File

@ -11,7 +11,7 @@ import logging
from homeassistant.components.switch import SwitchDevice from homeassistant.components.switch import SwitchDevice
DEFAULT_NAME = "Orvibo S20 Switch" DEFAULT_NAME = "Orvibo S20 Switch"
REQUIREMENTS = ['orvibo==1.0.0'] REQUIREMENTS = ['orvibo==1.0.1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -20,15 +20,23 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return S20 switches. """ """ Find and return S20 switches. """
from orvibo.s20 import S20, S20Exception from orvibo.s20 import S20, S20Exception
if config.get('host') is None: switches = []
_LOGGER.error("Missing required variable: host") switch_conf = config.get('switches', [config])
return
try: for switch in switch_conf:
s20 = S20(config.get('host')) if switch.get('host') is None:
add_devices_callback([S20Switch(config.get('name', DEFAULT_NAME), _LOGGER.error("Missing required variable: host")
s20)]) continue
except S20Exception: host = switch.get('host')
_LOGGER.exception("S20 couldn't be initialized") try:
switches.append(S20Switch(switch.get('name', DEFAULT_NAME),
S20(host)))
_LOGGER.info("Initialized S20 at %s", host)
except S20Exception:
_LOGGER.exception("S20 at %s couldn't be initialized",
host)
add_devices_callback(switches)
class S20Switch(SwitchDevice): class S20Switch(SwitchDevice):

View File

@ -151,7 +151,7 @@ https://github.com/rkabadi/pyedimax/archive/365301ce3ff26129a7910c501ead09ea625f
hikvision==0.4 hikvision==0.4
# homeassistant.components.switch.orvibo # homeassistant.components.switch.orvibo
orvibo==1.0.0 orvibo==1.0.1
# homeassistant.components.switch.wemo # homeassistant.components.switch.wemo
pywemo==0.3.3 pywemo==0.3.3