Update docstring (config file) and attempt to honor PEP0257
This commit is contained in:
parent
f18928d85b
commit
78a555faf5
11 changed files with 38 additions and 31 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue