Google Calendar "widget" on website

Currently that’s not supported yet. I proposed something like that as well, a while ago. When I have some time/energy I might make it myself, but that’s not yet.

Currently you should be able to see your configured calendars like this though:

And when clicked on one of them you’ll see something like this:

Hi,

Yea I have what you posted up and working, but that seems to only display the list of available calendars and then when you click on them only displays the next event…

I guess this is used to trigger on an event though and not for viewing as a list.

So far so good though, I can definitely see a lot of potential in HA and can’t wait to put some more time into setting up my PI server.

Thanks for all you guys doing what you do, it’s great to be able to stand on your shoulders and enjoy your excellent work :slight_smile:

Well you can always use the sensor template to pull next event information and show it in the frontend.

I can’t work on an example now but I’m sure you can find some in the forum.

For Google Calendar I use something like this. It extracts info about the next event (sadly, only 1 event) for each calendar:

  - platform: template
    sensors:
      template_calendar_birthdays:
        value_template: >
          {{ strptime(states.calendar.birthdays.attributes.start_time, "%Y-%m-%d %H:%M:%S").strftime("%A, %d of %B, at %H:%M") }}:
          {{ states.calendar.birthdays.attributes.message }}
        friendly_name: Birthdays
        unit_of_measurement: ''

In essence, you can use a template sensor for each of the calendars you want to show.

You can see a more complete example in my config: https://github.com/jjmontesl/home-assistant-config/blob/master/config/packages/calendars.yaml

2 Likes

I got a public link to my Google calendar from the sharing settings and just added it as a panel_iframe

Hi @alanf I saw your reply to this post and I wanted to try the same thing.
But do you know if there is any way to make the calendar public, but not show up in google search results?
Or maybe make it password protected or something?

I’d like to have a family shared calender visible through an IFrame in Home-Assistant, but not the entire world has to know what we’re up to :wink:

I’d tried not to share it and just use https://calender.google.com as a link, but the screen then just stays blank.

Regards

I have not figured out how to hide the calendar from google search results unfortunately. Just give it a boring name and hopefully no one will care. :slight_smile:

haha, thanks @alanf, so be it :wink:

Any updates on displaying list of opcoming events in the Hass website? Would love this for my wall mounted tablet!

@Joris_Kempen, @Mahahaleel for a not so pretty integration and just the ability to show the calendar in the frontend

you can use the iframe component

panel_iframe:
  google_calendar:
    title: 'Kalendar'
    url: 'https://calendar.google.com/calendar/embed?src=ACCOUNT_NAME_HERE%40googlemail.com&ctz=Europe%2FBerlin'

note: the above url is just for my case and the main calendar. To get the url for any calendar: go to the google calendar website -> settings -> choose the calendar of the left side -> on the right check where "<iframe src="url_here …> is and copy just the url.

hope it works for you

@Alexxander0 Your config was very helpful! I got it working initially! But when I try to customize the embed Calendar to add 2 Calendars the iframe panel in Home Assistant shows the Calendar but it is blank? any ideas?

Thank you for your advice

Hey, I just use something like:

panel_iframe:
  google_calendar:
    title: 'Calendar'
    url: 'https://calendar.google.com/calendar/embed?src=FIRST_EMAIL&src=SECOND_EMAIL&ctz=Europe%2FLondon'

Works fine. And in lovelace:

  - type: iframe
    url: https://calendar.google.com/calendar/embed?src=FIRST_EMAIL&src=SECOND_EMAIL&ctz=Europe%2FLondon
    aspect_ratio: 78%

This does do the trick, only it doesnt show the calendar on adnroid devices.

EDIT: it does work on my s8, just not on my galaxy tab 4, first time it needs to load a couple of minutes before it shows up.

EDT2: ok is seems to work now, you just have to login on chrome on the tablet.

is is also possible with iframe module.

Hi

i have this iframe working, but now i have multiple gmail accounts

so i shared a calendar account with full permisison to the master account, i see the new calendar also in google_calendars.yaml file after a restart

so i added the second email address in the &src field like described here : (SECOND)

url: https://calendar.google.com/calendar/embed?src=FIRST_EMAIL&src=SECOND_EMAIL&ctz=Europe%2FLondon

in my sensor on the homepage i, see new events for the second email account,
but in the iframe itsels, i have a message

events from another email account anr not displayed because of permission errors
strange, should be working, because if i login to gmail itself, with the master account, i can see all events from the second shared account …
i also see the events in the sensor itself, just not in the iframe

any idea?

Did you get it working? Not sure of why you get permission errors if calendars are shared

yes, got it to work,

in the end , i just needed to login on the calendar account, from the tablet that was used to access HA
seems it using cookies or stuff like that
so opened chrome, logged in that caledan, afterwards opened HA, and permission error was gone

Hi, sorry to going back to this old topic, I’m relatively new to HA world. I followed your script and it works perfectly for my needs, that’s exactly what I was looking for. The only problem is: is there a way to display the result of the sensor in other launguage than in english?

Hi,
i’m writing this for helping other people.
i’ve set google calendar native support and used this code to read the next event in calendar and then use it in a entity.

in configuration.yalm:

sensor:
  - platform: template
    sensors:
      template_calendar_veritas:
        value_template: >
          {%- set date = as_timestamp(strptime(states.calendar.CALNAME.attributes.start_time, "%Y-%m-%d %H:%M:%S")) -%}
          {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
          {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
          {% set m_ok = date | timestamp_custom("%m") | int %}
          {% set g_ok = date | timestamp_custom("%w") | int %}
          {% set giorno_della_settimana = giorno[g_ok] %}
          {% set giorno_del_mese = date | timestamp_custom("%d") %}
          {% set mese = mese[m_ok - 1] %}
          {{ giorno_della_settimana }} {{ giorno_del_mese }} {{ mese }}: {{ states.calendar.CALNAME.attributes.message }}
        friendly_name: CALNAME
        unit_of_measurement: ''

change CALNAME with the identifier of the calendar you want.

in lovelace:

entity: sensor.template_calendar_CALNAME
icon: 'mdi:calendar'
name: Next Event
type: entity

part of the code found here:

I know this is an old post but the code still works. Can we also add the event starting time to that ?