Closed b3nn0 closed 1 year ago
Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (local_calendar
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
local_calendar documentation local_calendar source (message by IssueLinks)
That's weird, the dtend value doesn't match the Ics file...TY
Thank you for the excellent and detailed report. I am not able to reproduce this with the .ics
file given. I tried the following:
ical
library which has ics files it can test with
And the result is i was not able to reproduce this.The odd thing here is that the line:
DTEND:20221215T090000
is getting parsed as a date. However, that clearly is a datetime. The code to get to a datetime from a date is fairly simple, so having trouble seeing how this can happen.
This has me worried something else is going on here that we can't see.
Questions/Thoughts:
ha core rebuild
help?configuration.yaml
:logger:
default: info
logs:
ical.component: debug
ical.parsing: debug
Thanks!
Hi, other custom components: nothing that is calendar related. The only thing calendar related is the official CalDav integration, fetching data from a Nextcloud instance. Active custom components: HACS, Solaredge Modbus, Pyscript , Deutscher Wetterdienst, Bosch Indego Mower, OCPP and Nuki Lock.
ha core rebuild:
I think it already rebuilt this morning, when installing 2022.12.7. Just tried a ha core rebuild
again, but the problem persists.
debug logs: Enabled them, and there is at least a little bit more output:
2022-12-18 16:26:58.546 DEBUG (MainThread) [ical.component] Parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-18 16:26:58.546 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-18 16:26:58.546 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}
2022-12-18 16:26:58.547 DEBUG (MainThread) [ical.component] Unable to parse property value: Expected value to match DATE pattern: '20221215T090000'
2022-12-18 16:26:58.587 INFO (SyncWorker_5) [homeassistant.loader] Loaded weather from homeassistant.components.weather
2022-12-18 16:26:58.586 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up local_calendar platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 46, in async_setup_entry
calendar = IcsCalendarStream.calendar_from_ics(ics)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 69, in calendar_from_ics
stream = cls.from_ics(content)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 56, in from_ics
return cls.parse_obj(result)
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for IcsCalendarStream
vcalendar -> 0 -> vevent -> 0 -> __root__
Unexpected dtstart value '2022-12-15 07:45:00' was datetime but dtend value '2022-12-15' was not datetime (type=value_error)
Thanks, this was helpful. The order of log messages is different when I run this. I think this may have to do with the order we attempt to parse date values.
I don't have this line when i run this in debug mode:
2022-12-18 16:26:58.547 DEBUG (MainThread) [ical.component] Unable to parse property value: Expected value to match DATE pattern: '20221215T090000'
I think this is because when i run it, its attempting to match as a DATE-TIME
first. Either way it is supposed to try both and fall back to the other, so this shouldn't matter, but i think it may have something to do with it.
Let me know if I should temporarily put a few logging-statements somewhere or something to help narrow it down - it does look strange indeed (would need to know the full path inside the home assistant container though - not really familiar with the internal structure).
I figured out the issue. The root cause is how ical
is using get_args
. From https://docs.python.org/3/library/typing.html#typing.get_args
If X is a union or Literal contained in another generic type, the order of (Y, Z, ...) may be different from the order of the original arguments [Y, Z, ...] due to type caching.
I think the type Union[datetime.datetime, datetime.date, None]
was getting parsed as a None
type rather than first getting parsed as a datetime or date. I was able to reproduce this by shuffling the return values of get_args
and the tests started to get flaky. I've got a fix incoming...
Not sure if my testing is valid or not. If it is not, please ignore and I'll patiently wait for the next release.
Because of impatience, I tried to use your changes in my existing HA, since from what I could see, all relevant changes were in the ical libray. What I did: docker exec -it homeassistant bash
However, the calender still wouldn't load with the same errors in the log:
2022-12-20 10:55:51.059 DEBUG (MainThread) [ical.component] Parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-20 10:55:51.060 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-20 10:55:51.060 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}
2022-12-20 10:55:51.065 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up local_calendar platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 46, in async_setup_entry
calendar = IcsCalendarStream.calendar_from_ics(ics)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 69, in calendar_from_ics
stream = cls.from_ics(content)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 56, in from_ics
return cls.parse_obj(result)
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for IcsCalendarStream
vcalendar -> 0 -> vevent -> 0 -> __root__
Unexpected dtstart value '2022-12-15 07:45:00' was datetime but dtend value '2022-12-15' was not datetime (type=value_error)
@b3nn0 Oh boy.... I thought I had found the most obscure cause for this, now i'm utterly confused.
How this is supposed to work is that it gets the list of possible value type to attempt to parse. The field_types list for dtend
should contain a datetime parser and a date parser, and it should try the datetime parser first, then it should succeed.
Somewhere this is getting confused and thinking that it should be using the date parser.
@classmethod
def _parse_property(cls, field_types: list[type], prop: ParsedProperty) -> Any:
"""Parse an individual field value from a ParsedProperty as the specified types."""
errors = []
for sub_type in field_types:
try:
return cls._parse_single_property(sub_type, prop)
except ValueError as err:
_LOGGER.debug("Unable to parse property value: %s", err)
errors.append(str(err))
continue
raise ValueError(f"Failed to validate: {prop.value}, errors: ({errors})")
I think what we need to know is what is happening in this function... Before it would log Unable to parse property value:
which was my hint that it was running in the wrong order and parsing it as a NoneType, but now I realize that doesn't explain why it thinks it can parse it as a date. There are also a couple paths in _parse_single_property
but those should be straight forward since there is no VALUE param.... Not sure where to go here except adding even more debugging.
@b3nn0 i just released 4.2.6 https://github.com/allenporter/ical/releases/tag/4.2.6 if you want to try again with that.
Looks like at least that part is doing what it should...?
2022-12-21 07:40:14.217 INFO (MainThread) [homeassistant.components.calendar] Setting up calendar.local_calendar
2022-12-21 07:40:14.275 INFO (SyncWorker_0) [homeassistant.loader] Loaded notify from homeassistant.components.notify
2022-12-21 07:40:14.826 DEBUG (MainThread) [ical.component] Parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-21 07:40:14.827 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Parsing field 'dtstamp' with value '20221215T071856' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Decoding 'dtstamp' as type '<class 'datetime.datetime'>'
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Parsing field 'uid' with value 'bc8435e4-7c48-11ed-929a-525400dbc44c' as types [<class 'str'>]
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Decoding 'uid' as type '<class 'str'>'
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Parsing field 'dtstart' with value '20221215T074500' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Decoding 'dtstart' as type '<class 'datetime.datetime'>'
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Parsing field 'dtend' with value '20221215T090000' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:40:14.828 DEBUG (MainThread) [ical.component] Decoding 'dtend' as type '<class 'datetime.datetime'>'
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Parsing field 'summary' with value 'Wecker Adrian' as types [<class 'str'>]
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Decoding 'summary' as type '<class 'str'>'
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Parsing field 'created' with value '20221215T071856' as types [<class 'datetime.datetime'>]
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Decoding 'created' as type '<class 'datetime.datetime'>'
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Parsing field 'description' with value '' as types [<class 'str'>]
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Decoding 'description' as type '<class 'str'>'
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Parsing field 'rrule' with value 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR' as types [<class 'ical.types.recur.Recur'>]
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Decoding 'rrule' as type '<class 'ical.types.recur.Recur'>'
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Parsing field 'sequence' with value '0' as types [<class 'int'>]
2022-12-21 07:40:14.829 DEBUG (MainThread) [ical.component] Decoding 'sequence' as type '<class 'int'>'
2022-12-21 07:40:14.849 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.hue
2022-12-21 07:40:14.860 INFO (MainThread) [homeassistant.components.light] Setting up light.hue
2022-12-21 07:40:14.862 INFO (MainThread) [homeassistant.components.scene] Setting up scene.hue
2022-12-21 07:40:14.868 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hue
2022-12-21 07:40:14.871 INFO (MainThread) [homeassistant.components.switch] Setting up switch.hue
2022-12-21 07:40:14.893 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up local_calendar platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 46, in async_setup_entry
calendar = IcsCalendarStream.calendar_from_ics(ics)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 69, in calendar_from_ics
stream = cls.from_ics(content)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 56, in from_ics
return cls.parse_obj(result)
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for IcsCalendarStream
vcalendar -> 0 -> vevent -> 0 -> __root__
Unexpected dtstart value '2022-12-15 07:45:00' was datetime but dtend value '2022-12-15' was not datetime (type=value_error)
EDIT: Oh wait, in docker logs there is more than in the web interface:
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
BEGIN:VCALENDAR
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['BEGIN', [], ':', 'VCALENDAR']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
BEGIN:VEVENT
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['BEGIN', [], ':', 'VEVENT']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTSTAMP:20221215T071856
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTSTAMP', [], ':', '20221215T071856']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
UID:bc8435e4-7c48-11ed-929a-525400dbc44c
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['UID', [], ':', 'bc8435e4-7c48-11ed-929a-525400dbc44c']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTSTART:20221215T074500
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTSTART', [], ':', '20221215T074500']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTEND:20221215T090000
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTEND', [], ':', '20221215T090000']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
SUMMARY:Wecker Adrian
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['SUMMARY', [], ':', 'Wecker Adrian']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
CREATED:20221215T071856
^
Agreed, looks like it's correctly being treated as a datetime. Can you also turn up debug log for ical.types.date_time
and ical.types.date
?
Also seems fine... (?)
2022-12-21 07:55:51.021 DEBUG (MainThread) [ical.component] Parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-21 07:55:51.021 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-21 07:55:51.021 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}
2022-12-21 07:55:51.022 DEBUG (MainThread) [ical.component] Parsing field 'dtstamp' with value '20221215T071856' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:55:51.022 DEBUG (MainThread) [ical.component] Decoding 'dtstamp' as type '<class 'datetime.datetime'>'
2022-12-21 07:55:51.022 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:18:56
2022-12-21 07:55:51.023 DEBUG (MainThread) [ical.component] Parsing field 'uid' with value 'bc8435e4-7c48-11ed-929a-525400dbc44c' as types [<class 'str'>]
2022-12-21 07:55:51.023 DEBUG (MainThread) [ical.component] Decoding 'uid' as type '<class 'str'>'
2022-12-21 07:55:51.023 DEBUG (MainThread) [ical.component] Parsing field 'dtstart' with value '20221215T074500' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:55:51.023 DEBUG (MainThread) [ical.component] Decoding 'dtstart' as type '<class 'datetime.datetime'>'
2022-12-21 07:55:51.023 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:45:00
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Parsing field 'dtend' with value '20221215T090000' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Decoding 'dtend' as type '<class 'datetime.datetime'>'
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 09:00:00
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Parsing field 'summary' with value 'Wecker Adrian' as types [<class 'str'>]
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Decoding 'summary' as type '<class 'str'>'
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Parsing field 'created' with value '20221215T071856' as types [<class 'datetime.datetime'>]
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Decoding 'created' as type '<class 'datetime.datetime'>'
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:18:56
2022-12-21 07:55:51.024 DEBUG (MainThread) [ical.component] Parsing field 'description' with value '' as types [<class 'str'>]
2022-12-21 07:55:51.026 DEBUG (MainThread) [ical.component] Decoding 'description' as type '<class 'str'>'
2022-12-21 07:55:51.026 DEBUG (MainThread) [ical.component] Parsing field 'rrule' with value 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR' as types [<class 'ical.types.recur.Recur'>]
2022-12-21 07:55:51.026 DEBUG (MainThread) [ical.component] Decoding 'rrule' as type '<class 'ical.types.recur.Recur'>'
2022-12-21 07:55:51.026 DEBUG (MainThread) [ical.component] Parsing field 'sequence' with value '0' as types [<class 'int'>]
2022-12-21 07:55:51.026 DEBUG (MainThread) [ical.component] Decoding 'sequence' as type '<class 'int'>'
2022-12-21 07:55:51.027 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.forecast_solar
2022-12-21 07:55:51.027 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.forecast_solar
2022-12-21 07:55:51.027 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.forecast_solar
2022-12-21 07:55:51.035 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up local_calendar platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 46, in async_setup_entry
calendar = IcsCalendarStream.calendar_from_ics(ics)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 69, in calendar_from_ics
stream = cls.from_ics(content)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 56, in from_ics
return cls.parse_obj(result)
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for IcsCalendarStream
vcalendar -> 0 -> vevent -> 0 -> __root__
Unexpected dtstart value '2022-12-15 07:45:00' was datetime but dtend value '2022-12-15' was not datetime (type=value_error)
Thank you. This is really helpful to have you able to try this....
I've added some additional debug logging and kicked off 4.2.7 building: https://github.com/allenporter/ical/releases/tag/4.2.7
Additional relevant components for logging are ical.calendar_stream
, ical.event
Guess it's lost somewhere in there..
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
BEGIN:VCALENDAR
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['BEGIN', [], ':', 'VCALENDAR']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
BEGIN:VEVENT
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['BEGIN', [], ':', 'VEVENT']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTSTAMP:20221215T071856
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTSTAMP', [], ':', '20221215T071856']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
UID:bc8435e4-7c48-11ed-929a-525400dbc44c
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['UID', [], ':', 'bc8435e4-7c48-11ed-929a-525400dbc44c']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTSTART:20221215T074500
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTSTART', [], ':', '20221215T074500']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
DTEND:20221215T090000
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['DTEND', [], ':', '20221215T090000']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
SUMMARY:Wecker Adrian
^
Matched {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} -> ['SUMMARY', [], ':', 'Wecker Adrian']
Match {{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} Group:([{';' Group:({{W:(-0-9A-Za-z) ^ Combine:({'X-' [{W:(0-9A-Za-z) '-'}]... 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' '0123456789' '-'})} '=' {W:( !#-+--9<-~...) ^ string enclosed in '"'} [{',' {W:( !#-+--9<-~...) ^ string enclosed in '"'}}]...})}]...) ':' [W:( -οΏΏπππ
°π
±π
Ύπ
Ώππ-...)]} at loc 0(1,1)
CREATED:20221215T071856
^
2022-12-21 08:46:58.058 INFO (SyncWorker_8) [homeassistant.components.fritzbox_callmonitor.base] Fritz!Box phone book successfully updated
2022-12-21 08:46:58.060 DEBUG (MainThread) [ical.calendar_stream] Parsing object {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-21 08:46:58.061 DEBUG (MainThread) [ical.component] Parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-21 08:46:58.062 DEBUG (MainThread) [ical.component] Completed parsing value data {'vcalendar': [{'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}]}
2022-12-21 08:46:58.063 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-21 08:46:58.063 DEBUG (MainThread) [ical.component] Completed parsing value data {'name': 'vcalendar', 'vevent': [{'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}]}
2022-12-21 08:46:58.063 DEBUG (MainThread) [ical.component] Parsing value data {'name': 'vevent', 'dtstamp': [ParsedProperty(name='dtstamp', value='20221215T071856', params=None)], 'uid': [ParsedProperty(name='uid', value='bc8435e4-7c48-11ed-929a-525400dbc44c', params=None)], 'dtstart': [ParsedProperty(name='dtstart', value='20221215T074500', params=None)], 'dtend': [ParsedProperty(name='dtend', value='20221215T090000', params=None)], 'summary': [ParsedProperty(name='summary', value='Wecker Adrian', params=None)], 'created': [ParsedProperty(name='created', value='20221215T071856', params=None)], 'description': [ParsedProperty(name='description', value='', params=None)], 'rrule': [ParsedProperty(name='rrule', value='FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR', params=None)], 'sequence': [ParsedProperty(name='sequence', value='0', params=None)]}
2022-12-21 08:46:58.064 DEBUG (MainThread) [ical.component] Parsing field 'dtstamp' with value '20221215T071856' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 08:46:58.064 DEBUG (MainThread) [ical.component] Decoding 'dtstamp' as type '<class 'datetime.datetime'>'
2022-12-21 08:46:58.064 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:18:56
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Parsing field 'uid' with value 'bc8435e4-7c48-11ed-929a-525400dbc44c' as types [<class 'str'>]
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Decoding 'uid' as type '<class 'str'>'
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Parsing field 'dtstart' with value '20221215T074500' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Decoding 'dtstart' as type '<class 'datetime.datetime'>'
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:45:00
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Parsing field 'dtend' with value '20221215T090000' as types [<class 'datetime.datetime'>, <class 'datetime.date'>]
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Decoding 'dtend' as type '<class 'datetime.datetime'>'
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 09:00:00
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Parsing field 'summary' with value 'Wecker Adrian' as types [<class 'str'>]
2022-12-21 08:46:58.065 DEBUG (MainThread) [ical.component] Decoding 'summary' as type '<class 'str'>'
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Parsing field 'created' with value '20221215T071856' as types [<class 'datetime.datetime'>]
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Decoding 'created' as type '<class 'datetime.datetime'>'
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.types.date_time] DateTimeEncoder returned 2022-12-15 07:18:56
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Parsing field 'description' with value '' as types [<class 'str'>]
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Decoding 'description' as type '<class 'str'>'
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Parsing field 'rrule' with value 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR' as types [<class 'ical.types.recur.Recur'>]
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Decoding 'rrule' as type '<class 'ical.types.recur.Recur'>'
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Parsing field 'sequence' with value '0' as types [<class 'int'>]
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Decoding 'sequence' as type '<class 'int'>'
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.component] Completed parsing value data {'name': 'vevent', 'dtstamp': datetime.datetime(2022, 12, 15, 7, 18, 56), 'uid': 'bc8435e4-7c48-11ed-929a-525400dbc44c', 'dtstart': datetime.datetime(2022, 12, 15, 7, 45), 'dtend': datetime.datetime(2022, 12, 15, 9, 0), 'summary': 'Wecker Adrian', 'created': datetime.datetime(2022, 12, 15, 7, 18, 56), 'description': '', 'rrule': {'freq': 'WEEKLY', 'byday': [{'weekday': 'MO'}, {'weekday': 'TU'}, {'weekday': 'WE'}, {'weekday': 'TH'}, {'weekday': 'FR'}]}, 'sequence': 0}
2022-12-21 08:46:58.066 DEBUG (MainThread) [ical.event] Found initial values dtstart=2022-12-15 07:45:00, dtend=2022-12-15 09:00:00
2022-12-21 08:46:58.067 DEBUG (MainThread) [ical.event] Unexpected data types for values: {'dtstamp': datetime.datetime(2022, 12, 15, 7, 18, 56), 'uid': 'bc8435e4-7c48-11ed-929a-525400dbc44c', 'dtstart': datetime.datetime(2022, 12, 15, 7, 45), 'dtend': datetime.date(2022, 12, 15), 'duration': None, 'summary': 'Wecker Adrian', 'attendees': [], 'categories': [], 'classification': None, 'comment': [], 'contacts': [], 'created': datetime.datetime(2022, 12, 15, 7, 18, 56), 'description': '', 'geo': None, 'last_modified': None, 'location': None, 'organizer': None, 'priority': None, 'recurrence_id': None, 'related': [], 'resources': [], 'rrule': Recur(freq=<Frequency.WEEKLY: 'WEEKLY'>, until=None, count=None, interval=1, by_weekday=[WeekdayValue(weekday=<Weekday.MONDAY: 'MO'>, occurrence=None), WeekdayValue(weekday=<Weekday.TUESDAY: 'TU'>, occurrence=None), WeekdayValue(weekday=<Weekday.WEDNESDAY: 'WE'>, occurrence=None), WeekdayValue(weekday=<Weekday.THURSDAY: 'TH'>, occurrence=None), WeekdayValue(weekday=<Weekday.FRIDAY: 'FR'>, occurrence=None)], by_month_day=[], by_month=[]), 'rdate': [], 'exdate': [], 'request_status': None, 'sequence': 0, 'status': None, 'transparency': None, 'url': None, 'extras': [], 'alarm': []}
2022-12-21 08:46:58.085 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up local_calendar platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/local_calendar/calendar.py", line 46, in async_setup_entry
calendar = IcsCalendarStream.calendar_from_ics(ics)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 74, in calendar_from_ics
stream = cls.from_ics(content)
File "/usr/local/lib/python3.10/site-packages/ical/calendar_stream.py", line 61, in from_ics
return cls.parse_obj(result)
File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 342, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for IcsCalendarStream
vcalendar -> 0 -> vevent -> 0 -> __root__
Unexpected dtstart value '2022-12-15 07:45:00' was datetime but dtend value '2022-12-15' was not datetime (type=value_error)
Thanks. So it's between the "pre" validator and "post" validator.... Somewhere in pydantic or in another validator.
Can you confirm what version of the pip module pydantic is installed in the docker container?
bash-5.1# pip show pydantic
Name: pydantic
Version: 1.10.2
Summary: Data validation and settings management using python type hints
Home-page: https://github.com/pydantic/pydantic
Author: Samuel Colvin
Author-email: s@muelcolvin.com
License: MIT
Location: /usr/local/lib/python3.10/site-packages
Requires: typing-extensions
Required-by: aiolivisi, aioopenexchangerates, demetriek, elgato, gcal-sync, ical, intellifire4py, lacrosse-view, open-meteo, peco, pvo, pyaussiebb, python-bsblan, python-kasa, pytraccar, pyunifiprotect, radios, systembridgeconnector, tailscale, vehicle, withings-api, xbox-webapi, yolink-api, zwave-js-server-python
It looks like pydantic has the same issue where it assumes the order of args for a union is deterministic. (the documentation states that it is making this assumption which seems incorrect). I'll start looking for workarounds and let them know if i figure out something.
@b3nn0 is there anything in particular about the machine type I can know to try to reproduce this? e.g. arm, etc I'm still not really able to myself.
@b3nn0 I've released 4.2.8
with a change to pydantic behavior if you want to give that fix a try https://github.com/allenporter/ical/releases/tag/4.2.8
@b3nn0 is there anything in particular about the machine type I can know to try to reproduce this? e.g. arm, etc I'm still not really able to myself.
Nothing special: It's a x86_64 qemu VM running via libvirtd on debian bullseye on a Celeron N5095 (nas box)
@b3nn0 I've released 4.2.8 with a change to pydantic behavior if you want to give that fix a try
Nice! It works!
@b3nn0 I can't thank you enough for rolling out the dev builds and testing -- this is invaluable for an issue i can't reproduce myself. I think this must just have something to do with the way dependencies are loaded based on whatever python modules are installed, and not any particular architecture. Thanks.
The problem
Hi, already found the other validation error that should have been fixed by https://github.com/home-assistant/core/pull/84104 However, after upgrading to 2022.12.7, my calendar still disappears after a restart.
There is only one entry in the calendar, repeating for ever, with a weekly schedule of Monday to Friday.
Log:
The ICS file that was created in .storage:
What version of Home Assistant Core has the issue?
2022.12.7
What was the last working version of Home Assistant Core?
none
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Local Calendar
Link to integration documentation on our website
https://www.home-assistant.io/integrations/local_calendar/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response