bruxy70 / Holidays

📅 Custom Home Assistant integration for public holidays - also used for garbage_collection integration to automatically move scheduled events that fall on a public holiday (by an automation blueprint)
MIT License
45 stars 12 forks source link

Subdivision holiday missing from ignore list #44

Closed amdbuilder closed 1 year ago

amdbuilder commented 1 year ago

Before you submit a new bug report, please check that

Describe the bug

When configuring a helper (Country: US Subdivision: NC) not all of the populated holidays are available to ignore.

I was able to confirm the issue is specific to the subdivision by configuring a second instance without subdivision (blue). The first instance with subdivision adds a "Day After Christmas" holiday. image

This holiday isn't available to exclude when checking the helper settings: image

Configuration

Unable to download diagnostic as something "when wrong" when attempting.  

Home Assistant 2022.12.8
Supervisor 2022.11.2
Operating System 9.4
Frontend 20221213.1 - lates

Holidays version 1.9.2 (just installed)

Debug logs

Error is likely related to attempts to download diagnostic data instead of the reported issue.

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/holidays/diagnostics.py:21
Integration: Holidays (documentation, issues)
First occurred: 5:35:58 PM (12 occurrences)
Last logged: 5:39:13 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, 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 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 222, 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 81, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 211, in get
    data = await info[d_type.value](hass, config_entry)
  File "/config/custom_components/holidays/diagnostics.py", line 18, in async_get_config_entry_diagnostics
    entity_data = [
  File "/config/custom_components/holidays/diagnostics.py", line 21, in <listcomp>
    if entities[entity].unique_id == entry.data["unique_id"]
KeyError: 'unique_id'
bruxy70 commented 1 year ago

I think it was because it overlaps with the observed Christmas Day. The holidays normally show up twice for the observed holidays, and I ignore the ones that are observed, otherwise they will be twice. Anyhow, trying something else - compiling the pop list with observed set to false. Hopefully that will work.

amdbuilder commented 1 year ago

The latest update resolves the problem. Thank you for the quick fix!