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

Iā€™m using a google calendar but I canā€™t seem to get all the information in the data attribute.
Missing summary and label, everything else is there. Any idea as to why?

Using this card code on GitHub I want to add below card to my Lovelace dashoard.

image

However on my dashboard it looks like this with ā€œundefinedā€.
What am I doing wrong?

image

My configuration of the addon is:

locale: nl-NL
timeZone: Europe/Amsterdam
fetchDays: 14
fetchDaysPast: -14
fetchCRON: "*/30 * * * *"
calendarList:
  - calName: agenda_ton
    calType: caldav
    username: "!secret calendar_caldav_username_ton"
    password: "!secret calendar_caldav_calendar_caldav_password_ton"
    caldavUrl: http://xxx.xxx.xxx.xxx:20002/caldav/ton/home/

In editting mode the yaml of the card looks like this:

The development tools is showing correct date attributes:

HASS Environment:
Hass Calendar Addon version: 0.301
Home Assistant 2022.11.4
Supervisor 2022.10.2
Operating System 9.3
Frontend-versie: 20221108.0 - latest

You are using an outdated version of that example card code. Your link points to an older git version. The updated code with the new datafield names is here: hassio-addons/onePersonNext4.yaml at 37638798994b67541061f059350e7fac15eb5136 Ā· kdw2060/hassio-addons Ā· GitHub

1 Like

SOLVED

With the newest code: works like a breeze! Thank you @kdw2060 Kris!

Just one more strange thing: The output of the sensor gives me a lot of entire day - recurring items.

When I use them in the card :

  • they appear in the selection (+14 <> -14) eventhough they should not be according to their dates.
  • they appear sorted on top eventhough they should not be according to their dates.

The states in thge development tools show: recurring ā€˜falseā€™ but in Synology Calendar (and outlook via CardDAV Synchorizer addon) they actualy are recurring

SOLUTION:

If you can download some ics files of those events, I can have a look at the cause. Please open an issue on Github for this and include the files there. btw, no promises time-wise as to when I might find time for this.

1 Like

I compared a good functioning good_event.ics with a bad functioning bad_event.ics in Visual Stucio Code. It turned out the bad functioning bad_event.ics is missing the tag:

X-MS-OLK-AUTOSTARTCHECK:FALSE

I added this tag mannually to the event.ics-file and imported the corrected event in MS Outlook. Now it shows up allright HASS Callendar Add-on well. Cause identified.

Over the years I used many Caldav / Calendar services and clients. I guess these are ghosts from the past. I will correct all disobedient events manually with a firm hand.

Your offer to inspect the bad *.ics-files inspired me to do it myself @kdw2060. Thank you for that and for your support. If you have any questions or want to inspect the *.ics yourself, do let me know.

This post is a solution to post :

1 Like

Lovely card!
I finally managed to get the sensor.
Is there a way to insert one card into multiple calendars? for example, I have my work-mail calendar and personal calendar.

Thatā€™s surely possible, but youā€™ll have to adapt the javascript code to achieve this. Custom button card can do anything you can imagine because it allows you to write your own html/css/javascript and work with the entities-data that Home Assistant provides. But that off course assumes you have some web-development skills and know how to write code.

If you donā€™t then the easiest would be to just duplicate my button card template and render 2 cards side by side.

1 Like

hi!

I finally managed to get the sensor working with a google calendar. I am a bit of a newbee, so Iā€™m happy this works!

However, the next step is to add the cards. I thought this would be easy using the code Ton van Loon and you wrote about last November. Now I end up with this:

image

Iā€™m probably missing something easy, but maybe you guys can help me out?

Thanks!

I can see two things:

  • you probably donā€™t have card-mod installed which is necesarry for the styling. You can find card-mod in HACS.
  • you have not updated the image-url to point to a photo/image that you want to use. Either upload to the www folder of Home Assistant and adapt the example link or you could also link to some image on some website.
1 Like

Thanks! That worked!

Some other questions. Is there a simple way to only show items for the next 24 hours?

And within the same account I have various calendars (birthdays, different people of the family), can this card show events from all calendars? This may have been asked before, but maybe if itā€™s in the same account itā€™s possible?

Thanks again!

Ps. Iā€™ll start learning python soon, hopefully thatā€™ll help a bit :slight_smile:

Some other questions. Is there a simple way to only show items for the next 24 hours?

Yes, just limit the amount of days to fetch to 1 in the addon settings, or alternatively write a template that contains the necessary logic

And within the same account I have various calendars (birthdays, different people of the family), can this card show events from all calendars? This may have been asked before, but maybe if itā€™s in the same account itā€™s possible?

Euhm, just look at the question right before yours. Youā€™ll need to configure a calendar in the calendarList for every calendar.

Ps. Iā€™ll start learning python soon, hopefully thatā€™ll help a bit :slight_smile:

Not necessary for working with the add-on data. Though the jinja templating syntax that Home Assistant uses is related to python, so wonā€™t hurt to learn python.
Personally I prefer writing javascript in a custom button card. I find javascript easier to understand and work with, but thatā€™s personal preference.

1 Like

Hi All,
Hoping I may get some insights here - I have installed the addon, and restarted HA. The addon starts but then stops with the below logs.
I have a ā€œfeelingā€ that it may have to do with the system locale being set to en-US, while Iā€™m in IE, but I canā€™t seem to get the system to reflect reality - I have updated the system settings.

If anyone can help would greatly appreciate it!
thanks in advance

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  (amd64 / qemux86-64)
 Home Assistant Core: 2023.2.5
 Home Assistant Supervisor: 2023.01.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 24s
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.5.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.5.1>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
System locale: en-US
Luxon locale set to: en-IE
System timeZone: Europe/Dublin
Luxon timezone set to: Europe/Dublin
node:internal/fs/utils:347
    throw err;
    ^
Error: ENOENT: no such file or directory, open '/data/allFutureEvents.json'
    at Object.openSync (node:fs:590:3)
    at Object.readFileSync (node:fs:458:35)
    at Object.<anonymous> (/index.js:509:30)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/data/allFutureEvents.json'
}
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

Has nothing to do with the timezone. Thereā€™s a bug I need to fix. See this issue on Github that also contains a workaround.

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.