Lovelace Google Calendar

I am also seeing events from the previous day, seems to be only later in the day events, so it must have something to do with timezone, is there a way to fix? I am in EST.

Hey wabil,

I tried that, saved the js file and restarted.
Still looks funny :frowning:

image

Any other suggestions?

Probably have to clear your browser cache. Try testing in an incognito window.

You are absolutely right. Sorry, just me being noobish, but hey lesson learned :slight_smile:!

Thanks man!

Hey guys-- I’m new to HA and the forum. Hoping someone can help me out. I was able to get the calendar to appear for roughly 15-40 minutes. During that time I was testing out how transferred the info, by making updates on my google calendar and refreshing HA. As soon as I was able to pack it up for the night and closed the API browser window (the one where I got my secret) and the Google calendar app, I refreshed my HA session and now only the card and header “Calendar” appear. I checked in my error logs and here’s what I’m seeing - any thoughts? Not sure why it would have disappeared all of a sudden.

Log Details (ERROR)
Fri Oct 26 2018 23:57:21 GMT-0400 (Eastern Daylight Time)

Error while setting up platform google
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/google.py”, line 39, in setup_platform
for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/google.py”, line 39, in
for data in disc_info[CONF_ENTITIES] if data[CONF_TRACK]])
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/google.py”, line 51, in init
super().init(hass, data)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/init.py”, line 89, in init
self.update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/init.py”, line 155, in update
if not self.data or not self.data.update():
File “/usr/local/lib/python3.6/site-packages/homeassistant/util/init.py”, line 325, in wrapper
result = method(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/calendar/google.py”, line 112, in update
result = events.list(**params).execute()
File “/usr/local/lib/python3.6/site-packages/oauth2client/_helpers.py”, line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/googleapiclient/http.py”, line 837, in execute
method=str(self.method), body=self.body, headers=self.headers)
File “/usr/local/lib/python3.6/site-packages/googleapiclient/http.py”, line 163, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/oauth2client/transport.py”, line 186, in new_request
credentials._refresh(orig_request_method)
File “/usr/local/lib/python3.6/site-packages/oauth2client/client.py”, line 756, in _refresh
self._do_refresh_request(http)
File “/usr/local/lib/python3.6/site-packages/oauth2client/client.py”, line 812, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_client: Unauthorized

Here’s another log item:

Log Details (ERROR)
Fri Oct 26 2018 23:57:20 GMT-0400 (Eastern Daylight Time)

Error executing service <ServiceCall google.scan_for_calendars (c:722fd96eac794d55ac2c953d7ad28493)>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1125, in _event_to_service_call
await self._hass.async_add_executor_job(execute_service)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1122, in execute_service
service_handler.func(service_call)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/google.py”, line 202, in _scan_for_calendars
calendars = cal_list.list().execute()[‘items’]
File “/usr/local/lib/python3.6/site-packages/oauth2client/_helpers.py”, line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/googleapiclient/http.py”, line 837, in execute
method=str(self.method), body=self.body, headers=self.headers)
File “/usr/local/lib/python3.6/site-packages/googleapiclient/http.py”, line 163, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/oauth2client/transport.py”, line 186, in new_request
credentials._refresh(orig_request_method)
File “/usr/local/lib/python3.6/site-packages/oauth2client/client.py”, line 756, in _refresh
self._do_refresh_request(http)
File “/usr/local/lib/python3.6/site-packages/oauth2client/client.py”, line 812, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_client: Unauthorized

I’ve opened the same question with more details found here -

Hi loving the card, is it possible to increase the number of events displayed? It seems to display only 5 events regardless of how many days I set it to look over. I can’t see anything mentioned in the stream above.

Thanks

You want more than 5 Google events?

mkdir /config/custom_components/calendar
cd /config/custom_components/calendar
wget https://raw.githubusercontent.com/home-assistant/home-assistant/dev/homeassistant/components/calendar/google.py

Use a text editor to change the ‘maxResults’: 5 in google.py to a number of your liking.

1 Like

Worked perfectly!

google

Could anybody direct me where I can change the display time? I would like it to read ie: 8:00pm instead of 20:00

thanks!

1 Like

@rdehuyss This custom card has been adequately tested and looks like it is ready to be submitted to the core :slight_smile:

3 Likes

Just wondering if anyone can help me with the ‘custom element doesn’t exist’ issue - I’m only experiencing it on an older iPad when using some custom cards, works fine on a newer ipad/laptop etc…

Safari in older iOS does not support the Home-Assistant UI or LoveLace :frowning:

yea, I can’t use homeassistant on my ipad 2 :frowning: unfortunately

Damn, everything else seams to work for me apart from this!

Everything works on safari and ha ios app on ios 10.3 except the calendar on my ipad.

1 Like

I appreciate it isn’t something every one will want. However thought I would share that on my install I added Month in short form also to the calendar.
Insert a new line and line 148 becomes
<div>${moment(day).format('MMM')}</div>

I know I should be able to work it out myself but I just prefer it to show Month also (especially with multiple calendars shown on my screen, some of which do not have anything until the next month or so. Birthday’s calendar for example)

Update line 179 to use a different format string for moment. I went with h:mm A instead of HH:mm.

BEFORE (Example time: 14:30) - 24 Hour time, NO AM/PM:
<div class="time">${event.isFullDayEvent ? 'All day' : (moment(event.startDateTime).format('HH:mm') + - + moment(event.endDateTime).format('HH:mm'))}</div>

AFTER (Example time 2:30 PM) - 12 Hour Time, No Zero Fill with AM/PM:
<div class="time">${event.isFullDayEvent ? 'All day' : (moment(event.startDateTime).format('h:mm A') + - + moment(event.endDateTime).format('h:mm A'))}</div>

1 Like

this is perfect, Thank You @lethic :slight_smile:

How did you get the images into your calendar?