šŸ“… Calendar Add-On + some calendar designs

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.

Iā€™ve noticed that I used nl_NL and others use nl-NL so Iā€™ve changed that and tried again. Now Iā€™m getting the following error:

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 9.5  (aarch64 / raspberrypi4-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 16s
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-NL
System timeZone: Europe/Amsterdam
Luxon timezone set to: Europe/Amsterdam
Previously stored events posted to sensor(s) at: Tue Apr 25 2023 05:54:02 GMT+0200 (Central European Summer Time)
/node_modules/node-cron/src/convert-expression/month-names-conversion.js:10
            expression = expression.replace(new RegExp(items[i], 'gi'), parseInt(i, 10) + 1);
                                    ^
TypeError: Cannot read properties of undefined (reading 'replace')
    at convertMonthName (/node_modules/node-cron/src/convert-expression/month-names-conversion.js:10:37)
    at interprete (/node_modules/node-cron/src/convert-expression/month-names-conversion.js:16:27)
    at interprete (/node_modules/node-cron/src/convert-expression/index.js:54:26)
    at validate (/node_modules/node-cron/src/pattern-validation.js:117:32)
    at new TimeMatcher (/node_modules/node-cron/src/time-matcher.js:14:9)
    at new Scheduler (/node_modules/node-cron/src/scheduler.js:9:28)
    at new ScheduledTask (/node_modules/node-cron/src/scheduled-task.js:22:27)
    at createTask (/node_modules/node-cron/src/node-cron.js:36:12)
    at Object.schedule (/node_modules/node-cron/src/node-cron.js:25:18)
    at Object.<anonymous> (/index.js:533:6)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Hello everyone,

For me it works now.

But the ā€œcaldavUrl:ā€ setting should not be
ā€œhttps://pXX-caldav.icloud.com/{DSid}/calendars/{pGUID}ā€ or
ā€œhttps://pXX-caldav.icloud.com/{DSid}/calendars/{calendarName}ā€
but
ā€œhttps://pXX-caldav.icloud.com/{DSid}/calendars/{GUID}ā€.

This way I receive all data very well.

However, if I
https://pXX-caldav.icloud.com/{DSid}/calendars/{pGUID} or
ā€œhttps://pXX-caldav.icloud.com/{DSid}/calendars/{calendarName}ā€
I keep getting
Ā“Ā“Ā“Ā“
axios error: [object Object]Request failed with status code 404
Ā“Ā“Ā“Ā“
error message.

At least this way it works for me!!

Thank you to all the people who gave me a little feedback!!

Edit 3:
For whoever is experiencing the same thing: Iā€™ve reinstalled everything once again. Removed the addon completely and installed it again. The first fetch didnā€™t succeed as more people experience but this is an known issue. The second fetch did actually work and the sensor is created.

The addon is super sensitive for typoā€™s so please check, dubbel check and triple check everything. For me it seems to work now. Thanks for all the help!!


Iā€™ve tried multiple things. Removing all recurring events without end date. Making the fetch period smaller. Removing the service account and creating a new one but with no result. The error has changed however.

Do you have any suggestions on what the issue could be?

---------
edit2:

I have once again reinstalled everything. Removed the addon and configured it all again. It seems the error has gone for now but no sensors are created.

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

any idea on what the problem is?

After much searching I found this addon has it read the calendar to a sensor
but get no times in the sensor



Can you see whats wrong in my config?

You can leave out the username, password and cadavUrl fields as youā€™re using a google calendar, but that will not be the cause of the issue youā€™re having. When I look up the BCP-47 locale standard for Sweden it says itā€™s ā€˜sv-SEā€™, so with capitals for SE. Could be that the Luxon library is really strict and needs you to enter it that way.

1 Like