franc6 / ics_calendar

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

update: XXXX: Failed to parse ICS! #48

Closed gieljnssns closed 2 years ago

gieljnssns commented 2 years ago

I used to use the icalevent parser, now trying the tie parser for this config

- platform: ics_calendar
  calendars:
    - name: "RAFC2"
      # parser: icalevents
      days: 5
      url: "https://www.voetbalkrant.com/soccer/calendar/team/team_2_nl.ics"

It is giving me this error

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.ics_calendar.calendar
Source: custom_components/ics_calendar/parsers/parser_rie.py:56
Integration: ics_calendar (documentation, issues)
First occurred: 19:04:12 (1 occurrences)
Last logged: 19:04:12

update: RAFC2: Failed to parse ICS!
Traceback (most recent call last):
  File "/config/custom_components/ics_calendar/calendar.py", line 196, in update
    self.event = self.parser.get_current_event(
  File "/config/custom_components/ics_calendar/parsers/parser_rie.py", line 56, in get_current_event
    for event in rie.of(calendar).between(now, end):
  File "/usr/local/lib/python3.9/site-packages/recurring_ical_events.py", line 468, in of
    a_calendar = x_wr_timezone.to_standard(a_calendar)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 149, in to_standard
    return walker.walk(calendar)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 64, in walk
    subcomponent = self.walk_event(subcomponent)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 74, in walk_event
    attributes[name] = self.walk_value(value)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 85, in walk_value
    return walk(value)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 103, in walk_value_vDDDTypes
    dt = self.walk_value(value.dt)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 85, in walk_value
    return walk(value)
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 126, in walk_value_datetime
    if self.is_UTC(dt):
  File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 114, in is_UTC
    return dt.tzname().upper() == "UTC"
AttributeError: 'NoneType' object has no attribute 'upper'
franc6 commented 2 years ago

I reported this problem to the developer of the problem components the other day. For now, either stick with 2.7 (which won’t work after updating HA to 2022.4), or use ics. :(

If I don’t see a fix soon, I can apply a work-around.

Oh, and if you’re really ambitious, you can apply the work-around, too. When the calendar data is downloaded, the code replaces all NULL characters, you need to also have it remove the line that starts with “X-WR-TIMEZONE”. It’s a bit of a sledge-hammer approach but will avoid the bug, at the cost of treating events the same way icalevents would have. :)

-- Preserve wildlife -- pickle a squirrel!

On Apr 2, 2022, at 1:10 PM, Giel Janssens @.***> wrote:

 I used to use the icalevent parser, now trying the tie parser for this config

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.ics_calendar.calendar Source: custom_components/ics_calendar/parsers/parser_rie.py:56 Integration: ics_calendar (documentation, issues) First occurred: 19:04:12 (1 occurrences) Last logged: 19:04:12

update: RAFC2: Failed to parse ICS! Traceback (most recent call last): File "/config/custom_components/ics_calendar/calendar.py", line 196, in update self.event = self.parser.get_current_event( File "/config/custom_components/ics_calendar/parsers/parser_rie.py", line 56, in get_current_event for event in rie.of(calendar).between(now, end): File "/usr/local/lib/python3.9/site-packages/recurring_ical_events.py", line 468, in of a_calendar = x_wr_timezone.to_standard(a_calendar) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 149, in to_standard return walker.walk(calendar) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 64, in walk subcomponent = self.walk_event(subcomponent) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 74, in walk_event attributes[name] = self.walk_value(value) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 85, in walk_value return walk(value) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 103, in walk_value_vDDDTypes dt = self.walk_value(value.dt) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 85, in walk_value return walk(value) File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 126, in walk_value_datetime if self.is_UTC(dt): File "/usr/local/lib/python3.9/site-packages/x_wr_timezone.py", line 114, in is_UTC return dt.tzname().upper() == "UTC" AttributeError: 'NoneType' object has no attribute 'upper'

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.