mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 17:48:26 +00:00
pylint, coverage and requirement fix
pylint, coverage and requirement fix
This commit is contained in:
parent
41a046a69d
commit
7aff588bf0
@ -416,6 +416,7 @@ omit =
|
||||
homeassistant/components/notify/xmpp.py
|
||||
homeassistant/components/nuimo_controller.py
|
||||
homeassistant/components/prometheus.py
|
||||
homeassistant/components/rainbird.py
|
||||
homeassistant/components/remote/harmony.py
|
||||
homeassistant/components/remote/itach.py
|
||||
homeassistant/components/scene/hunterdouglas_powerview.py
|
||||
|
@ -1,6 +1,20 @@
|
||||
import homeassistant.helpers as helpers
|
||||
import logging
|
||||
"""
|
||||
Module for interacting with WiFi LNK module of the Rainbird Irrigation system
|
||||
|
||||
This project has no affiliation with Rainbird. This module works with the
|
||||
Rainbird LNK WiFi Module. For more information see:
|
||||
http://www.rainbird.com/landscape/products/controllers/LNK-WiFi.htm
|
||||
|
||||
This module communicates directly towards the IP Address of the WiFi module it
|
||||
does not support the cloud. You can start/stop the irrigation and get the
|
||||
currenltly active zone.
|
||||
|
||||
I'm not a Python developer, so sorry for the bad code. I've developed it to
|
||||
control it from my domtica systems.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import homeassistant.helpers as helpers
|
||||
|
||||
REQUIREMENTS = ['pyrainbird==0.0.7']
|
||||
|
||||
@ -14,6 +28,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
"""
|
||||
Standard setup function Home Assistant
|
||||
@param hass: default homeassistant hass class
|
||||
@param config: default homeassistant config class
|
||||
"""
|
||||
|
||||
server = config[DOMAIN].get('stickip')
|
||||
password = config[DOMAIN].get('password')
|
||||
@ -26,34 +45,49 @@ def setup(hass, config):
|
||||
_LOGGER.info("Rainbird Controller set to " + str(server))
|
||||
|
||||
def startirrigation(call):
|
||||
"""
|
||||
Start Irrigation command towards Rainbird WiFi LNK stick
|
||||
@param call: should be a home assistant call object with data
|
||||
station for Zone to sprinkle and duration for the time
|
||||
"""
|
||||
|
||||
station_id = call.data.get('station')
|
||||
duration = call.data.get('duration')
|
||||
_LOGGER.info("Requesting irrigation for " +
|
||||
str(station_id) + " duration " + str(duration))
|
||||
result = controller.startIrrigation(station_id, duration)
|
||||
if (result == 1):
|
||||
if result == 1:
|
||||
_LOGGER.info("Irrigation started on " + str(station_id) +
|
||||
" for " + str(duration))
|
||||
elif (result == 0):
|
||||
elif result == 0:
|
||||
_LOGGER.error("Error sending request")
|
||||
else:
|
||||
_LOGGER.error("Request was not acknowledged!")
|
||||
|
||||
def stopirrigation(call):
|
||||
def stopirrigation():
|
||||
"""
|
||||
Stops the irrigation (if one is running)
|
||||
"""
|
||||
|
||||
_LOGGER.info("Stop request irrigation")
|
||||
result = controller.stopIrrigation()
|
||||
if (result == 1):
|
||||
if result == 1:
|
||||
_LOGGER.info("Stopped irrigation")
|
||||
print("Success")
|
||||
elif (result == 0):
|
||||
elif result == 0:
|
||||
_LOGGER.error("Error sending request")
|
||||
else:
|
||||
_LOGGER.error("Request was not acknowledged!")
|
||||
|
||||
def getirrigation():
|
||||
"""
|
||||
Get current active station
|
||||
@return: integer which station is active
|
||||
"""
|
||||
|
||||
_LOGGER.info("Request irrigation state")
|
||||
result = controller.currentIrrigation()
|
||||
if (result < 0):
|
||||
if result < 0:
|
||||
_LOGGER.error("Error sending request")
|
||||
return -1
|
||||
|
||||
|
@ -686,6 +686,9 @@ pyowm==2.7.1
|
||||
# homeassistant.components.qwikswitch
|
||||
pyqwikswitch==0.4
|
||||
|
||||
# homeassistant.components.rainbird
|
||||
pyrainbird==0.0.7
|
||||
|
||||
# homeassistant.components.climate.sensibo
|
||||
pysensibo==1.0.1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user