Google Calendar Integration Strange Behaviour

I have setup google calendar no problem. What does seem to happen is this. The Calendar view updates very quickly and I can see new events that I add almost immediatly.

However, checking the state of the calendar.cal_name show’s “off” like it should, but in the attributes doesn’t pick up the newly added event. It takes a long time (15m??? I read that is the update interval).

Why does the view on the HA Calendar tab update so quickly, but the entity does not?

Thank you,
Marc

You’ll need to post more evidence, such as screenshots, output from the developer tools, and show us your relevant (and sanitised) configs.

From what I understand, this would be impossible. The built-in calendar view and any calendar cards can only display what’s in the entities.

Yes, the update interval for the Google Calendar integration is 15 min.

Guess I’ll live with it. unfortunately I don’t have time to prove I’m not lying.
If you have some time. I’d appreciate you trying it.

Goto your google calendar, add an entry so that it will be the next event in the future. Go back to HA GUI and refresh the calendar page. It will display there quickly.

At the same time, make calls to the service/display (however you like to do this, i use NR) the contents of the calendar.calendar_name entity information. It should contain the next upcoming event. But it won’t be the new event that the Calendar in the GUI shows.

It’s not about lying: It’s about understanding. We need to share as accurately as possible what one is seeing and doing. Sometimes, even things we think should be obvious aren’t obvious to others. There are many people here from different backgrounds and languages, so one can easily miss one another.

Sure, I wouldn’t have replied initially if I wasn’t at least curious to understand the issue too. I’ve recently started using the integration and had a look at the code since it wasn’t documented what the update interval is. My feedback on this hasn’t yet been incorporated but I’ve logged an issue for that.

I can confirm what you’re seeing by performing the following steps:

  1. Create a Google calendar entry for a time in the future (it was about 30 min into the future to be sure the state update will trigger at least once).
  2. Immediately after creation, I checked both the built-in calendar and my dashboard view with a calendar card. It showed a spinning disc on the latter to show it is updating and then the new event was there immediately.
  3. I checked the entity state under the developer tools, and the state was off with no attributes showing the new event.
  4. I waited until the entity updated and then it showed the new event in the attributes (which was still in the future then, so the state was still off, as it should be).
  5. And just to confirm, the state changed to on when the event started.

If the entity has the information (or in this case, the absence of information) and the frontend relies on the entity, there’s either state data that’s not visible or something gets bypassed to get the information. When I refreshed, it was clear that something was updating.

Also, the calendar in question isn’t public, so it can’t (shouldn’t) be a direct request to Google.

So I checked the page source and it contains this:

The link there will take you to the specific event (eid stands for event ID). Back to my two assumptions above, this looks like the bypass argument. Of course, I’m logged into the account which the calendar in question belongs to, so I thought that’s why the URL would resolve and HA would update immediately (but would be a cross-site security issue). But still, the question is: Where did the eid come from if there’s no details on the calendar entity?

So I opened another browser, not logged into the same account. Logged into HA and followed the same steps as above: The calendar event was there immediately with the only difference that clicking on the event now opens a new tab asking me to log into the relevant Google account. I’m concluding that the eid must be provided by the HA instance somehow (and there doesn’t seem to be any security issues).

I’m starting to tread here very lightly, as I haven’t really dug into much of the frontend code, but custom UI elements has access to a hass object and can make service calls via websockets. This is what it must be doing. Just a pity to have the two bits of information (the UI vs the calendar entity) out of sync until the entity updates when it seems like the calendar entity can be updated when the UI is refreshed (again, I’m not going to pretend I understand the complexities of the current architecture).

So, no, you’re not lying or mad. :smiley:

3 Likes