cgtobi 2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd30889bad5adc9a4fd60059d05ba5a7.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2cc53cbe6954f940062b18ae34b05621.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00

41 lines
1.1 KiB
Python

"""Support for Rain Bird Irrigation system LNK WiFi Module."""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (CONF_HOST, CONF_PASSWORD)
_LOGGER = logging.getLogger(__name__)
DATA_RAINBIRD = 'rainbird'
DOMAIN = 'rainbird'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config):
"""Set up the Rain Bird component."""
conf = config[DOMAIN]
server = conf.get(CONF_HOST)
password = conf.get(CONF_PASSWORD)
from pyrainbird import RainbirdController
controller = RainbirdController()
controller.setConfig(server, password)
_LOGGER.debug("Rain Bird Controller set to: %s", server)
initial_status = controller.currentIrrigation()
if initial_status == -1:
_LOGGER.error("Error getting state. Possible configuration issues")
return False
hass.data[DATA_RAINBIRD] = controller
return True