Update documentation

This commit is contained in:
Fabian Affolter 2015-05-13 19:18:30 +02:00 committed by Paulus Schoutsen
parent 6b0e29ad55
commit fdb46d80ba
27 changed files with 197 additions and 100 deletions

View File

@ -22,7 +22,7 @@ DOMAIN = "example"
# List of component names (string) your component depends upon # List of component names (string) your component depends upon
# We depend on group because group will be loaded after all the components that # We depend on group because group will be loaded after all the components that
# initalize devices have been setup. # initialize devices have been setup.
DEPENDENCIES = ['group'] DEPENDENCIES = ['group']
# Configuration key for the entity id we are targetting # Configuration key for the entity id we are targetting
@ -115,5 +115,5 @@ def setup(hass, config):
# Register our service with HASS. # Register our service with HASS.
hass.services.register(DOMAIN, SERVICE_FLASH, flash_service) hass.services.register(DOMAIN, SERVICE_FLASH, flash_service)
# Tells the bootstrapper that the component was succesfully initialized # Tells the bootstrapper that the component was successfully initialized
return True return True

View File

@ -1,8 +1,8 @@
""" """
homeassistant.components.demo homeassistant.components.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sets up a demo environment that mimics interaction with devices Sets up a demo environment that mimics interaction with devices.
""" """
import time import time

View File

@ -1,11 +1,13 @@
""" """
homeassistant.components.discovery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Starts a service to scan in intervals for new devices. Starts a service to scan in intervals for new devices.
Will emit EVENT_PLATFORM_DISCOVERED whenever a new service has been discovered. Will emit EVENT_PLATFORM_DISCOVERED whenever a new service has been discovered.
Knows which components handle certain types, will make sure they are Knows which components handle certain types, will make sure they are
loaded before the EVENT_PLATFORM_DISCOVERED is fired. loaded before the EVENT_PLATFORM_DISCOVERED is fired.
""" """
import logging import logging
import threading import threading

View File

@ -1,6 +1,6 @@
""" """
homeassistant.components.groups homeassistant.components.group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to group devices that can be turned on or off. Provides functionality to group devices that can be turned on or off.
""" """

View File

@ -1,6 +1,6 @@
""" """
homeassistant.components.httpinterface homeassistant.components.httpinterface
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides an API and a HTTP interface for debug purposes. This module provides an API and a HTTP interface for debug purposes.

View File

@ -1,4 +1,7 @@
""" """
homeassistant.components.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connects to an ISY-994 controller and loads relevant components to control its Connects to an ISY-994 controller and loads relevant components to control its
devices. Also contains the base classes for ISY Sensors, Lights, and Switches. devices. Also contains the base classes for ISY Sensors, Lights, and Switches.
""" """
@ -32,7 +35,7 @@ _LOGGER = logging.getLogger(__name__)
def setup(hass, config): def setup(hass, config):
""" """
Setup isy994 component. Setup ISY994 component.
This will automatically import associated lights, switches, and sensors. This will automatically import associated lights, switches, and sensors.
""" """
try: try:
@ -101,7 +104,7 @@ def stop(event):
class ISYDeviceABC(ToggleEntity): class ISYDeviceABC(ToggleEntity):
""" Abstract Class for an ISY device within home assistant. """ """ Abstract Class for an ISY device. """
_attrs = {} _attrs = {}
_onattrs = [] _onattrs = []
@ -142,7 +145,7 @@ class ISYDeviceABC(ToggleEntity):
@property @property
def value(self): def value(self):
""" returns the unclean value from the controller """ """ Returns the unclean value from the controller. """
# pylint: disable=protected-access # pylint: disable=protected-access
return self.node.status._val return self.node.status._val
@ -156,7 +159,7 @@ class ISYDeviceABC(ToggleEntity):
@property @property
def unique_id(self): def unique_id(self):
""" Returns the id of this isy sensor """ """ Returns the id of this ISY sensor. """
# pylint: disable=protected-access # pylint: disable=protected-access
return self.node._id return self.node._id
@ -199,7 +202,7 @@ class ISYDeviceABC(ToggleEntity):
return self.value return self.value
def turn_on(self, **kwargs): def turn_on(self, **kwargs):
""" turns the device on """ """ Turns the device on. """
if self.domain is not 'sensor': if self.domain is not 'sensor':
attrs = [kwargs.get(name) for name in self._onattrs] attrs = [kwargs.get(name) for name in self._onattrs]
self.node.on(*attrs) self.node.on(*attrs)
@ -207,7 +210,7 @@ class ISYDeviceABC(ToggleEntity):
_LOGGER.error('ISY cannot turn on sensors.') _LOGGER.error('ISY cannot turn on sensors.')
def turn_off(self, **kwargs): def turn_off(self, **kwargs):
""" turns the device off """ """ Turns the device off. """
if self.domain is not 'sensor': if self.domain is not 'sensor':
self.node.off() self.node.off()
else: else:

