Google Calendar integration: Can't add new entity to calendar

I have successfully set up the google calendar integration following the description given here:

But when I try to add a new entity to one of my calendars or change an entity (add a name, for example), this duplicates the old entry for the calendar and the new entity is not present in under the Developer Tools->States page.

For example:
I have this (automatically generated) entry in google_calendars.yaml:

- cal_id: [email protected]
  entities:
  - device_id: private
    ignore_availability: true
    name: Private
    track: true

This device works and it’s present as calendar.private on the States page.

I add another entity like this as described in the documentation linked above:

- cal_id: [email protected]
  entities:
  - device_id: private
    ignore_availability: true
    name: Private
    track: true
  - device_id: test
    ignore_availability: true
    track: true
    search: test

After saving and rebooting, I end up with the original calendar appended to my change and no new entry for calendar.test in the States pages. This is the resulting google_calendars.yaml:


- cal_id: [email protected]
  entities:
  - device_id: private
    ignore_availability: true
    name: Private
    track: true
  - device_id: test
    ignore_availability: true
    track: true
    search: test
- cal_id: [email protected]
  entities:
  - device_id: private
    ignore_availability: true
    name: Private
    track: true

What am I doing wrong? If not in the google_calendars.yaml, where and how am I supposed to add a new entry with a search to the calendar?

Thanks!

track_new_calendar

(boolean)(Optional)

Will automatically generate a binary sensor when a new calendar is detected. The system scans for new calendars only on startup.

Default value:

true

Not sure why it is finding another calendar. The first thing it does when it finds a calendar is check if the cal_id already exists…

    def _found_calendar(call):
        """Check if we know about a calendar and generate PLATFORM_DISCOVER."""
        calendar = get_calendar_info(hass, call.data)
        if hass.data[DATA_INDEX].get(calendar[CONF_CAL_ID], None) is not None:
            return

Just checking, you’re not changing the cal_id hopefully.

You could try changing the track_new_calendar to false. It will stop it from adding another one, but not sure if the problem is something bigger than just having a duplicate…

google:
  client_id: YOUR_CLIENT_ID
  client_secret: YOUR_CLIENT_SECRET
  track_new_calendar: false

Thanks for your answer!
You confirmed that my approach should have worked, that was an important step :slight_smile: I only changed the cal_id for the example I gave here.

Setting the track_new_calendar to false did nothing, that confirmed your suspicion that something bigger was going on.

I redid the setup (including creating new credentials for google) and now it seems to work.
And thanks for the idea to check the source itself, will do that next time!