Appdaemon Google Calendar integration

I have had a HA setup working for about 6 months, and just started creating an Appdaemon setup. I really like it and the layouts it creates on a tablet.

Unfortunately I have a hard time getting from what I would do in HA to Appdaemon.

I just added the Google Calendar integration into HA…and I am completely stumped as to how to add a simple upcoming tasks or similar widget to Appdaemon.

I have looked at Rene Tode’s google-calendar-app (last updated 4 years ago) but I am not sure if the settings are the same.
Such as… client_secret_file: calendar_client_secret.json

Calendar works in HA , just need it to show events in Appdaemon

Thanks

I am not familiar with the Google Calendar integration but… if it allows you to interact with it using sensor (or the like) entities and services to make changes, then you can manipulate it through AD. You can read entity state using get_state() and make calls to the integration services using call_service().

Sorry to revive, but did you ever figure this out @youbecha?

I’ve been trying, but keep running into trouble. In UI (dev tools, services), this works:

service: calendar.list_events
data:
  duration:
    hours: 1
    minutes: 0
    seconds: 0
target:
  entity_id: calendar.mycalendar

and returns a list of events with dates (start, end) and the name of the event (summary).

But this in AppDaemon:

test = self.call_service('calendar/list_events', entity_id='calendar.mycalendar', duration={'hours':1, 'minutes':1, 'seconds':1})
self.log(test)

Results in:

2023-12-29 16:12:23.689329 WARNING HASS: Error calling Home Assistant service default/calendar/list_events
2023-12-29 16:12:23.690255 WARNING HASS: Code: 500, error: 500 Internal Server Error

I also tried a different format that works in UI but not in AppDaemon:

This works in UI
service: calendar.list_events
data:
  start_date_time: "2023-12-29 00:00:00"
  end_date_time: "2023-12-29 01:00:00"
target:
  entity_id: calendar.my_calendar
AppDaemon, this doesn't
test = self.call_service('calendar/list_events', entity_id='calendar.my_calendar', start_date_time="2023-12-29 00:00:00", end_date_time="2023-12-29 01:00:00")
I'm pretty sure the above is the correct AppDaemon format, but I also tried this
 data = {
            "start_date_time": "2023-12-29 00:00:00",
            "end_date_time": "2023-12-29 01<sup>Text</sup>:00:00"
        }
test = self.call_service('calendar/list_events', entity_id='calendar.my_calendar', data=data)