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