Adjust vol to accept filenames (fixes #3701) (#3707)

This commit is contained in:
Fabian Affolter 2016-10-05 18:02:45 +02:00 committed by Johann Kellerman
parent 1bc6366051
commit cb3a78b330

View File

@ -36,14 +36,14 @@ TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_ORIGIN): cv.string, vol.Required(CONF_ORIGIN): cv.string,
vol.Required(CONF_DESTINATION): cv.string, vol.Required(CONF_DESTINATION): cv.string,
vol.Required(CONF_DATA): cv.isfile, vol.Required(CONF_DATA): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
}) })
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
def get_next_departure(sched, start_station_id, end_station_id): def get_next_departure(sched, start_station_id, end_station_id):
"""Get the next departure for the given sched.""" """Get the next departure for the given schedule."""
origin_station = sched.stops_by_id(start_station_id)[0] origin_station = sched.stops_by_id(start_station_id)[0]
destination_station = sched.stops_by_id(end_station_id)[0] destination_station = sched.stops_by_id(end_station_id)[0]
@ -147,7 +147,7 @@ def get_next_departure(sched, start_station_id, end_station_id):
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Get the GTFS sensor.""" """Set up the GTFS sensor."""
gtfs_dir = hass.config.path(DEFAULT_PATH) gtfs_dir = hass.config.path(DEFAULT_PATH)
data = config.get(CONF_DATA) data = config.get(CONF_DATA)
origin = config.get(CONF_ORIGIN) origin = config.get(CONF_ORIGIN)