View File

@ -1,5 +1,5 @@
""" """
homeassistant.keyboard homeassistant.components.keyboard
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to emulate keyboard presses on host machine. Provides functionality to emulate keyboard presses on host machine.

View File

@ -1,8 +1,8 @@
""" """
homeassistant.components.logbook homeassistant.components.logbook
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Parses events and generates a human log Parses events and generates a human log.
""" """
from itertools import groupby from itertools import groupby

View File

@ -1,9 +1,12 @@
""" """
components.modbus homeassistant.components.modbus
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modbus component, using pymodbus (python3 branch) Modbus component, using pymodbus (python3 branch)
typical declaration in configuration.yaml Configuration:
To use the Modbus component you will need to add something like the following
to your config/configuration.yaml
#Modbus TCP #Modbus TCP
modbus: modbus:
@ -27,10 +30,8 @@ import logging
from homeassistant.const import (EVENT_HOMEASSISTANT_START, from homeassistant.const import (EVENT_HOMEASSISTANT_START,
EVENT_HOMEASSISTANT_STOP) EVENT_HOMEASSISTANT_STOP)
# The domain of your component. Should be equal to the name of your component
DOMAIN = "modbus" DOMAIN = "modbus"
# List of component names (string) your component depends upon
DEPENDENCIES = [] DEPENDENCIES = []
# Type of network # Type of network
@ -86,11 +87,11 @@ def setup(hass, config):
return False return False
def stop_modbus(event): def stop_modbus(event):
""" Stop Modbus service""" """ Stop Modbus service. """
NETWORK.close() NETWORK.close()
def start_modbus(event): def start_modbus(event):
""" Start Modbus service""" """ Start Modbus service. """
NETWORK.connect() NETWORK.connect()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_modbus) hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_modbus)

View File

@ -1,5 +1,24 @@
""" """
homeassistant.components.notify.pushbullet
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PushBullet platform for notify component. PushBullet platform for notify component.
Configuration:
To use the PushBullet notifier you will need to add something like the
following to your config/configuration.yaml
notify:
platform: pushbullet
api_key: YOUR_API_KEY
Variables:
api_key
*Required
Enter the API key for PushBullet. Go to https://www.pushbullet.com/ to retrieve
your API key.
""" """
import logging import logging

View File

@ -1,4 +1,7 @@
""" """
homeassistant.components.notify.pushover
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pushover platform for notify component. Pushover platform for notify component.
Configuration: Configuration:
@ -11,7 +14,7 @@ notify:
api_key: ABCDEFGHJKLMNOPQRSTUVXYZ api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
user_key: ABCDEFGHJKLMNOPQRSTUVXYZ user_key: ABCDEFGHJKLMNOPQRSTUVXYZ
VARIABLES: Variables:
api_key api_key
*Required *Required

View File

