From 39485e75838659c6cff3675d975d13828bbea9d7 Mon Sep 17 00:00:00 2001 From: Gustav Ahlberg Date: Tue, 3 Feb 2015 20:18:19 +0100 Subject: [PATCH] Fixed pylint errors --- .../components/scheduler/__init__.py | 9 +++--- homeassistant/components/sun.py | 32 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/homeassistant/components/scheduler/__init__.py b/homeassistant/components/scheduler/__init__.py index d77b3e916b0..120f90b6ccf 100644 --- a/homeassistant/components/scheduler/__init__.py +++ b/homeassistant/components/scheduler/__init__.py @@ -32,7 +32,6 @@ _LOGGER = logging.getLogger(__name__) _SCHEDULE_FILE = 'schedule.json' -# pylint: disable=unused-argument def setup(hass, config): """ Create the schedules """ @@ -40,11 +39,13 @@ def setup(hass, config): return True def setup_listener(schedule, event_data): + """ Creates the event listener based on event_data """ event_type = event_data['type'] - component = type + component = event_type - if event_type in ('time'): - component = 'scheduler.{}'.format(type) + # if the event isn't part of a component + if event_type in ['time']: + component = 'scheduler.{}'.format(event_type) elif component not in hass.components and \ not bootstrap.setup_component(hass, component, config): diff --git a/homeassistant/components/sun.py b/homeassistant/components/sun.py index e12b4b2037b..456ec7e385b 100644 --- a/homeassistant/components/sun.py +++ b/homeassistant/components/sun.py @@ -3,6 +3,23 @@ homeassistant.components.sun ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Provides functionality to keep track of the sun. + + +Event listener +-------------- +The suns event listener will call the service +when the sun rises or sets with an offset. +The sun evnt need to have the type 'sun', which service to call, +which event (sunset or sunrise) and the offset. + +{ + "type": "sun", + "service": "switch.turn_on", + "event": "sunset", + "offset": "-01:00:00" +} + + """ import logging from datetime import datetime, timedelta @@ -142,21 +159,6 @@ def setup(hass, config): return True -""" -An event in the scheduler component that will call the service -when the sun rises or sets with an offset. -The sun evnt need to have the type 'sun', which service to call, -which event (sunset or sunrise) and the offset. - -{ - "type": "sun", - "service": "switch.turn_on", - "event": "sunset", - "offset": "-01:00:00" -} - -""" - def create_event_listener(schedule, event_listener_data): """ Create a sun event listener based on the description. """