PiotrMachowski / Home-Assistant-custom-components-Google-Keep

This sensor uses gkeepapi library to download a list of notes from https://keep.google.com/.
MIT License
66 stars 8 forks source link

Getting Missing KeyError 'email' in self._collaborators #19

Closed gpitel closed 2 years ago

gpitel commented 3 years ago

Last week the Google Keep integration stopped working. I have uninstalled a installed again a few times without luck, and rebooted HA even more. The yaml settings and log output are provided below. I am using:

SYSTEM (10/15/2021) core-2021.10.4 supervisor-2021.10.0 Home Assistant OS 6.5

Great work with the plugin by the way. My family uses this for a HA dashboard, which from the looks of the key error (collaborator + email), maybe Google changed their API regarding Keep Collaborators on their side?

CONFIG

  - platform: google_keep
    username: username@gmail.com
    password: secret
    titles:
      - 'Home Tasks'
    pinned: false

ERROR LOG

Logger: homeassistant.components.sensor
Source: custom_components/google_keep/sensor.py:39
Integration: Sensor (documentation, issues)
First occurred: October 14, 2021, 2:05:48 AM (1 occurrences)
Last logged: October 14, 2021, 2:05:48 AM

Error while setting up google_keep platform for sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/node.py", line 213, in load
    self._load(raw)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/node.py", line 1200, in _load
    self.collaborators.load(
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/node.py", line 837, in load
    self._collaborators[collaborator['email']] = RoleValue(collaborator['role'])
KeyError: 'email'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/google_keep/sensor.py", line 39, in setup_platform
    login_success = keep.login(username, password)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 695, in login
    self.load(auth, state, sync)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 741, in load
    self.sync(True)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 994, in sync
    self._sync_notes(resync)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 1042, in _sync_notes
    self._parseNodes(changes['nodes'])
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/__init__.py", line 1078, in _parseNodes
    node = _node.from_json(raw_node)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/node.py", line 1856, in from_json
    node.load(raw)
  File "/usr/local/lib/python3.9/site-packages/gkeepapi/node.py", line 215, in load
    raise_from(exception.ParseException('Parse error in %s' % (type(self)), raw), e)
  File "/usr/local/lib/python3.9/site-packages/future/utils/__init__.py", line 403, in raise_from
    exec(execstr, myglobals, mylocals)
  File "<string>", line 1, in <module>
gkeepapi.exception.ParseException: Parse error in <class 'gkeepapi.node.Note'>
PiotrMachowski commented 3 years ago

Could you try to update manifest to the following version and restart your HA?

{
  "domain": "google_keep",
  "name": "Google Keep",
  "documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Google-Keep",
  "dependencies": [],
  "codeowners": ["@PiotrMachowski"],
  "requirements": ["gkeepapi==0.13.6"],
  "version": "v1.1.1"
}
gpitel commented 3 years ago

I changed the manifest located in directory

\\xx.168.1.xx\config\custom_components\google_keep

The json before was:

{
  "domain": "google_keep",
  "name": "Google Keep",
  "documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Google-Keep",
  "dependencies": [],
  "codeowners": ["@PiotrMachowski"],
  "requirements": ["gkeepapi==0.11.16"],
  "version": "v1.1.1"
}

Upon reset I am still getting the same email/collaborator error.

PiotrMachowski commented 3 years ago

Ok, so it seems like an issue with gkeepapi

gpitel commented 2 years ago

I got around this problem a while ago. Not sure what the exact fix was... rolling back to an older version, re-installing, etc.

26 is the more immediate issue I am dealing with now