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
44 stars 11 forks source link

Creating a new "Holidays" helper fails #47

Closed RoisinDubh79 closed 1 year ago

RoisinDubh79 commented 1 year ago

Before you submit a new bug report, please check that

Describe the bug

Holiday calendar has stopped working for me. In an effort to try and resolve the issue, I uninstalled the helper and the integration through HACS. Reinstalled the integration through HACS. Restarted my system and attempted to create the Holidays helper. Each time I attempt to create the helper, I get the "Unknown error occurred" message.

I also get an error if I try to add the Workday binary_sensor to my configuration.yaml file, so this could very well be a container specific problem.

Configuration

I'm running the container version of HA, so getting the config information was a bit of a challenge.
Grabbed the config info from HACS.

{
  "home_assistant": {
    "installation_type": "Home Assistant Container",
    "version": "2023.4.1",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.10.10",
    "docker": true,
    "arch": "aarch64",
    "timezone": "America/Toronto",
    "os_name": "Linux",
    "os_version": "6.1.21-v8+",
    "run_as_root": true
  },
  "custom_components": {
    "hubitat": {
      "version": "0.8.6",
      "requirements": [
        "hubitatmaker>=0.6.1,<0.7.0"
      ]
    },
    "holidays": {
      "version": "1.9.4",
      "requirements": [
        "python-dateutil>=2.8.2",
        "holidays>=0.14.2"
      ]
    },
    "nodered": {
      "version": "1.2.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.31.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "ontario_energy_board": {
      "version": "0.3.2",
      "requirements": [
        "beautifulsoup4==4.10.0",
        "holidays==0.12"
      ]
    }
  },
        "integration_manifest": {
          "domain": "holidays",
          "name": "Holidays",
          "version": "1.0",
          "documentation": "https://github.com/bruxy70/Holidays/",
          "issue_tracker": "https://github.com/bruxy70/Holidays/issues",
          "iot_class": "calculated",
          "integration_type": "helper",
          "dependencies": [],
          "config_flow": true,
          "codeowners": [
            "@bruxy70"
          ],
          "requirements": [
            "python-dateutil>=2.8.2",
            "holidays>=0.14.2"
          ]
        },
        "repository_manifest": {
          "content_in_root": false,
          "country": [],
          "filename": "holidays.zip",
          "hacs": null,
          "hide_default_branch": false,
          "homeassistant": "2022.12.0",
          "manifest": {
            "name": "Holidays",
            "zip_release": true,
            "filename": "holidays.zip",
            "homeassistant": "2022.12.0"
          },
          "name": "Holidays",
          "persistent_directory": null,
          "render_readme": false,
          "zip_release": true
        },
        "ref": "1.9.4",
        "paths": {
          "localpath": "/config/custom_components/holidays",
          "local": "/config/custom_components/holidays",
          "remote": "custom_components/holidays"
        }
      }

Debug logs

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/holidays/config_flow.py:30
Integration: Holidays (documentation, issues)
First occurred: 11:37:25 AM (3 occurrences)
Last logged: 12:40:03 PM

Error handling request
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/helpers/schema_config_entry_flow.py", line 305, in _async_step
    result = await self._common_handler.async_step(step_id, user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 129, in async_step
    return await self._async_form_step(step_id, user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 174, in _async_form_step
    return await self._show_next_step_or_create_entry(form_step)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 184, in _show_next_step_or_create_entry
    next_step_id_or_end_flow = await form_step.next_step(self._options)
  File "/config/custom_components/holidays/config_flow.py", line 30, in choose_second_step
    subdivs = supported_countries[options.get(const.CONF_COUNTRY)]
TypeError: list indices must be integers or slices, not str

2023-04-07 12:56:28.457 ERROR (MainThread) [aiohttp.server] Error handling request
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/helpers/schema_config_entry_flow.py", line 305, in _async_step
    result = await self._common_handler.async_step(step_id, user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 129, in async_step
    return await self._async_form_step(step_id, user_input)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 174, in _async_form_step
    return await self._show_next_step_or_create_entry(form_step)
  File "/usr/src/homeassistant/homeassistant/helpers/schema_config_entry_flow.py", line 184, in _show_next_step_or_create_entry
    next_step_id_or_end_flow = await form_step.next_step(self._options)
  File "/config/custom_components/holidays/config_flow.py", line 30, in choose_second_step
    subdivs = supported_countries[options.get(const.CONF_COUNTRY)]
TypeError: list indices must be integers or slices, not str
RoisinDubh79 commented 1 year ago

As of the 2023.4.4 I am able to create the Holiday Helper. so something they changed resolved the issue in my case.