diff --git a/homeassistant/components/switch/arduino.py b/homeassistant/components/switch/arduino.py index 367e7378b27..bb962c08f72 100644 --- a/homeassistant/components/switch/arduino.py +++ b/homeassistant/components/switch/arduino.py @@ -6,6 +6,9 @@ supported. Configuration: +To use the arduino switch you will need to add something like the following +to your configuration.yaml file. + switch: platform: arduino pins: @@ -62,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class ArduinoSwitch(SwitchDevice): - """ Represents an Arduino Switch. """ + """ Represents an Arduino switch. """ def __init__(self, name, pin, pin_type): self._pin = pin self._name = name or DEVICE_DEFAULT_NAME diff --git a/homeassistant/components/switch/command_switch.py b/homeassistant/components/switch/command_switch.py index 7cc51a1f9b9..4d5aeba94f5 100644 --- a/homeassistant/components/switch/command_switch.py +++ b/homeassistant/components/switch/command_switch.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ homeassistant.components.switch.command_switch -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Allows to configure custom shell commands to turn a switch on/off. """ @@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class CommandSwitch(SwitchDevice): - """ Represents a switch that can be togggled using shell commands """ + """ Represents a switch that can be togggled using shell commands. """ def __init__(self, name, command_on, command_off): self._name = name self._state = False @@ -39,7 +39,7 @@ class CommandSwitch(SwitchDevice): @staticmethod def _switch(command): - """ Execute the actual commands """ + """ Execute the actual commands. """ _LOGGER.info('Running command: %s', command) success = (subprocess.call(command, shell=True) == 0) @@ -51,12 +51,12 @@ class CommandSwitch(SwitchDevice): @property def should_poll(self): - """ No polling needed """ + """ No polling needed. """ return False @property def name(self): - """ The name of the switch """ + """ The name of the switch. """ return self._name @property diff --git a/homeassistant/components/switch/demo.py b/homeassistant/components/switch/demo.py index c097722ac4d..4ee1dc82413 100644 --- a/homeassistant/components/switch/demo.py +++ b/homeassistant/components/switch/demo.py @@ -3,7 +3,6 @@ homeassistant.components.switch.demo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Demo platform that has two fake switches. - """ from homeassistant.components.switch import SwitchDevice from homeassistant.const import DEVICE_DEFAULT_NAME diff --git a/homeassistant/components/switch/edimax.py b/homeassistant/components/switch/edimax.py index 200c5746e27..4abe2877987 100644 --- a/homeassistant/components/switch/edimax.py +++ b/homeassistant/components/switch/edimax.py @@ -6,7 +6,7 @@ Support for Edimax switches. Configuration: To use the Edimax switch you will need to add something like the following to -your config/configuration.yaml. +your configuration.yaml file. switch: platform: edimax @@ -89,7 +89,7 @@ class SmartPlugSwitch(SwitchDevice): @property def current_power_mwh(self): - """ Current power usage in mwh. """ + """ Current power usage in mWh. """ try: return float(self.smartplug.now_power) / 1000000.0 except ValueError: @@ -97,7 +97,7 @@ class SmartPlugSwitch(SwitchDevice): @property def today_power_mw(self): - """ Today total power usage in mw. """ + """ Today total power usage in mW. """ try: return float(self.smartplug.now_energy_day) / 1000.0 except ValueError: diff --git a/homeassistant/components/switch/modbus.py b/homeassistant/components/switch/modbus.py index dbf9bc83aad..5a00b9cb174 100644 --- a/homeassistant/components/switch/modbus.py +++ b/homeassistant/components/switch/modbus.py @@ -1,12 +1,12 @@ """ homeassistant.components.switch.modbus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Support for Modbus switches. Configuration: + To use the Modbus switches you will need to add something like the following to -your config/configuration.yaml +your configuration.yaml file. sensor: platform: modbus @@ -42,7 +42,7 @@ DEPENDENCIES = ['modbus'] def setup_platform(hass, config, add_devices, discovery_info=None): - """ Read config and create Modbus devices """ + """ Read configuration and create Modbus devices. """ switches = [] slave = config.get("slave", None) if modbus.TYPE == "serial" and not slave: @@ -87,8 +87,10 @@ class ModbusSwitch(ToggleEntity): @property def should_poll(self): - """ We should poll, because slaves are not allowed to - initiate communication on Modbus networks""" + """ + We should poll, because slaves are not allowed to initiate + communication on Modbus networks. + """ return True @property diff --git a/homeassistant/components/switch/rpi_gpio.py b/homeassistant/components/switch/rpi_gpio.py index 4afa38aa80a..08c7ff35255 100644 --- a/homeassistant/components/switch/rpi_gpio.py +++ b/homeassistant/components/switch/rpi_gpio.py @@ -2,10 +2,14 @@ homeassistant.components.switch.rpi_gpio ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Allows to control the GPIO pins of a Raspberry Pi. + Note: To use RPi GPIO, Home Assistant must be run as root. Configuration: +To use the Raspberry GPIO switches you will need to add something like the +following to your configuration.yaml file. + switch: platform: rpi_gpio invert_logic: false diff --git a/homeassistant/components/switch/tellstick.py b/homeassistant/components/switch/tellstick.py index 230151382e7..ae064d4fdb8 100644 --- a/homeassistant/components/switch/tellstick.py +++ b/homeassistant/components/switch/tellstick.py @@ -1,7 +1,6 @@ """ homeassistant.components.switch.tellstick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Support for Tellstick switches. Because the tellstick sends its actions via radio and from most @@ -47,7 +46,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class TellstickSwitchDevice(ToggleEntity): - """ Represents a Tellstick switch within Home Assistant. """ + """ Represents a Tellstick switch. """ last_sent_command_mask = (tellcore_constants.TELLSTICK_TURNON | tellcore_constants.TELLSTICK_TURNOFF) diff --git a/homeassistant/components/switch/transmission.py b/homeassistant/components/switch/transmission.py index d5cf716c770..8288ed8456b 100644 --- a/homeassistant/components/switch/transmission.py +++ b/homeassistant/components/switch/transmission.py @@ -6,15 +6,15 @@ Enable or disable Transmission BitTorrent client Turtle Mode. Configuration: To use the Transmission switch you will need to add something like the -following to your config/configuration.yaml +following to your configuration.yaml file. switch: - platform: transmission - name: Transmission - host: 192.168.1.26 - port: 9091 - username: YOUR_USERNAME - password: YOUR_PASSWORD + platform: transmission + name: Transmission + host: 192.168.1.26 + port: 9091 + username: YOUR_USERNAME + password: YOUR_PASSWORD Variables: diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 77b49ebf826..e568596a0b2 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -5,7 +5,7 @@ Support for Vera switches. Configuration: To use the Vera lights you will need to add something like the following to -your config/configuration.yaml. +your configuration.yaml file. switch: platform: vera diff --git a/homeassistant/components/switch/verisure.py b/homeassistant/components/switch/verisure.py index 6c8f0352c3f..7840defdfc4 100644 --- a/homeassistant/components/switch/verisure.py +++ b/homeassistant/components/switch/verisure.py @@ -1,7 +1,7 @@ """ homeassistant.components.switch.verisure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Support for Verisure Smartplugs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Support for Verisure Smartplugs. """ import logging @@ -12,7 +12,7 @@ _LOGGER = logging.getLogger(__name__) def setup_platform(hass, config, add_devices, discovery_info=None): - """ Sets up the Arduino platform. """ + """ Sets up the Verisure platform. """ if not verisure.MY_PAGES: _LOGGER.error('A connection has not been made to Verisure mypages.') @@ -48,13 +48,13 @@ class VerisureSmartplug(SwitchDevice): return plug_status == self.status_on def turn_on(self): - """ Set smartplug status on """ + """ Set smartplug status on. """ verisure.MY_PAGES.set_smartplug_status( self._id, self.status_on) def turn_off(self): - """ Set smartplug status off """ + """ Set smartplug status off. """ verisure.MY_PAGES.set_smartplug_status( self._id, self.status_off) diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py index 98c6ed5aa01..1a78a7d6725 100644 --- a/homeassistant/components/switch/wemo.py +++ b/homeassistant/components/switch/wemo.py @@ -36,7 +36,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): class WemoSwitch(SwitchDevice): - """ Represents a WeMo switch within Home Assistant. """ + """ Represents a WeMo switch. """ def __init__(self, wemo): self.wemo = wemo self.insight_params = None