diff --git a/.gitignore b/.gitignore index da8d1e2..c6f9a44 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ - .vscode/settings.json diff --git a/custom_components/garbage_collection/config_flow.py b/custom_components/garbage_collection/config_flow.py index e8813fd..7d6fa96 100644 --- a/custom_components/garbage_collection/config_flow.py +++ b/custom_components/garbage_collection/config_flow.py @@ -832,17 +832,18 @@ async def _show_final_form(self, user_input): ] = vol.In(COUNTRY_CODES) data_schema[ vol.Optional( - CONF_PROV, default=self.config_entry.options.get(CONF_PROV, ""), + CONF_PROV, default=self.config_entry.options.get(CONF_PROV, "") ) ] = str data_schema[ vol.Optional( - CONF_STATE, default=self.config_entry.options.get(CONF_STATE, ""), + CONF_STATE, default=self.config_entry.options.get(CONF_STATE, "") ) ] = str data_schema[ vol.Optional( - CONF_OBSERVED, default=self.config_entry.options.get(CONF_OBSERVED, True), + CONF_OBSERVED, + default=self.config_entry.options.get(CONF_OBSERVED, True), ) ] = bool return self.async_show_form( diff --git a/custom_components/garbage_collection/manifest.json b/custom_components/garbage_collection/manifest.json index 7354161..1eba3f1 100644 --- a/custom_components/garbage_collection/manifest.json +++ b/custom_components/garbage_collection/manifest.json @@ -9,8 +9,8 @@ ], "requirements": [ "datetime", - "integrationhelper", - "holidays", + "integrationhelper>=0.2.2", + "holidays>=0.10.1", "typing", "uuid", "voluptuous" diff --git a/custom_components/garbage_collection/sensor.py b/custom_components/garbage_collection/sensor.py index aecfe04..4eac7d2 100644 --- a/custom_components/garbage_collection/sensor.py +++ b/custom_components/garbage_collection/sensor.py @@ -151,23 +151,21 @@ def __init__(self, hass, config): state = config.get(CONF_STATE) observed = config.get(CONF_OBSERVED, True) _LOGGER.debug( - "(%s) Country Holidays with parameters: prov: %s, state: %s, observed: %s", + "(%s) Country Holidays with parameters: country: %s, prov: %s, state: %s, observed: %s", self.__name, + country_holidays, prov, state, - observed + observed, ) kwargs = {"years": years} if state is not None and state != "": kwargs["state"] = state if prov is not None and prov != "": kwargs["prov"] = prov - if observed is not None: + if observed is not None and type(observed) == bool and observed == False: kwargs["observed"] = observed - hol = holidays.CountryHoliday( - country_holidays, - **kwargs - ).items() + hol = holidays.CountryHoliday(country_holidays, **kwargs).items() try: for date, name in hol: if date >= today: