allenporter/ical

Update documentation for event.attendees

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.
I am currently working to add attendees to the Home Assistant local_calendar component but I'm having trouble working with attendees and there's a lack of documentation/examples both official and unofficial.

Describe the solution you'd like
Add more documentation or examples in the ical/tests directory.

Describe alternatives you've considered
I've searched the internet and cant's seem to locate examples of anyone using the library in the way I'm trying to use it.

Additional context
Doing some testing...

attendee_item = CalAddress(value="mailto:johndoe@mail.com")
attendees_list = [attendee_item]
event[EVENT_ATTENDEES] = attendees_list
....
try:
        return Event(**event)
    except CalendarParseError as err:
        _LOGGER.debug("Error parsing event input fields: %s (%s)", event, str(err))
        raise vol.Invalid("Error parsing event input fields") from err

2024-07-14 11:29:28.441 ERROR (MainThread) [homeassistant.components.websocket_api.messages] Unable to serialize to JSON. Bad data found at $.event.c.calendar.family_calendar.+.a.attendees[0]=uri='mailto:johndoe@mail.com' common_name=None user_type=None delegator=None delegate=None directory_entry=None member=None status=None role=None rsvp=None sent_by=None language=None(<class 'ical.types.cal_address.CalAddress'>

My tests have resulted in either the library accepting/parsing the data but then Home Assistant complaining it's not JSON serializable or if I try to serialize to JSON first, the library will not accept/parse the data.

My question is, how can I get the data parsed by ical as JSON serializable? Thanks!

I'm pretty sure you wrote the local_calendar component but I want to clarify this is in local_calendar>calendar.py>_parse_event. I've already done work in the frontend to load the Person[] from HA and will pass that data to local_calendar once I figure out how to parse the attendees.

image

The goal is to make HA a replacement for family calendar services such as Cozi, Family Wall, etc.

You're posting issues here specific to the home assistant code base, so this is not the right place for that. If you have an issue with the ical library, you'll need to express the issue in terms of ical APIs and exceptions only. For example run the tests tests/test_calendar.py and modify one to add an attendee and verify the response you expect or not.

If you need support with home assistant development there is a discord where you can create a support thread.

I appreciate the response. I thought I was using attendees incorrectly. I will try to find and join the HA dev discord and go from there. Thanks!

The issue was on my end and is now corrected. Sorry for the trouble.