Lovelace Google Calendar

It appears to me the back end api is sometimes throwing exceptions which I indeed don’t expect/support currently. The question is why is the back end retuning exceptions while an empty array would suffice.

I’ll try to look into it when I have some spare time.

Hey thanks for the great work.

I was wondering if it is possible to hide/ not displaying the card. If there is no entry to display.
Use case in for me is the birthday calendar, which has not everytime an entry available.

Would this feature possible?

1 Like

Hi everybody,

I installed this module (thx you for this, it missed !!).

I’m using a Caldav, and I can have only 1 date… how to do to have more than one event ?

Capture

Thank you !!

Strange, do note that it only fetches events 7 days in the future… Is that perhaps the problem?

Aaaah yes !!
Does it possible to extend the period of 7 days (maybe could we choose it)?

Thank you !

just edit line 24 in calendar-card.js
const end = moment().startOf('day').add(7, 'days').format("YYYY-MM-DDTHH:mm:ss");

:wink:

@rdehuyss you are my man! HAss lacks this feature since the beginning…

you mean we can change 7 to another number? i.e. 14?

of course, i’ve tested it. just change the url (e.g. - url: /local/calendar-card.js?v=42 ) of the include in your lovelace config to see effect… greetz

Sorry do not understand… i must change the calendar.js file and then the url?

nevermind :wink:

  • changing the 7 into 14 make the js file loading the next 14 days in your calendars
  • but HAss is caching the js files, so you have to fake a new file by changing the url in the include in the top section of your lovelace config
1 Like

Ok, got it… thanks

It would be great if this could handle all day events which span multiple days. Currently it only displays them on the first day. In the Calendar app on my Android phone it shows 2 day event like “Event Name (Day 1 of 2)” and “Event Name (Day 2 of 2)”. Something like this would be great.

Everytime i open the view with calendar-card i get the following error:

2018-09-15 00:12:31 ERROR (MainThread) [frontend.js.latest.201809030] https://xxxxxxxxx.duckdns.org/local/calendar-card.js:10:7 Uncaught ReferenceError: moment is not defined

The template code of this card is the following:

  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[0] and states.calendar.mauriziofabianigmailcom.attributes.all_day != True %} Prossimo appuntamento in agenda: {{states.calendar.mauriziofabianigmailcom.attributes.message}} alle {{(states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.mauriziofabianigmailcom.attributes.start_time).split(" ")[0] and states.calendar.mauriziofabianigmailcom.attributes.all_day == True %} Oggi è: {{states.calendar.mauriziofabianigmailcom.attributes.message|replace("/","and")}}{%endif%}
  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.inter_calendar.attributes.start_time).split(" ")[0] and states.calendar.inter_calendar.attributes.all_day != True %} Prossimo appuntamento in agenda: {{states.calendar.inter_calendar.attributes.message}} alle {{(states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.inter_calendar.attributes.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.inter_calendar.attributes.start_time).split(" ")[0] and states.calendar.inter_calendar.attributes.all_day == True %} Oggi è: {{states.calendar.inter_calendar.attributes.message|replace("/","and")}}{%endif%}
  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.contacts.attributes.start_time).split(" ")[0] and states.calendar.contacts.attributes.all_day != True %} Prossimo appuntamento in agenda: {{states.calendar.contacts.attributes.message}} alle {{(states.calendar.contacts.attributes.start_time).split(" ")[1].split(":")[0]}} {%if (states.calendar.contacts.attributes.start_time).split(" ")[1].split(":")[1] != '00'%}{{(states.calendar.calendar.contacts.start_time).split(" ")[1].split(":")[1]}} {%endif%} {%endif%}
  {% if as_timestamp(now()) | timestamp_custom('%Y-%m-%d') == (states.calendar.contacts.attributes.start_time).split(" ")[0] and states.calendar.contacts.attributes.all_day == True %} Oggi è: {{states.calendar.contacts.attributes.message|replace("/","and")}}{%endif%}

Did you include the reference to moment.js under resources: as well as the one for calendar-card.js? it should look something like:

resources:
  - url: https://unpkg.com/[email protected]/moment.js
    type: js
  - url: /local/custom_ui/calendar-card/calendar-card.js?v=1.0.1
    type: module

Yes i added this, but the problem was solved as i forgot to include custom:calendar-card inside double quotes…

Hey guys.

I’ve got HA installed in the Python Virtual Env. Where do I drop the calendar-card.js file? I can’t seem to find the right directory.

just create a folder named “www” where configuration.yaml is located. Internally, you use /local/[file.js].
(You can also place pictures in the www folder, or create pictures subfolder, to assign entity pictures then)
Hard to find some information about it in the docs…

Hello,

I have issue with this card, it doesnt show any data
obraz
Could you help me solve this problem?

Have you checked for errors in the console and in HA? Do you have events scheduled on the calendar in the next 7 days?