Fixed pylint errors
parent
ba7e06072d
commit
39485e7583
|
@ -32,7 +32,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
_SCHEDULE_FILE = 'schedule.json'
|
_SCHEDULE_FILE = 'schedule.json'
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
""" Create the schedules """
|
""" Create the schedules """
|
||||||
|
|
||||||
|
@ -40,11 +39,13 @@ def setup(hass, config):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def setup_listener(schedule, event_data):
|
def setup_listener(schedule, event_data):
|
||||||
|
""" Creates the event listener based on event_data """
|
||||||
event_type = event_data['type']
|
event_type = event_data['type']
|
||||||
component = type
|
component = event_type
|
||||||
|
|
||||||
if event_type in ('time'):
|
# if the event isn't part of a component
|
||||||
component = 'scheduler.{}'.format(type)
|
if event_type in ['time']:
|
||||||
|
component = 'scheduler.{}'.format(event_type)
|
||||||
|
|
||||||
elif component not in hass.components and \
|
elif component not in hass.components and \
|
||||||
not bootstrap.setup_component(hass, component, config):
|
not bootstrap.setup_component(hass, component, config):
|
||||||
|
|
|
@ -3,6 +3,23 @@ homeassistant.components.sun
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Provides functionality to keep track of the 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
|
import logging
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
@ -142,21 +159,6 @@ def setup(hass, config):
|
||||||
|
|
||||||
return True
|
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):
|
def create_event_listener(schedule, event_listener_data):
|
||||||
""" Create a sun event listener based on the description. """
|
""" Create a sun event listener based on the description. """
|
||||||
|
|
Loading…
Reference in New Issue