Cannot make service "calendar/get_events" working in AppDaemon (although works via Developer Tools)

Dear Community Members,

I would appreciate any hint helping me to solve below issue. I would like to read calendar entries via AppDaemon and for the first test I tried the following way (with “hardcoded” range of dates):

dane_z_kalendarza = self.call_service ("calendar/get_events",
                                            entity_id = "calendar.kalendarz_rafala",
                                            start_date_time = "2024-02-01 00:00:00",
                                            end_date_time = "2024-02-01 00:00:00")

However it results in the following error message in the log:

2024-02-03 02:04:34.702782 WARNING HASS: Error calling Home Assistant service default/calendar/get_events
2024-02-03 02:04:34.703424 WARNING HASS: Code: 500, error: 500 Internal Server Error

On the other hand, when testing service calendar.get_events with Developer Tools (using exactly same input data), it works as expected:

What I am doing wrong? Can anyone share their working examples which could help me to solve the issue?

Thanks in advance!

When AD is started after HA, depending on if the HA API is available at the time AD starts, it might not have the service available right away. If you’re dealing with a service that is responsible for returning a result, you may want to look at this Github issue.

1 Like

Thank you so much @proggie for directing me to above Github issue! Somehow I did not come across it, when looking for solution before.
I will try to apply the workaround described there.
Thanks again!

1 Like