Fix PEP257 issues

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

View file

@ -1,6 +1,4 @@
"""
homeassistant.components.switch.mystrom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for myStrom switches.
For more details about this component, please refer to the documentation at
@ -18,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Find and return myStrom switches. """
"""Find and return myStrom switch."""
host = config.get('host')
if host is None:
@ -41,8 +39,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class MyStromSwitch(SwitchDevice):
""" Represents a myStrom switch. """
"""Representation of a myStrom switch."""
def __init__(self, name, resource):
"""Initialize the myStrom switch."""
self._state = False
self._name = name
self._resource = resource
@ -50,21 +50,21 @@ class MyStromSwitch(SwitchDevice):
@property
def name(self):
""" The name of the switch. """
"""Return the name of the switch."""
return self._name
@property
def is_on(self):
""" True if switch is on. """
"""Return true if switch is on."""
return self._state
@property
def current_power_mwh(self):
""" Current power consumption in mwh. """
"""Return the urrent power consumption in mWh."""
return self.consumption
def turn_on(self, **kwargs):
""" Turn the switch on. """
"""Turn the switch on."""
try:
request = requests.get('{}/relay'.format(self._resource),
params={'state': '1'},
@ -76,7 +76,7 @@ class MyStromSwitch(SwitchDevice):
self._resource)
def turn_off(self, **kwargs):
""" Turn the switch off. """
"""Turn the switch off."""
try:
request = requests.get('{}/relay'.format(self._resource),
params={'state': '0'},
@ -88,7 +88,7 @@ class MyStromSwitch(SwitchDevice):
self._resource)
def update(self):
""" Gets the latest data from REST API and updates the state. """
"""Get the latest data from REST API and update the state."""
try:
request = requests.get('{}/report'.format(self._resource),
timeout=10)