📅 Calendar Add-On + some calendar designs

Thank you for your quick response! Got that fixed, but then got the below error:

Calendar(s) queried at: Fri Mar 03 2023 18:30:00 GMT+0000 (Greenwich Mean Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Fri Mar 03 2023 18:30:00 GMT+0000 (Greenwich Mean Time)
There was an error loading the gcal data: Error: Not Found

So after reviewing instructions found I had not added the service account to access the calender. Checked the instructions, and there does not seem to be a way to add the service account to a google “family” calender.
The is a way to give family members access, but not individuals (which is visible for my own personal account).
Tried to add the service account to the family account - but it needs to be validated - something which I’ve read cannot be done.
Anyone have any sucess in adding a family calender?

Is there a way to get the number of calendar events for “today”? I’ve tried “0” days in the config, but I’m getting this error:

Calendar(s) queried at: Tue Mar 07 2023 14:30:00 GMT+0000 (Greenwich Mean Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Tue Mar 07 2023 14:30:00 GMT+0000 (Greenwich Mean Time)
0 entries found in google calendar

There is an entry for today scheduled, so if it worked would expect it to pull in that entry, as it has done sucessfully for days into the future?

thanks in advance

You can leave the fetchDays parameter set to however much days in the future as you wish, what you should do in this case is use scripting in the card you use to display the calendar.
My add-on gives you the data in all kinds of easy to work with formats, but some knowledge of scripting is required to use the data. Like it says in the add-on docs use either the Home Assistant templating syntax (jinja2) or javascript (in a custom button card) to parse/filter/transform the data.

Got it, thanks Kris!

I can’t find any info if this addon works with build in home assistant local calendar. I already have the local calendar conficured to sync with icloud. Is there a way to configure it to use local data?

- calName: home
  calType: caldav
  username: username
  password: password
  caldavUrl: http://something (only for caldav/baikal)
  calId: googleCalendarId (only for Google Calendar)
  googleServiceAccountKeyfile: yourServiceAccountJsonKeyfile (only for Google Calendar)

What would be the url for local calendar? Struggling to find an example.

Thank you so much for help.

The addon was made before the advent of the local calendar in Home Assistant and is meant as an alternative to the calendar integration. So no, won’t work with a local calendar.

In this thread it is mentioned there is an undocumented api endpoint for the local calendar for which you could set up REST api calls. You could go that route or if you want to use my add-on then follow the docs about apple icloud that are available on the addon’s github repo.

Thank you. I’ll look into it :slight_smile:

In case anyone else is looking for something similiar, this is how I solved it:

 {{ state_attr("sensor.my_calendar", "data") | map(attribute='startDateISO') | map('as_datetime') | select('lt', today_at()+timedelta( hours = 24, minutes = 0 )) | list | count }}

Great addon!

I’m currently using it to parse my calander events for today to display on the dashboard.

This works but is there a more efficient way to do this?

{% set day_sec = 86400 %}
{% set today_start=as_timestamp(today_at().isoformat()) %}
{% set day_end = day_sec +today_start %}
{% for calendar_item in state_attr('sensor.apple_bins_calendar','data') %}
  {% set meeting_start =as_timestamp(calendar_item.startDateISO) %}
  {% if meeting_start >= today_start and meeting_start <= day_end  %}
    ♻️ {{calendar_item.summary}}
  {%endif %}
{% endfor%}

Then to take this further I have several calendars for each member of the family, lets call them sensor.apple_calendar1, sensor.apple_calendar2, sensor.apple_calendar3, sensor.apple_calendar4

What is the most efficient way to loop through all these and then get today’s events in start time order?

Hello everyone,
I have installed “HASS Calendar Addon”, but I can’t see a sensor anywhere, what am I doing wrong.
Can someone help me with this?
Thanks for every response

Hi Bart, I see you have also asked this question in another thread. I will answer here however, because I don’t want to pollute the other thread that’s about more than just my addon.

So after the second fetch run the 401 error is visible in your logs. 401 means ‘unauthorized’, so something is not correct with your login/password or your google service account access.
You have not posted any information about what type of calendar you’re using (caldav or google).
If it’s caldav: review the login/password and the caldav-url options.
If it’s a google calendar: be sure to follow all instructions in the addon documentation about setting up the serviceaccount and also granting it access rights to the calendar.

Hi,

Thank you for your response.

In attachment you see my calendar to test and also my settings.

If I understand you correctly, the add-on will retrieve the data from the calendar every 30 minutes? Is that correct?



After waiting 30 minutes I get this in the log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Hass Calendar Addon
 Addon to consume caldav and google calendars and make calendar events available as sensordata in Home Assistant.
-----------------------------------------------------------
 Add-on version: 0.301
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.0  (amd64 / qemux86-64)
 Home Assistant Core: 2023.4.6
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
added 80 packages, and audited 81 packages in 14s
23 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 9.1.2 -> 9.6.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.5>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
System locale: en-US
Luxon locale set to: nl-BE
System timeZone: Europe/Brussels
Luxon timezone set to: Europe/Brussels
Previously stored events posted to sensor(s) at: Mon Apr 24 2023 10:54:18 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Calendar(s) queried at: Mon Apr 24 2023 11:30:01 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 11:30:01 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
Calendar(s) queried at: Mon Apr 24 2023 12:30:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 12:30:00 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
Calendar(s) queried at: Mon Apr 24 2023 13:30:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 13:30:00 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401

I tried again and now I get the following message in my log!!

Previously stored events posted to sensor(s) at: Mon Apr 24 2023 14:23:11 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Calendar(s) queried at: Mon Apr 24 2023 14:25:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 14:25:00 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 400
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
Calendar(s) queried at: Mon Apr 24 2023 14:30:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 14:30:00 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 400
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
Calendar(s) queried at: Mon Apr 24 2023 14:35:01 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 14:35:01 GMT+0200 (Central European Summer Time)
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 401
axios error: [object Object]Request failed with status code 400

I use iCloud calendar.
If I understand you correctly, error 401 is a login error?
But then what is error 400?

400 is bad request, but concentrate on fixing the authorization issue first. As you’re using iCloud, have you generated an app-specific password as required by Apple? You cannot use the password you login to iCloud for the addon, but need to generate that extra password.

Be sure to read all the info on the 2 pages I link to under ‘Apple icloud caldav’ in the addon docs.

Hello all,

I’m trying to install this for my google calendar but I cannot get it to work. I think I followed all steps but I get this error:

postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading ‘length’)
Events posted to sensor(s) at: Mon Apr 24 2023 16:20:00 GMT+0200 (Central European Summer Time)
There was an error loading the gcal data: Error: Not Found

things I did:

  1. Install the addon
  2. created a service-account and put the json file in the share folder. I did this via uploading the file via “Studio code server” and then moving it via the terminal in HA. I do not have a screen that I can connect to my raspberry so I had to use this workaround to get in the share folder.
  3. filled in the config and started the add-on.

I also search this topic for people that have the same Issue and I found that I had to share my calender to the specific google server mail that I created. I forgot this in the first place but now that i’ve shared it it still doens’t work. I used the private calID btw since this is not a public calendar.

note that I edited the calID and keyfile name on purpose for this printscreen…

Thanks in advance.

Remco

Hi Remco,
I thinkt that calId is wrong. For me that is an e-mail adress, visible under that specific calendar’s settings and not a url. Eg. something like [email protected]

Thanks for your reply.

I’ve copied this link for my calID.

Isn’t this right? Do I perhaps need this one?

Yes you need that second one, that’s labelled ‘agenda-id’, hence the abreviated ‘calId’ name in the addon settings. That other one you used is labelled as a ‘calendar-adress’.

1 Like

As you’re using iCloud, have you generated an app-specific password as required by Apple?
Yes, I did.

Thanks for your response.

But I get constant
axios error: [object Object]Request failed with status code 404
or
axios error: [object Object]Request failed with status code 401

Dear All,
I think it works now, but still no sensor. my-calendar. What am I still doing wrong?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh
-----------------------------------------------------------
 Add-on: Hass Calendar Addon
 Addon to consume caldav and google calendars and make calendar events available as sensordata in Home Assistant.
-----------------------------------------------------------
 Add-on version: 0.301
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.0  (amd64 / qemux86-64)
 Home Assistant Core: 2023.4.6
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
added 80 packages, and audited 81 packages in 13s
23 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
npm notice 
npm notice New minor version of npm available! 9.1.2 -> 9.6.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.6.5>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
System locale: en-US
Luxon locale set to: nl-BE
System timeZone: Europe/Brussels
Luxon timezone set to: Europe/Brussels
Calendar(s) queried at: Mon Apr 24 2023 23:45:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
Events posted to sensor(s) at: Mon Apr 24 2023 23:45:00 GMT+0200 (Central European Summer Time)
4 entries found in caldav calendar
Fetching caldav calendar entry CE07297B-3E5B-4C4C-8CAE-6B87BA5AF659.ics
Fetching caldav calendar entry 3478F43F-9CB3-42E6-82EF-960D788BEF85.ics
Fetching caldav calendar entry E0438C0D-12AD-4827-96B0-84FB5C31BDD8.ics
Fetching caldav calendar entry A8950638-6EF0-419C-B678-A3BE7D98A884.ics
sorting events of calendar: my-calendar
Calendar(s) queried at: Mon Apr 24 2023 23:50:00 GMT+0200 (Central European Summer Time)
postEvents error with: Error: Request failed with status code 500
Events posted to sensor(s) at: Mon Apr 24 2023 23:50:00 GMT+0200 (Central European Summer Time)
4 entries found in caldav calendar
Fetching caldav calendar entry CE07297B-3E5B-4C4C-8CAE-6B87BA5AF659.ics
Fetching caldav calendar entry 3478F43F-9CB3-42E6-82EF-960D788BEF85.ics
Fetching caldav calendar entry E0438C0D-12AD-4827-96B0-84FB5C31BDD8.ics
Fetching caldav calendar entry A8950638-6EF0-419C-B678-A3BE7D98A884.ics
sorting events of calendar: my-calendar

Thanks for every response.