@ -15,7 +15,7 @@ notify:
password: YOUR_JABBER_ACCOUNT_PASSWORD password: YOUR_JABBER_ACCOUNT_PASSWORD
recipient: YOUR_RECIPIENT recipient: YOUR_RECIPIENT
VARIABLES: Variables:
sender sender
*Required *Required
@ -110,7 +110,7 @@ class SendNotificationBot(sleekxmpp.ClientXMPP):
self.use_tls = True self.use_tls = True
self.use_ipv6 = False self.use_ipv6 = False
self.add_event_handler("failed_auth", self.check_credentials) self.add_event_handler('failed_auth', self.check_credentials)
self.add_event_handler('session_start', self.start) self.add_event_handler('session_start', self.start)
self.connect() self.connect()
self.process(block=False) self.process(block=False)

View File

@ -8,12 +8,12 @@ It will read a json object from schedule.json in the config dir
and create a schedule based on it. and create a schedule based on it.
Each schedule is a JSON with the keys id, name, description, Each schedule is a JSON with the keys id, name, description,
entity_ids, and events. entity_ids, and events.
- days is an array with the weekday number (monday=0) that the schdule - days is an array with the weekday number (monday=0) that the schedule
is active is active
- entity_ids an array with entity ids that the events in the schedule should - entity_ids an array with entity ids that the events in the schedule should
effect (can also be groups) effect (can also be groups)
- events is an array of objects that describe the different events that is - events is an array of objects that describe the different events that is
supported. Read in the events descriptions for more information supported. Read in the events descriptions for more information.
""" """
import logging import logging
import json import json
@ -22,7 +22,6 @@ from homeassistant import bootstrap
from homeassistant.loader import get_component from homeassistant.loader import get_component
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.const import ATTR_ENTITY_ID
# The domain of your component. Should be equal to the name of your component
DOMAIN = 'scheduler' DOMAIN = 'scheduler'
DEPENDENCIES = [] DEPENDENCIES = []
@ -33,10 +32,10 @@ _SCHEDULE_FILE = 'schedule.json'
def setup(hass, config): def setup(hass, config):
""" Create the schedules """ """ Create the schedules. """
def setup_listener(schedule, event_data): def setup_listener(schedule, event_data):
""" Creates the event listener based on event_data """ """ Creates the event listener based on event_data. """
event_type = event_data['type'] event_type = event_data['type']
component = event_type component = event_type
@ -52,7 +51,7 @@ def setup(hass, config):
event_data) event_data)
def setup_schedule(schedule_data): def setup_schedule(schedule_data):
""" setup a schedule based on the description """ """ Setup a schedule based on the description. """
schedule = Schedule(schedule_data['id'], schedule = Schedule(schedule_data['id'],
name=schedule_data['name'], name=schedule_data['name'],
@ -97,17 +96,17 @@ class Schedule(object):
self.__event_listeners = [] self.__event_listeners = []
def add_event_listener(self, event_listener): def add_event_listener(self, event_listener):
""" Add a event to the schedule """ """ Add a event to the schedule. """
self.__event_listeners.append(event_listener) self.__event_listeners.append(event_listener)
def schedule(self, hass): def schedule(self, hass):
""" Schedule all the events in the schdule """ """ Schedule all the events in the schedule. """
for event in self.__event_listeners: for event in self.__event_listeners:
event.schedule(hass) event.schedule(hass)
class EventListener(object): class EventListener(object):
""" The base EventListner class that the schedule uses """ """ The base EventListener class that the schedule uses. """
def __init__(self, schedule): def __init__(self, schedule):
self.my_schedule = schedule self.my_schedule = schedule
@ -122,7 +121,7 @@ class EventListener(object):
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class ServiceEventListener(EventListener): class ServiceEventListener(EventListener):
""" A EventListner that calls a service when executed """ """ A EventListener that calls a service when executed. """
def __init__(self, schdule, service): def __init__(self, schdule, service):
EventListener.__init__(self, schdule) EventListener.__init__(self, schdule)
@ -130,7 +129,7 @@ class ServiceEventListener(EventListener):
(self.domain, self.service) = service.split('.') (self.domain, self.service) = service.split('.')
def execute(self, hass): def execute(self, hass):
""" Call the service """ """ Call the service. """
data = {ATTR_ENTITY_ID: self.my_schedule.entity_ids} data = {ATTR_ENTITY_ID: self.my_schedule.entity_ids}
hass.call_service(self.domain, self.service, data) hass.call_service(self.domain, self.service, data)

View File

@ -22,7 +22,7 @@ _LOGGER = logging.getLogger(__name__)
def create_event_listener(schedule, event_listener_data): def create_event_listener(schedule, event_listener_data):
""" Create a TimeEvent based on the description """ """ Create a TimeEvent based on the description. """
service = event_listener_data['service'] service = event_listener_data['service']
(hour, minute, second) = [int(x) for x in (hour, minute, second) = [int(x) for x in
@ -33,7 +33,7 @@ def create_event_listener(schedule, event_listener_data):
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class TimeEventListener(ServiceEventListener): class TimeEventListener(ServiceEventListener):
""" The time event that the scheduler uses """ """ The time event that the scheduler uses. """
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__(self, schedule, service, hour, minute, second): def __init__(self, schedule, service, hour, minute, second):
@ -44,7 +44,7 @@ class TimeEventListener(ServiceEventListener):
self.second = second self.second = second
def schedule(self, hass): def schedule(self, hass):
""" Schedule this event so that it will be called """ """ Schedule this event so that it will be called. """
next_time = datetime.now().replace(hour=self.hour, next_time = datetime.now().replace(hour=self.hour,
minute=self.minute, minute=self.minute,

View File

@ -1,8 +1,11 @@
""" Support for ISY994 sensors. """ """
# system imports homeassistant.components.sensor.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for ISY994 sensors.
"""
import logging import logging
# homeassistant imports
from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING, from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING,
HIDDEN_STRING) HIDDEN_STRING)
from homeassistant.const import (STATE_OPEN, STATE_CLOSED, STATE_HOME, from homeassistant.const import (STATE_OPEN, STATE_CLOSED, STATE_HOME,
@ -24,7 +27,7 @@ DEFAULT_HIDDEN_WEATHER = ['Temperature_High', 'Temperature_Low', 'Feels_Like',
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the isy994 platform. """ """ Sets up the ISY994 platform. """
# pylint: disable=protected-access # pylint: disable=protected-access
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
devs = [] devs = []
@ -81,7 +84,7 @@ class WeatherPseudoNode(object):
class ISYSensorDevice(ISYDeviceABC): class ISYSensorDevice(ISYDeviceABC):
""" represents a isy sensor within home assistant. """ """ Represents a ISY sensor. """
_domain = 'sensor' _domain = 'sensor'

View File

@ -1,13 +1,23 @@
""" """
homeassistant.components.sensor.mysensors homeassistant.components.sensor.mysensors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MySensors sensors. Support for MySensors sensors.
Config: Configuration:
sensor:
- platform: mysensors To use the MySensors sensor you will need to add something like the
port: '/dev/ttyACM0' following to your config/configuration.yaml
sensor:
platform: mysensors
port: '/dev/ttyACM0'
Variables:
port
*Required
Port of your connection to your MySensors device.
""" """
import logging import logging

View File

@ -1,6 +1,6 @@
""" """
homeassistant.components.sensor.sabnzbd homeassistant.components.sensor.sabnzbd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors SABnzbd NZB client API Monitors SABnzbd NZB client API
@ -22,14 +22,12 @@ sensor:
- type: 'disk_size' - type: 'disk_size'
- type: 'disk_free' - type: 'disk_free'
VARIABLES: Variables:
base_url base_url
*Required *Required
This is the base URL of your SABnzbd instance including the port number if not This is the base URL of your SABnzbd instance including the port number if not
running on 80 running on 80. Example: http://192.168.1.32:8124/
Example: http://192.168.1.32:8124/
name name
*Optional *Optional
@ -44,9 +42,7 @@ These are the variables for the monitored_variables array:
type type
*Required *Required
The variable you wish to monitor, see the configuration example above for a The variable you wish to monitor, see the configuration example above for a
list of all available variables list of all available variables.
""" """
from homeassistant.util import Throttle from homeassistant.util import Throttle
@ -75,7 +71,7 @@ _THROTTLED_REFRESH = None
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the sensors """ """ Sets up the sensors. """
api_key = config.get("api_key") api_key = config.get("api_key")
base_url = config.get("base_url") base_url = config.get("base_url")
name = config.get("name", "SABnzbd") name = config.get("name", "SABnzbd")

View File

@ -1,9 +1,46 @@
""" """
homeassistant.components.sensor.systemmonitor homeassistant.components.sensor.systemmonitor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows system monitor values such as: disk, memory and processor use Shows system monitor values such as: disk, memory and processor use
Configuration:
To use the System monitor sensor you will need to add something like the
following to your config/configuration.yaml
sensor:
platform: systemmonitor
resources:
- type: 'disk_use_percent'
arg: '/'
- type: 'disk_use'
arg: '/home'
- type: 'disk_free'
arg: '/'
- type: 'memory_use_percent'
- type: 'memory_use'
- type: 'memory_free'
- type: 'processor_use'
- type: 'process'
arg: 'octave-cli'
Variables:
resources
*Required
An array specifying the variables to monitor.
These are the variables for the resources array:
type
*Required
The variable you wish to monitor, see the configuration example above for a
sample list of variables.
arg
*Optional
Additional details for the type, eg. path, binary name, etc.
""" """
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
@ -28,7 +65,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the sensors """ """ Sets up the sensors. """
dev = [] dev = []
for resource in config['resources']: for resource in config['resources']:
@ -43,7 +80,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class SystemMonitorSensor(Entity): class SystemMonitorSensor(Entity):
""" A system monitor sensor """ """ A system monitor sensor. """
def __init__(self, sensor_type, argument=''): def __init__(self, sensor_type, argument=''):
self._name = SENSOR_TYPES[sensor_type][0] + ' ' + argument self._name = SENSOR_TYPES[sensor_type][0] + ' ' + argument

View File

@ -1,6 +1,6 @@
""" """
homeassistant.components.sensor.transmission homeassistant.components.sensor.transmission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors Transmission BitTorrent client API Monitors Transmission BitTorrent client API
@ -21,17 +21,15 @@ sensor:
- type: 'download_speed' - type: 'download_speed'
- type: 'upload_speed' - type: 'upload_speed'
VARIABLES: Variables:
host host
*Required *Required
This is the IP address of your Transmission Daemon This is the IP address of your Transmission daemon. Example: 192.168.1.32
Example: 192.168.1.32
port port
*Optional *Optional
The port your Transmission daemon uses, defaults to 9091 The port your Transmission daemon uses, defaults to 9091. Example: 8080
Example: 8080
username username
*Required *Required
@ -43,7 +41,7 @@ Your Transmission password
name name
*Optional *Optional
The name to use when displaying this Transmission instance The name to use when displaying this Transmission instance.
monitored_variables monitored_variables
*Required *Required
@ -54,9 +52,7 @@ These are the variables for the monitored_variables array:
type type
*Required *Required
The variable you wish to monitor, see the configuration example above for a The variable you wish to monitor, see the configuration example above for a
list of all available variables list of all available variables.
""" """
from homeassistant.util import Throttle from homeassistant.util import Throttle
@ -84,7 +80,7 @@ _THROTTLED_REFRESH = None
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the sensors """ """ Sets up the sensors. """
host = config.get(CONF_HOST) host = config.get(CONF_HOST)
username = config.get(CONF_USERNAME, None) username = config.get(CONF_USERNAME, None)
password = config.get(CONF_PASSWORD, None) password = config.get(CONF_PASSWORD, None)
@ -123,7 +119,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class TransmissionSensor(Entity): class TransmissionSensor(Entity):
""" A Transmission sensor """ """ A Transmission sensor. """
def __init__(self, sensor_type, transmission_client, client_name): def __init__(self, sensor_type, transmission_client, client_name):
self._name = SENSOR_TYPES[sensor_type][0] self._name = SENSOR_TYPES[sensor_type][0]
@ -158,7 +154,7 @@ class TransmissionSensor(Entity):
) )
def update(self): def update(self):
""" Gets the latest from Transmission and updates the state. """ """ Gets the latest data from Transmission and updates the state. """
self.refresh_transmission_data() self.refresh_transmission_data()
if self.type == 'current_status': if self.type == 'current_status':
if self.transmission_client.session: if self.transmission_client.session:

View File

@ -1,7 +1,11 @@
""" """
homeassistant.components.sensor.vera
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Vera sensors. Support for Vera sensors.
Configuration: Configuration:
To use the Vera sensors you will need to add something like the following to To use the Vera sensors you will need to add something like the following to
your config/configuration.yaml your config/configuration.yaml
@ -15,7 +19,7 @@ sensor:
13: 13:
name: Another sensor name: Another sensor
VARIABLES: Variables:
vera_controller_url vera_controller_url
*Required *Required
@ -96,12 +100,12 @@ def get_devices(hass, config):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Performs setup for Vera controller devices """ """ Performs setup for Vera controller devices. """
add_devices(get_devices(hass, config)) add_devices(get_devices(hass, config))
class VeraSensor(Entity): class VeraSensor(Entity):
""" Represents a Vera Sensor """ """ Represents a Vera Sensor. """
def __init__(self, vera_device, extra_data=None): def __init__(self, vera_device, extra_data=None):
self.vera_device = vera_device self.vera_device = vera_device

View File

@ -20,7 +20,7 @@ DEPENDENCIES = ['group', 'device_tracker', 'light']
CONF_KNOWN_LIGHT = "known_light" CONF_KNOWN_LIGHT = "known_light"
# Attribute to tell which light has to flash whem an unknown person comes home # Attribute to tell which light has to flash whem an unknown person comes home
# If ommitted will flash all. # If omitted will flash all.
CONF_UNKNOWN_LIGHT = "unknown_light" CONF_UNKNOWN_LIGHT = "unknown_light"
# Services to test the alarms # Services to test the alarms

View File

@ -1,8 +1,11 @@
""" Support for ISY994 switch. """ """
# system imports homeassistant.components.switch.isy994
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for ISY994 switches.
"""
import logging import logging
# homeassistant imports
from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING, from homeassistant.components.isy994 import (ISY, ISYDeviceABC, SENSOR_STRING,
HIDDEN_STRING) HIDDEN_STRING)
from homeassistant.const import STATE_ON, STATE_OFF # STATE_OPEN, STATE_CLOSED from homeassistant.const import STATE_ON, STATE_OFF # STATE_OPEN, STATE_CLOSED
@ -12,7 +15,7 @@ from homeassistant.const import STATE_ON, STATE_OFF # STATE_OPEN, STATE_CLOSED
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the isy994 platform. """ """ Sets up the ISY994 platform. """
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
devs = [] devs = []
@ -54,7 +57,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ISYSwitchDevice(ISYDeviceABC): class ISYSwitchDevice(ISYDeviceABC):
""" represents as isy light within home assistant. """ """ Represents as ISY light. """
_domain = 'switch' _domain = 'switch'
_dtype = 'binary' _dtype = 'binary'
@ -62,7 +65,7 @@ class ISYSwitchDevice(ISYDeviceABC):
class ISYProgramDevice(ISYSwitchDevice): class ISYProgramDevice(ISYSwitchDevice):
""" represents a door that can be manipulated within home assistant. """ """ Represents a door that can be manipulated. """
_domain = 'switch' _domain = 'switch'
_dtype = 'binary' _dtype = 'binary'
@ -74,9 +77,9 @@ class ISYProgramDevice(ISYSwitchDevice):
self.action_node = actions self.action_node = actions
def turn_on(self, **kwargs): def turn_on(self, **kwargs):
""" turns the device on/closes the device """ """ Turns the device on/closes the device. """
self.action_node.runThen() self.action_node.runThen()
def turn_off(self, **kwargs): def turn_off(self, **kwargs):
""" turns the device off/opens the device """ """ Turns the device off/opens the device. """
self.action_node.runElse() self.action_node.runElse()

View File

@ -1,4 +1,7 @@
""" """
homeassistant.components.switch.modbus
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Modbus switches. Support for Modbus switches.
Configuration: Configuration:
@ -53,7 +56,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ModbusSwitch(ToggleEntity): class ModbusSwitch(ToggleEntity):
""" Represents a Modbus Switch """ """ Represents a Modbus switch. """
def __init__(self, name, slave, register, bit): def __init__(self, name, slave, register, bit):
self._name = name self._name = name

View File

@ -1,4 +1,9 @@
""" Support for Tellstick switches. """ """
homeassistant.components.switch.tellstick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Tellstick switches.
"""
import logging import logging
@ -9,7 +14,7 @@ import tellcore.constants as tellcore_constants
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None): def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return tellstick switches. """ """ Find and return Tellstick switches. """
try: try:
import tellcore.telldus as telldus import tellcore.telldus as telldus
except ImportError: except ImportError:
@ -30,7 +35,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
class TellstickSwitchDevice(ToggleEntity): class TellstickSwitchDevice(ToggleEntity):
""" represents a Tellstick switch within home assistant. """ """ Represents a Tellstick switch within Home Assistant. """
last_sent_command_mask = (tellcore_constants.TELLSTICK_TURNON | last_sent_command_mask = (tellcore_constants.TELLSTICK_TURNON |
tellcore_constants.TELLSTICK_TURNOFF) tellcore_constants.TELLSTICK_TURNOFF)

View File

@ -1,4 +1,9 @@
""" Support for WeMo switchces. """ """
homeassistant.components.switch.wemo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for WeMo switches.
"""
import logging import logging
from homeassistant.helpers.entity import ToggleEntity from homeassistant.helpers.entity import ToggleEntity
@ -8,7 +13,7 @@ from homeassistant.components.switch import (
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None): def setup_platform(hass, config, add_devices_callback, discovery_info=None):
""" Find and return wemo switches. """ """ Find and return WeMo switches. """
try: try:
# pylint: disable=no-name-in-module, import-error # pylint: disable=no-name-in-module, import-error
import homeassistant.external.pywemo.pywemo as pywemo import homeassistant.external.pywemo.pywemo as pywemo
@ -39,7 +44,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
class WemoSwitch(ToggleEntity): class WemoSwitch(ToggleEntity):
""" represents a WeMo switch within home assistant. """ """ Represents a WeMo switch within Home Assistant. """
def __init__(self, wemo): def __init__(self, wemo):
self.wemo = wemo self.wemo = wemo
@ -78,5 +83,5 @@ class WemoSwitch(ToggleEntity):
self.wemo.off() self.wemo.off()
def update(self): def update(self):
""" Update Wemo state. """ """ Update WeMo state. """
self.wemo.get_state(True) self.wemo.get_state(True)

View File

@ -1,4 +1,9 @@
""" Support for WeMo switchces. """ """
homeassistant.components.switch.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Wink switches.
"""
import logging import logging
# pylint: disable=no-name-in-module, import-error # pylint: disable=no-name-in-module, import-error

View File

@ -1,4 +1,7 @@
""" """
homeassistant.components.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connects to a Wink hub and loads relevant components to control its devices. Connects to a Wink hub and loads relevant components to control its devices.
""" """
import logging import logging
@ -53,14 +56,14 @@ def setup(hass, config):
class WinkToggleDevice(ToggleEntity): class WinkToggleDevice(ToggleEntity):
""" represents a Wink switch within home assistant. """ """ Represents a Wink switch within Home Assistant. """
def __init__(self, wink): def __init__(self, wink):
self.wink = wink self.wink = wink
@property @property
def unique_id(self): def unique_id(self):
""" Returns the id of this WeMo switch """ """ Returns the id of this Wink switch. """
return "{}.{}".format(self.__class__, self.wink.deviceId()) return "{}.{}".format(self.__class__, self.wink.deviceId())
@property @property