diff --git a/homeassistant/components/binary_sensor/workday.py b/homeassistant/components/binary_sensor/workday.py index 3fb2d7f7f86..1d85d9c9a47 100644 --- a/homeassistant/components/binary_sensor/workday.py +++ b/homeassistant/components/binary_sensor/workday.py @@ -15,35 +15,38 @@ from homeassistant.const import CONF_NAME, WEEKDAYS from homeassistant.components.binary_sensor import BinarySensorDevice import homeassistant.helpers.config_validation as cv -_LOGGER = logging.getLogger(__name__) +REQUIREMENTS = ['holidays==0.9.7'] -REQUIREMENTS = ['holidays==0.9.6'] +_LOGGER = logging.getLogger(__name__) # List of all countries currently supported by holidays # There seems to be no way to get the list out at runtime -ALL_COUNTRIES = ['Argentina', 'AR', 'Australia', 'AU', 'Austria', 'AT', - 'Belgium', 'BE', 'Canada', 'CA', 'Colombia', 'CO', 'Czech', - 'CZ', 'Denmark', 'DK', 'England', 'EuropeanCentralBank', - 'ECB', 'TAR', 'Finland', 'FI', 'France', 'FRA', 'Germany', - 'DE', 'Hungary', 'HU', 'India', 'IND', 'Ireland', - 'Isle of Man', 'Italy', 'IT', 'Japan', 'JP', 'Mexico', 'MX', - 'Netherlands', 'NL', 'NewZealand', 'NZ', 'Northern Ireland', - 'Norway', 'NO', 'Polish', 'PL', 'Portugal', 'PT', - 'PortugalExt', 'PTE', 'Scotland', 'Slovenia', 'SI', - 'Slovakia', 'SK', 'South Africa', 'ZA', 'Spain', 'ES', - 'Sweden', 'SE', 'Switzerland', 'CH', 'UnitedKingdom', 'UK', - 'UnitedStates', 'US', 'Wales'] +ALL_COUNTRIES = [ + 'Argentina', 'AR', 'Australia', 'AU', 'Austria', 'AT', 'Belarus', 'BY' + 'Belgium', 'BE', 'Canada', 'CA', 'Colombia', 'CO', 'Czech', 'CZ', + 'Denmark', 'DK', 'England', 'EuropeanCentralBank', 'ECB', 'TAR', + 'Finland', 'FI', 'France', 'FRA', 'Germany', 'DE', 'Hungary', 'HU', + 'India', 'IND', 'Ireland', 'Isle of Man', 'Italy', 'IT', 'Japan', 'JP', + 'Mexico', 'MX', 'Netherlands', 'NL', 'NewZealand', 'NZ', + 'Northern Ireland', 'Norway', 'NO', 'Polish', 'PL', 'Portugal', 'PT', + 'PortugalExt', 'PTE', 'Scotland', 'Slovenia', 'SI', 'Slovakia', 'SK', + 'South Africa', 'ZA', 'Spain', 'ES', 'Sweden', 'SE', 'Switzerland', 'CH', + 'UnitedKingdom', 'UK', 'UnitedStates', 'US', 'Wales', +] + +ALLOWED_DAYS = WEEKDAYS + ['holiday'] + CONF_COUNTRY = 'country' CONF_PROVINCE = 'province' CONF_WORKDAYS = 'workdays' +CONF_EXCLUDES = 'excludes' +CONF_OFFSET = 'days_offset' + # By default, Monday - Friday are workdays DEFAULT_WORKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri'] -CONF_EXCLUDES = 'excludes' # By default, public holidays, Saturdays and Sundays are excluded from workdays DEFAULT_EXCLUDES = ['sat', 'sun', 'holiday'] DEFAULT_NAME = 'Workday Sensor' -ALLOWED_DAYS = WEEKDAYS + ['holiday'] -CONF_OFFSET = 'days_offset' DEFAULT_OFFSET = 0 PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ @@ -86,7 +89,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): else: _LOGGER.error("There is no province/state %s in country %s", province, country) - return False + return _LOGGER.debug("Found the following holidays for your configuration:") for date, name in sorted(obj_holidays.items()): diff --git a/requirements_all.txt b/requirements_all.txt index a13068532ba..4f0ea37f32d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -448,7 +448,7 @@ hipnotify==1.0.8 hole==0.3.0 # homeassistant.components.binary_sensor.workday -holidays==0.9.6 +holidays==0.9.7 # homeassistant.components.frontend home-assistant-frontend==20180912.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e8bdd85a3e5..6268efc664b 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -81,7 +81,7 @@ haversine==0.4.5 hbmqtt==0.9.4 # homeassistant.components.binary_sensor.workday -holidays==0.9.6 +holidays==0.9.7 # homeassistant.components.frontend home-assistant-frontend==20180912.0