franc6 / ics_calendar

Provides an ICS (icalendar) platform for the Home Assistant calendar
Apache License 2.0
146 stars 22 forks source link

Added calendar stopped to work with 500 error but works after HA restart #172

Open vrtareg opened 1 week ago

vrtareg commented 1 week ago

Home Assistant Setup Please indicate your version of HA and how it is installed.

Version: 2024.9. 3

Installation Type (put an X between the square brackets for your HA): [] Home Assistant OS [] Home Assistant OS [] Home Assistant Supervised [] Home Assistant Container [x] Home Assistant Core

Hardware platform: [] ARM [x] x86-64

Describe the bug A clear and concise description of the bug

I am running HA core in TrueNAS FreeBSD Jail with Python 3.12.

All working as expected and I was able to get HACS working with at least 4 other modules.

I added 6 ics calendars from different sources but I am facing intermittent problems with random calendars. They are just stopping to work until HA restart.

Same calender works on mobile and other places without issues.

No Authentication to calendar link.

Error is:

2024-09-27 01:48:55.100 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/venv/lib/python3.12/site-packages/homeassistant/components/calendar/__init__.py", line 648, in get
    calendar_event_list = await entity.async_get_events(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/data/custom_components/ics_calendar/calendar.py", line 205, in async_get_events
    return await self.data.async_get_events(hass, start_date, end_date)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/HomeAssistant/data/custom_components/ics_calendar/calendar.py", line 319, in async_get_events
    print("Adding prefix to summary 1")
OSError: [Errno 5] Input/output error
franc6 commented 1 week ago

Thanks for the report. The last error in your list is due to me leaving some temp code in place (calendar.py, line 319).

This is probably worth making a new release for, especially with another fix waiting. If I can get to it this weekend, I will. If not, it’ll likely be November before I can make a new release, as the end of this month and October are booked pretty solid.

For now, you could probably just delete that line, as that should resolve the problem for you.

JackPoint commented 5 days ago

For me, it doesn't start with version 5.0.3 so I switched back to 5.0.2, that one worked for me.