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:
1 parent
8fc27cbe43
commit
e8c6e4d561
28 files changed
+232
-228
No files matched your search
@@ -16,14 +16,16 @@ import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_RESOURCE = 'https://openexchangerates.org/api/latest.json'
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = 'https://openexchangerates.org/api/latest.json'
|
||||
|
||||
CONF_BASE = 'base'
|
||||
CONF_QUOTE = 'quote'
|
||||
|
||||
DEFAULT_NAME = 'Exchange Rate Sensor'
|
||||
DEFAULT_BASE = 'USD'
|
||||
DEFAULT_NAME = 'Exchange Rate Sensor'
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(hours=2)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_API_KEY): cv.string,
|
||||
@@ -32,9 +34,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||
})
|
||||
|
||||
# Return cached results if last scan was less then this time ago.
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(hours=2)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup the Open Exchange Rates sensor."""
|
||||
|
||||
Reference in new issue
Block a user