Fix PEP257 issues

This commit is contained in:
Fabian Affolter committed 2016-03-08 13:35:39 +01:00
1 parent 652f059d6a
commit 49ebc6d0b0
29 files changed
+294 -309

No files matched your search

+11 -9
View File
@@ -1,8 +1,8 @@
"""
homeassistant.components.switch.zwave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zwave platform that handles simple binary switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.zwave/
"""
# Because we do not compile openzwave on CI
# pylint: disable=import-error
@@ -14,7 +14,7 @@ from homeassistant.components.zwave import (
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Find and return demo switches. """
"""Find and return Z-Wave switches."""
if discovery_info is None or NETWORK is None:
return
@@ -33,8 +33,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ZwaveSwitch(ZWaveDeviceEntity, SwitchDevice):
""" Provides a zwave switch. """
"""Representation of a Z-Wave switch."""
def __init__(self, value):
"""Initialize the Z-Wave switch device."""
from openzwave.network import ZWaveNetwork
from pydispatch import dispatcher
@@ -45,20 +47,20 @@ class ZwaveSwitch(ZWaveDeviceEntity, SwitchDevice):
self._value_changed, ZWaveNetwork.SIGNAL_VALUE_CHANGED)
def _value_changed(self, value):
""" Called when a value has changed on the network. """
"""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 is_on(self):
""" True if device is on. """
"""Return true if device is on."""
return self._state
def turn_on(self, **kwargs):
""" Turn the device on. """
"""Turn the device on."""
self._value.node.set_switch(self._value.value_id, True)
def turn_off(self, **kwargs):
""" Turn the device off. """
"""Turn the device off."""
self._value.node.set_switch(self._value.value_id, False)