Im sorry for my missed excerpt out of my caldav, but i used the time to get a bit used to your addon and i wanted to share my setup with all of you.
So one snippet out of my use case is that i combine two calendars dedicated to hold trash dates for different places (here lambsheim and frankenthal). Also i Filter all the events to only hold events in the upcoming week, search in there name for a matching trash type and give them a symbol and shortname.
I think this way i would be possible to get a neat integration of trashdays from different serviceholders via the exported trashlists - mine let them export directly to CalDav so this is seamlessly easy.
{% set d1 = states.sensor.cal_frankenthal.state %}
{% set d2 = states.sensor.cal_lambsheim.state %}
{% set d3 = ((d1|int)+(d2|int)) %}
{% set a = states.sensor.cal_frankenthal.attributes.data %}
{% set b = states.sensor.cal_lambsheim.attributes.data %}
{% set i = (a + b) | sort(attribute='endDate')%}
{% for h in i%}
{% set filter = (((as_timestamp(h.endDate) - as_timestamp(now())) / 60) | int) %}
{% if filter < 10080 %}
{%- if loop.first %}[ {% endif %} { "name": '{{loop.index}}',{%- if 'Frankenthal' in h.description -%} "location": 'FT',{%- elif 'Lambsheim' in h.description -%}"location": 'LA',{% endif%}{%- if 'Altpapier' in h.description -%} "symbol": 'š¦', "trash": "Papier",{%- elif 'Schadstoff' in h.description -%}"symbol": 'š„',"trash": "Schadstoffe",{%- elif 'Restabfall' in h.description -%}"symbol": 'ā¬',"trash": "Restabfall",{%- elif 'Wertstoffe\, Bioabfall' in h.description -%}"symbol": 'šØš«',"trash": "Papier & Plastik", {%- elif 'Abfuhr' in h.description -%}"symbol": 'š«', "trash": "Bio",{%- endif %} "summary": '{{h.description}}', "minutes_till": {{((as_timestamp(h.endDate) - as_timestamp(now())) / 60) | int }},"state": {{d3}}, "start_time": '{{h.start_day}}.{{'%02d' % h.start_month_digits}}.{{h.year}} {{h.start_time}} Uhr', "time_z": '{{h.startDate[:-14]}} {{h.start_time}} - {{h.end_time}}' } {%- if not loop.last %},{% endif -%}
{%- else -%}
{%- endif %}
{%- endfor %}]
after that i just put them in a markdowncard an let this be displayed as follows:
Im still having issues with the startDate and endDate of the calendar integration - but this finally is my fault cause i hadnt had the time to export my log for you - sorry for that again.
it sounds like youāre not familiar with sensor data, templating or the developer tools of Home Assistant. You will need to familiarize yourself with those concepts if you want to use your calendar data somewhere.
Your screenshot indicates that the addon is working properly, navigate to the dev-tools and search for the name you gave your calendar there. It should look something like this:
In my addon documentation Iāve linked to the Home Assistant documentation about templating. You can test your templating syntax in the dev tools too, like this:
The post before yours in this thread by user Flipso contains an example of some more complex templating syntax inside a markdown card.
Personally Iām not very fond of the jinja templating syntax that Home Assistant uses and prefer to write javascript for this instead. You can do this inside a custom button card. In my initial post in this thread I link to two example custom button cards.
Eitherway if youāre not familiar with scripting languages youāll have a bit of a learning curve ahead Iām afraid.
Recurring events will have the recurring: true attribute.
However I remember from testing with a birthday that I still needed to fix some things. I donāt remember exactly, but I think the year may be incorrect in the sensor data now if the event has been in your calendar for several years. Itās on my to-do list to investigate and fix this sometime.
hi @EdwardEnglish, sorry my memory failed me, the recurring events attribute is currently only there for google calendar events, not for events from a caldav calendar. I do plan on adding support for recurring events, but canāt say when I will find time to work on it. I did start reading up on the documenation and having a look at examples. It seems like the most complex bit here will be calculating the current applicable date of a recurring event as the data gives you the initial date and a recurrence format, not a ready made list of future dates.
Hello @kdw2060
I try to setup your addon for my google calendar but I am struggling a bit. I have a few questions.
My config looks like this:
locale: de
fetchDays: 5
fetchCRON: '*/30 * * * *'
calendarList:
- calName: Geburtstage
calType: google
calId: xxxxxxxxxxxxx
googleServiceAccountKeyfile: google_credential.json
The log tells me the following:
23 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
Calendar(s) queried at: Wed Jul 13 2022 01:30:00 GMT+0200 (Central European Summer Time)
postEventsAllCalendars error: TypeError: Cannot read properties of undefined (reading 'length')
CRON-Task: Events posted to sensor(s) at: Wed Jul 13 2022 01:30:00 GMT+0200 (Central European Summer Time)
There was an error loading the gcal data: Error: No key or keyFile set.
So I guess this one āgoogleServiceAccountKeyfileā is wrong.
I copied it to \share
Is the folder name needed for the attribute as well?
Then I have a question regarding the addon folder. There should be the data folder with the allFutureEvents.json.
I installed your addon (as well as all other installed addons) directly via the admin UI in Home assistant. When I go to \addons the folder is empty. There is no file or directory inside. So I am wondering if this was the right way to copy my credential files to the \share folder.
And I saw something that I need to provide my service account email to my calender and share the calender with this email. But I donāt know where do I get this service account email?
Your configuration looks good, no errors there as far as I can see (I cannot know if your calId is correct off course). The \share folder is not a subfolder of addons, itās a seperate standard folder in the HA folder structure (see this earlier reply).
As the loading of the events failed itās logical there is no allFutureEvents.json file yet.
The service-account email was presented to you when you made the service account, but is also visible inside the service-account json file. Just open it with a text editor and copy paste te e-mail. How to share a calendar with that e-mail adress is shown in this earlier reply.
I think you might not have placed the serviceaccount json file in the right folder and/or you didnāt share the calendar with the service-account e-mail adress.
I donĀ“t use baikal myself, so I canāt set up tests for that. From the other users that do use Baikal I understand that that baikal plugin that is mentioned in the docs is not required if you choose ācaldavā as calendar type indeed.
If your calendar is empty thatās probably a config issue. To not annoy the other users here I suggest you post your config settings in the github-issue that you re-opened. Iāll see if thereās a glaring issue visible there.
After being disappointed with the default Google Calendar integration (because you can only see one event per calendar), I was excited to find this earlier today.
I have a personal calendar and a work calendar. I was able to get them to both show up using your Calendar Add-On. Amazing!
1
There didnāt seem to be any way to read my work calendar that had been shared with my personal calendar, so I had to set up another json file for it too. Was there any easier way?
2
Is there any way to merge them into a single sensor?
(perhaps with each event having a field showing the calendar origin)
Iād like to grab the 4 next events regardless of which calendar theyāre on. I could read in the next 4 events from both calendars and then sort that by date and throw out the last 4.
A single sensor would be much easier for this use case.
3
I could never get the en localization to work (so went with en-ca). Tried multiple times, seems missing (same error the person shared earlier where they were also using en)
But the event starts at 17:00 on 8-23
Iād expect it to be: 2022-08-23 17:00:00
So it could be used to trigger an automation.
Is this because my localization is wrong? Thoughts?
5
This is so great! Iāve got my next 3 meetings showing up on my dashboard (with heavy use of the custom:button-card)
You mean an extra Google service account? If the work calendar and personal calendar are both calendars under the same Google account that shouldnāt be necessary. Off course if you use two seperate Google accounts then probably yes. Iād have to delve into the google api documentation and do some tests to find out exactly if itās possible to share calendars between 2 accounts in such a way that one service account can access them.
2
Is there any way to merge them into a single sensor?
(perhaps with each event having a field showing the calendar origin)
Iād like to grab the 4 next events regardless of which calendar theyāre on. I could read in the next 4 events from both calendars and then sort that by date and throw out the last 4.
A single sensor would be much easier for this use case.
That could be done, but I donāt see it becoming a priority on my to do list anytime soon. Am currently mainly working on improving how recurring events are handled. Like you said, handling this yourself with frontend-code in the card is the way to achieve this now.
Iām also busy switching from moment.js to Luxon, paying extra attention to possible date-time mishaps. That should hopefully help to fix both those issues.
Hi @elyisum , it seems as if no events are retrieved, and hence no sensor created.
Itās hard to guess whatās going on here. Are you familiar with Postman or similar tools with which to test api-calls? Iād need the response of those to understand whatās going on here.
In this earlier support issue on github you find some screenshots and explanation about working with postman (ignore the apple/icloud specific stuff)
<s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
<s:message>A calendar-query REPORT on a calendar with a Depth: 0 is undefined. Set Depth to 1</s:message>
New edit:
If I add Depth 1 in header, now i have a status 207
I donāt know what this tatus means
The 207 reponse is good, only the response doesnāt return any events for some reason. Most obvious reason could be the date-range in the request body doesnāt contain events. Else having access to a test account may be handy in deed. You can send me a DM, but I canāt make any promises when I will find the time to work on it. Might be some months.
Hi @kdw2060, bumped on this, browsed through topic and on GH but couldnāt find an answer.
I run HA core, so without add on store, and use nextcloud: I wonder if there is a way to get this working for my case?