forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'balloob/dev' into dev
- Loading branch information
Showing
20 changed files
with
391 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
""" DO NOT MODIFY. Auto-generated by build_frontend script """ | ||
VERSION = "75532015507fd544f46081ec0eeb5004" | ||
VERSION = "b75e3c9ebd3de2dae0912a89499127a9" |
85 changes: 38 additions & 47 deletions
85
homeassistant/components/frontend/www_static/frontend.html
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
homeassistant/components/frontend/www_static/home-assistant-polymer
Submodule home-assistant-polymer
updated
from 8e33f9 to 99af26
6 changes: 3 additions & 3 deletions
6
homeassistant/components/frontend/www_static/webcomponents-lite.min.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
""" | ||
homeassistant.components.switch.orvibo | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Support for Orvibo S20 Wifi Smart Switches. | ||
For more details about this platform, please refer to the documentation at | ||
https://home-assistant.io/components/switch.orvibo/ | ||
""" | ||
import logging | ||
|
||
from homeassistant.components.switch import SwitchDevice | ||
|
||
from orvibo.s20 import S20, S20Exception | ||
|
||
DEFAULT_NAME = "Orvibo S20 Switch" | ||
REQUIREMENTS = ['orvibo==1.0.0'] | ||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def setup_platform(hass, config, add_devices_callback, discovery_info=None): | ||
""" Find and return S20 switches. """ | ||
if config.get('host') is None: | ||
_LOGGER.error("Missing required variable: host") | ||
return | ||
try: | ||
s20 = S20(config.get('host')) | ||
add_devices_callback([S20Switch(config.get('name', DEFAULT_NAME), | ||
s20)]) | ||
except S20Exception: | ||
_LOGGER.exception("S20 couldn't be initialized") | ||
|
||
|
||
class S20Switch(SwitchDevice): | ||
""" Represents an S20 switch. """ | ||
def __init__(self, name, s20): | ||
self._name = name | ||
self._s20 = s20 | ||
self._state = False | ||
|
||
@property | ||
def should_poll(self): | ||
""" Poll. """ | ||
return True | ||
|
||
@property | ||
def name(self): | ||
""" The name of the switch. """ | ||
return self._name | ||
|
||
@property | ||
def is_on(self): | ||
""" True if device is on. """ | ||
return self._state | ||
|
||
def update(self): | ||
""" Update device state. """ | ||
try: | ||
self._state = self._s20.on | ||
except S20Exception: | ||
_LOGGER.exception("Error while fetching S20 state") | ||
|
||
def turn_on(self, **kwargs): | ||
""" Turn the device on. """ | ||
try: | ||
self._s20.on = True | ||
except S20Exception: | ||
_LOGGER.exception("Error while turning on S20") | ||
|
||
def turn_off(self, **kwargs): | ||
""" Turn the device off. """ | ||
try: | ||
self._s20.on = False | ||
except S20Exception: | ||
_LOGGER.exception("Error while turning off S20") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
""" | ||
homeassistant.components.switch.zwave | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Zwave platform that handles simple binary switches. | ||
""" | ||
# pylint: disable=import-error | ||
from openzwave.network import ZWaveNetwork | ||
from pydispatch import dispatcher | ||
|
||
import homeassistant.components.zwave as zwave | ||
|
||
from homeassistant.components.switch import SwitchDevice | ||
|
||
|
||
# pylint: disable=unused-argument | ||
def setup_platform(hass, config, add_devices, discovery_info=None): | ||
""" Find and return demo switches. """ | ||
if discovery_info is None: | ||
return | ||
|
||
node = zwave.NETWORK.nodes[discovery_info[zwave.ATTR_NODE_ID]] | ||
value = node.values[discovery_info[zwave.ATTR_VALUE_ID]] | ||
|
||
if value.command_class != zwave.COMMAND_CLASS_SWITCH_BINARY: | ||
return | ||
if value.type != zwave.TYPE_BOOL: | ||
return | ||
if value.genre != zwave.GENRE_USER: | ||
return | ||
|
||
value.set_change_verified(False) | ||
add_devices([ZwaveSwitch(value)]) | ||
|
||
|
||
class ZwaveSwitch(SwitchDevice): | ||
""" Provides a zwave switch. """ | ||
def __init__(self, value): | ||
self._value = value | ||
self._node = value.node | ||
|
||
self._state = value.data | ||
|
||
dispatcher.connect( | ||
self._value_changed, ZWaveNetwork.SIGNAL_VALUE_CHANGED) | ||
|
||
def _value_changed(self, value): | ||
""" Called when a value has changed on the network. """ | ||
if self._value.value_id == value.value_id: | ||
self._state = value.data | ||
self.update_ha_state() | ||
|
||
@property | ||
def should_poll(self): | ||
""" No polling needed for a demo switch. """ | ||
return False | ||
|
||
@property | ||
def name(self): | ||
""" Returns the name of the device if any. """ | ||
name = self._node.name or "{}".format(self._node.product_name) | ||
|
||
return "{}".format(name or self._value.label) | ||
|
||
@property | ||
def is_on(self): | ||
""" True if device is on. """ | ||
return self._state | ||
|
||
def turn_on(self, **kwargs): | ||
""" Turn the device on. """ | ||
self._node.set_switch(self._value.value_id, True) | ||
|
||
def turn_off(self, **kwargs): | ||
""" Turn the device off. """ | ||
self._node.set_switch(self._value.value_id, False) |
Oops, something went wrong.