core: Platform error binary_sensor.workday
The problem
Just updated from 2022.09.x to 2022.10.4 yesterday. I have morning automation that usually kicks off based on if its a school day or not. Wondered why it did not run this morning.
Receiving Platform error binary_sensor.workday - cannot import name 'DateLike' from 'holidays' (/usr/local/lib/python3.10/site-packages/holidays/__init__.py)
on the YAML > Check & Restart screen.
What version of Home Assistant Core has the issue?
core-2022.10.4
What was the last working version of Home Assistant Core?
2022.09.x
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Workday
Link to integration documentation on our website
https://www.home-assistant.io/integrations/workday/
Diagnostics information
No response
Example YAML snippet
binary_sensor:
��- platform: workday
����name: School Day
����country: CA
# province: ON
# excludes: [sat, sun, holiday] # this is default
����add_holidays:
����� # PA days
������- '2022-09-01'
������- '2022-10-24'
������- '2022-11-18'
������- '2023-02-03'
������- '2023-04-28'
������- '2023-06-12'
����� # xmas break
������- '2022-12-26'
������- '2022-12-27'
������- '2022-12-28'
������- '2022-12-29'
������- '2022-12-30'
������- '2023-01-02'
������- '2023-01-03'
������- '2023-01-04'
������- '2023-01-05'
������- '2023-01-06'
����� # march break
������- '2023-03-10'
������- '2023-03-13'
������- '2023-03-14'
������- '2023-03-15'
������- '2023-03-16'
������- '2023-03-17'
Anything in the logs that might be useful for us?
2022-10-21 09:16:06.380 ERROR (MainThread) [homeassistant.config] Platform error: binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 878, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 722, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 739, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/src/homeassistant/homeassistant/components/workday/binary_sensor.py", line 9, in <module>
from holidays import DateLike, HolidayBase
ImportError: cannot import name 'DateLike' from 'holidays' (/usr/local/lib/python3.10/site-packages/holidays/__init__.py)
Additional information
Even removing my (more advanced) config and replacing it to the simple config like found in documentation:
# Example configuration.yaml entry
binary_sensor:
- platform: workday
country: DE
Also does provides the same outcome.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (1 by maintainers)
It was still an issue using 2023.5.2 and after removing from yaml. I decided to remove - restart- install and now it won’t install and get the following error: AttributeError: ‘CA’ object has no attribute ‘subdivisions’. I tried different countries and still no go.
Full error:
Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 271, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/workday/config_flow.py", line 187, in async_step_user return await self.async_step_options() File "/usr/src/homeassistant/homeassistant/components/workday/config_flow.py", line 233, in async_step_options schema = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/workday/config_flow.py", line 56, in add_province_to_schema if not obj_holidays.subdivisions: AttributeError: 'CA' object has no attribute 'subdivisions'
The same issue here. I have had it running on an existing instance of HA for a couple of years (latest updates applied) without issues but when trying to configure it on 2 new instances of HA I get the following error when trying to Check Configuration:
Configuration Invalid! Platform error binary_sensor.workday - cannot import name 'DateLike' from 'holidays' (/usr/local/lib/python3.10/site-packages/holidays/__init__.py)
Config entry:
I get the error even without specifying the province.
Thanks, AlAiN