mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 10:08:23 +00:00
PIP8 Fixes
PIP8 Fixes
This commit is contained in:
parent
88098283c7
commit
e548bd5312
@ -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 = ''
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
STATE_VAR = 'rainbird.activestation'
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
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,11 +28,11 @@ def setup(hass, config):
|
||||
def startirrigation(call):
|
||||
station_id = call.data.get('station')
|
||||
duration = call.data.get('duration')
|
||||
_LOGGER.info("Requesting irrigation for " +\
|
||||
_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)+\
|
||||
_LOGGER.info("Irrigation started on " + str(station_id) +
|
||||
" for " + str(duration))
|
||||
elif (result == 0):
|
||||
_LOGGER.error("Error sending request")
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user