PIP8 Fixes

PIP8 Fixes
This commit is contained in:
jbarrancos 2017-08-24 22:49:54 +02:00 committed by GitHub
parent 88098283c7
commit e548bd5312

View File

@ -1,6 +1,4 @@
import homeassistant.loader as loader
import homeassistant.helpers as helpers
from homeassistant.helpers.entity import Entity
import logging
@ -8,21 +6,17 @@ REQUIREMENTS = ['pyrainbird==0.0.7']
# Home Assistant Setup
DOMAIN = 'rainbird'
SERVER = ''
PASSWORD = ''
STATE_VAR = 'rainbird.activestation'
_LOGGER = logging.getLogger(__name__)
STATE_VAR='rainbird.activestation'
def setup(hass, config):
server = config[DOMAIN].get('stickip')
password = config[DOMAIN].get('password')
totalstations= config[DOMAIN].get('totalstations')
# RainbirdSetup
from pyrainbird import RainbirdController
@ -34,12 +28,12 @@ def setup(hass, config):
def startirrigation(call):
station_id = call.data.get('station')
duration = call.data.get('duration')
_LOGGER.info("Requesting irrigation for " +\
str(station_id) + " duration " + str(duration))
_LOGGER.info("Requesting irrigation for " +
str(station_id) + " duration " + str(duration))
result = controller.startIrrigation(station_id, duration)
if (result == 1):
_LOGGER.info("Irrigation started on "+str(station_id)+\
" for " + str(duration))
_LOGGER.info("Irrigation started on " + str(station_id) +
" for " + str(duration))
elif (result == 0):
_LOGGER.error("Error sending request")
else:
@ -70,11 +64,11 @@ def setup(hass, config):
hass.services.register(DOMAIN, 'start_irrigation', startirrigation)
hass.services.register(DOMAIN, 'stop_irrigation', stopirrigation)
helpers.event.track_time_change(hass, \
lambda _: hass.states.set(STATE_VAR, getirrigation()), \
year=None, month=None, day=None, hour=None, minute=None, second=[00,30])
helpers.event.track_time_change(
hass, lambda _: hass.states.set(STATE_VAR, getirrigation()),
year=None, month=None, day=None,
hour=None, minute=None, second=[00, 30]
)
_LOGGER.info("Initialized Rainbird Controller")
return True