core icon indicating copy to clipboard operation
core copied to clipboard

Mix of filter in google calendar

Open sebfar9172 opened this issue 2 years ago • 18 comments

The problem

Hello

There is a problem with the latest version of HA for Google Calendar integration.

In the exemple, i filter message "Nettoyage" and in the entity it use an another filter ("Coupure chauffage")

google calndar

What version of Home Assistant Core has the issue?

2022.11.1

What was the last working version of Home Assistant Core?

2022.10.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Google calendar

Link to integration documentation on our website

https://www.home-assistant.io/integrations/google/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

sebfar9172 avatar Nov 04 '22 09:11 sebfar9172

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (google) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of google can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign google Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


google documentation google source (message by IssueLinks)

home-assistant[bot] avatar Nov 04 '22 09:11 home-assistant[bot]

Duplicate with https://github.com/home-assistant/core/issues/81533

Pulpyyyy avatar Nov 04 '22 09:11 Pulpyyyy

Bildschirmfoto 2022-11-04 um 14 41 05 Bildschirmfoto 2022-11-04 um 14 42 58

Can confirm this for an older yaml based configuration.

Draluak avatar Nov 04 '22 13:11 Draluak

Thank you for the report. There was a large rewrite of parts of calendar in this release, so likely the source of the bug.

I am not yet able to reproduce this, however.

I have a yaml entry like this:

- cal_id: [email protected]
  entities:
  - device_id: device_automations
    name: Device Automations
  - device_id: backyard_light
    name: Backyard Light
    search: "#Backyard"
  - device_id: ext_plug
    name: Exterior Plug
    search: "#ExtPlug"
  - device_id: plug
    name: Plug
    search: "#Plug"

And all the events show up as appropriate.

Screen Shot 2022-11-04 at 6 57 05 AM

There is some persistent state now stored in .config/storage/google.XXXX that serves the calendar and so i am wondering if the data in that file was corrupted in a race condition, or its something we can reproduce consistently.

allenporter avatar Nov 04 '22 14:11 allenporter

Bildschirmfoto 2022-11-04 um 14 48 37

maybe helpful addition: future entries are displayed correctly in the calendar view, only the current/next event seems to be mixed up somehow.

Draluak avatar Nov 04 '22 14:11 Draluak

Thanks for your reply

I have a yaml entry like this:

My yaml looks very similar to yours :

- cal_id: [email protected]
  entities:
    - device_id: télétravail
      name: Télétravail
      search: "#Télétravail"
      
    - device_id: poubelle_verte
      name: Poubelle verte
      search: "#verte !!-960"

    - device_id: poubelle_jaune
      name: Poubelle jaune
      search: "#jaune !!-600"

However could char "é" (and other french chars) can be part of the problem ?

Will look at config/storage/google.XXXX as soon as i can connect to SSH

Pulpyyyy avatar Nov 04 '22 14:11 Pulpyyyy

@allenporter

There is some persistent state now stored in .config/storage/google.XXXX that serves the calendar and so i am wondering if the data in that file was corrupted in a race condition, or its something we can reproduce consistently.

Found several duplications inside. So i renamed files, and sync from the UI. Files are recreated and calendars are correct now

Pulpyyyy avatar Nov 04 '22 16:11 Pulpyyyy

Oh interesting!

I worry there is a bug where things may be written out of order and mixed up on different objects. I will investigate adding some locking if we're doing async io while reading/writing data.

allenporter avatar Nov 04 '22 17:11 allenporter

EDITED: I also deleted the google.xxx file in .storage and reloaded.

Just a quick “me too” comment… nothing to add than I’m another one with the problem.

I removed and the put back the YAML file and reloaded each time; worked for a time but recorrupted.

But I’ll look into the .storage bit too.

traindriverrev avatar Nov 06 '22 09:11 traindriverrev

I had the same problem and could fix this by deleting the google. file and reloading the integration.

Although in my case the path is /config/.storage/

StefanSarzio avatar Nov 06 '22 09:11 StefanSarzio

Hi @allenporter I am not trying to pressure you or complain; this is info-only but the deletion of the google.xxxx file in .storage.xxxxx, followed by a reload is a functioning work-around. But I need to do it a few times a day, if that gives you any more info.

(Edited for bad typing on iPhone while wife was driving in traffic)

traindriverrev avatar Nov 07 '22 04:11 traindriverrev

@traindriverrev yeah, this is a huge issue that needs to be fixed, this is not an "ok" workaround. I was just looking at it and its a priority to fix.

allenporter avatar Nov 07 '22 04:11 allenporter

If someone has an account w/ data that isn't too sensitive, you can email me your google.XXX storage file at [email protected] and it may help me diagnose the issue. Definitely don't do this if you have PII you're concerned with sharing.

allenporter avatar Nov 07 '22 04:11 allenporter

I can think of a hack where i make a separate file for each calendar, but i'd like to understand where the race and data mix-up is happening. It should be sharing a single file, but with separate keys in the storage file for each calendar.

allenporter avatar Nov 07 '22 04:11 allenporter

@traindriverrev yeah, this is a huge issue that needs to be fixed, this is not an "ok" workaround. I was just looking at it and its a priority to fix.

Hi @allenporter - all good! I was just trying to indicate an acknowledgement that this is a volunteer-driven open-source project where fixes aren't able to be 'expected' in a timeframe a commercial project might give (although reality is that it's probably more agile as a result).

I'd offer to help but it's a bit above my pay grade and you seem to have homed in on the problem.

I'll email you my google. file - it's not too sensitive. Just don't judge the 'weirdness' of the entries!

traindriverrev avatar Nov 07 '22 05:11 traindriverrev

If someone has an account w/ data that isn't too sensitive, you can email me your google.XXX storage file at [email protected] and it may help me diagnose the issue. Definitely don't do this if you have PII you're concerned with sharing.

Done!

traindriverrev avatar Nov 07 '22 05:11 traindriverrev

I worry there is a bug where things may be written out of order and mixed up on different objects. I will investigate adding some locking if we're doing async io while reading/writing data.

Hello @allenporter I may have found a way to reproduce it by editing calendar (recurring event) from Google Agenda : then at next synch duplicate are created again

Pulpyyyy avatar Nov 07 '22 07:11 Pulpyyyy

additional info: my calendar was fine for a few days after deleting google.xxxxxxx - seems it mixed up again today as soon as the offset_reached attribute for the next event in one of the calendars turned true.

Draluak avatar Nov 07 '22 18:11 Draluak

Someone sent me one of their corrupted files and it reads like the event was added to the wrong calendar when stored. I don't yet know the cause, but can take it from here. Thanks for the reports folks.

allenporter avatar Nov 08 '22 04:11 allenporter

I was able to reproduce the issue by having multiple search for the same calendar. The bug is in the google calendar API as it returns the same sync token for all searches, even if they are different, violating the contract of the API.

I am going to have to revert the use of local sync for anything involving search, which is unfortunate. I'll work on making a duplicate code path for search.

allenporter avatar Nov 08 '22 05:11 allenporter