Lovelace Google Calendar

Hi Lapatoc,

Since it was a small change, I changed the url to not being hard-coded anymore, it is now a relative url.

Since it is a relative url, I now hope that it will also work with the new Auth system as it is just a relative url and all existing security cookies/tokens should flow along. Can you test? The new version is available here: https://github.com/rdehuyss/homeassistant-lovelace-google-calendar-card/tree/master/dist

And are you talking about this auth system: https://developers.home-assistant.io/blog/2018/07/02/trying-new-auth.html?

Kind regards,
Ronald

Yes, the link to new auth system is correct.
Thank you for quick fix. I’ll test new version and report later today.

Well I’ve tested new version of card. Url problem solved but authentication problem still exists. Now I’m getting 401 response. HASS log are full of following entities:

Login attempt or request with invalid authentication from 192.168.111.12

I’ve located issue with new auth system. The problem is in fetch(url) in getAllUrls function. By default fetch do not send any headers. You have to define them manually. I’ve made ugly fix:

getBearerToken() {
  var userToken = JSON.parse(localStorage.getItem('tokens'));
  return userToken.access_token;
}

async getAllUrls(urls) {
var btoken = this.getBearerToken();
...
fetch(url, {headers: {'Authorization':'Bearer '+`${btoken}`}}).than(...

Hi Lapatoc,

the issue should be solved now… I am now using the hass.callApi function which takes care of oAuth integration.

I just pushed it to github again. If you have any issues, do not hesitate to contact me.

Grtz,
R

1 Like

Thanks. Works great!

BTW. What is the purpose of slider on top of card? I can’t move it.

Ok, hint taken, I’ll make it optional: you are the second person who asks me :slight_smile:

It gives you the progress throughout the day, it is based on the standard google android calendar.

What do you think? Keep it, make it optional, …

Didn’t realized that is day progress bar. Currently I have only all day events in my household calendar. Need to play with other type of events.

How to make that locale would considered? Week days names alway in English.

The progressbar is now optional:

configure it using: showProgressBar: false on the same level as entities.

Also, caching is added for 15 minutes so that we don’t do DDos attack on google for each entity change.

Cheers,
R

Still need to look into that one. Which locale are you using?

1 Like

Russian. Hass frontend has a token in local storage that identifies which translation to use.

Done! Try with the latest version…

You’re fast! I’m still in the tube))) Will test later.

1 Like

Thanks for making this, I love it. I just updated to the version you posted an hour ago but having some issues. I tried using a simple birthday Google calendar and I’m getting this issue. The lines keep increasing every couple of seconds. This calendar only has all-day events, so maybe that is causing the issue? I also noticed on another calendar I tested that any all-day event would show as one day earlier in your card. So if I had an all-day event on Friday, it would show up as Thursday on your card. Any ideas?

Hi,

the multiple lines are solved - the drawback of a quick ‘improvement’ and no unit tests :roll_eyes:.

Regarding the all-day events, I PM’ed you to get this solved. This is probably related to time zones.

I think I fixed it but there is no way for me to test this decently (as my google calendar returns all events in UTC+2) except by visiting you :wink:

Anyway, try the latest version.

Cheers,
R

I only get the name - I have a calendar already installed … Why is that?

I used the one from root, should I use dist? What is the difference?

Yes, you should use from dist. Don’t forget to update archive. There are a lot of changes.

1 Like

You should not use the one from root as it is the src file.

The one from dist (distribution) is the one that is build (all assets are bundled) and can be used in home-assistant.

1 Like