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,8 +1,7 @@
"""
homeassistant.components.switch.arduino
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for switching Arduino pins on and off. So far only digital pins are
supported.
Support for switching Arduino pins on and off.
So far only digital pins are supported.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.arduino/
@ -19,8 +18,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Arduino platform. """
"""Setup the Arduino platform."""
# Verify that Arduino board is present
if arduino.BOARD is None:
_LOGGER.error('A connection has not been made to the Arduino board.')
@ -37,8 +35,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ArduinoSwitch(SwitchDevice):
""" Represents an Arduino switch. """
"""Representation of an Arduino switch."""
def __init__(self, name, pin, pin_type):
"""Initialize the Pin."""
self._pin = pin
self._name = name or DEVICE_DEFAULT_NAME
self.pin_type = pin_type
@ -49,20 +49,20 @@ class ArduinoSwitch(SwitchDevice):
@property
def name(self):
""" Get the name of the pin. """
"""Get the name of the pin."""
return self._name
@property
def is_on(self):
""" Returns True if pin is high/on. """
"""Return true if pin is high/on."""
return self._state
def turn_on(self):
""" Turns the pin to high/on. """
"""Turn the pin to high/on."""
self._state = True
arduino.BOARD.set_digital_out_high(self._pin)
def turn_off(self):
""" Turns the pin to low/off. """
"""Turn the pin to low/off."""
self._state = False
arduino.BOARD.set_digital_out_low(self._pin)