Clean-up, ordering, constants, and extend of schema (#2903)

* Clean-up, ordering, constants, and extend of schema

* Put REQUIREMENTS back and re-add line breaks

* Clean-up, ordering, constants, and extend of schema

* Extend platform
This commit is contained in:
Fabian Affolter 2016-08-21 00:40:16 +02:00 committed by Paulus Schoutsen
parent 8fc27cbe43
commit e8c6e4d561
28 changed files with 232 additions and 228 deletions

View file

@ -18,9 +18,13 @@ from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = 'NZBGet'
DEFAULT_PORT = 6789
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
SENSOR_TYPES = {
'article_cache': ['ArticleCacheMB', 'Article Cache', 'MB'],
'average_download_rate': ['AverageDownloadRate', 'Average Speed', 'MB/s'],
@ -39,15 +43,10 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.All(cv.ensure_list, [vol.In(SENSOR_TYPES)]),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
vol.Optional(CONF_PASSWORD): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.string,
vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port,
vol.Optional(CONF_USERNAME): cv.string,
})
_LOGGER = logging.getLogger(__name__)
# Return cached results if last scan was less then this time ago.
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
# pylint: disable=unused-argument, too-many-locals
def setup_platform(hass, config, add_devices, discovery_info=None):