mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
commit
343b5bd2b8
@ -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 = []
|
||||||
|
switch_conf = config.get('switches', [config])
|
||||||
|
|
||||||
|
for switch in switch_conf:
|
||||||
|
if switch.get('host') is None:
|
||||||
_LOGGER.error("Missing required variable: host")
|
_LOGGER.error("Missing required variable: host")
|
||||||
return
|
continue
|
||||||
|
host = switch.get('host')
|
||||||
try:
|
try:
|
||||||
s20 = S20(config.get('host'))
|
switches.append(S20Switch(switch.get('name', DEFAULT_NAME),
|
||||||
add_devices_callback([S20Switch(config.get('name', DEFAULT_NAME),
|
S20(host)))
|
||||||
s20)])
|
_LOGGER.info("Initialized S20 at %s", host)
|
||||||
except S20Exception:
|
except S20Exception:
|
||||||
_LOGGER.exception("S20 couldn't be initialized")
|
_LOGGER.exception("S20 at %s couldn't be initialized",
|
||||||
|
host)
|
||||||
|
|
||||||
|
add_devices_callback(switches)
|
||||||
|
|
||||||
|
|
||||||
class S20Switch(SwitchDevice):
|
class S20Switch(SwitchDevice):
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user