No3x / MMM-GoogleDocs-Notes

:memo: MagicMirror Module to display notes from a Google Doc
MIT License
19 stars 0 forks source link

Module Did Not Create Notes File in Google Docs #61

Open raspberrypi9 opened 2 days ago

raspberrypi9 commented 2 days ago

Hi, thank you for the great docs. I followed all the steps and the module said that authorization was successful, but a new docs did not appear in my Google Docs. Thank you for your help.

No3x commented 2 days ago

Hi, the document is created at the first start, or when it is searched for in Google Drive but it is missing.

Do you see either [MMM-GoogleDocs-Notes] Found 1 documents in drive matching the search or [MMM-GoogleDocs-Notes] Did not find your note in drive. in the logs? Please share the logs.

raspberrypi9 commented 2 days ago

[2024-11-20 12:50:41.044] [INFO] Checking git for module: MMM-GoogleDocs-Notes [2024-11-20 12:50:41.168] [LOG] [MMM-GoogleDocs-Notes] authorizing... [2024-11-20 12:50:41.618] [LOG] [MMM-GoogleDocs-Notes] getNoteData [2024-11-20 12:50:43.559] [LOG] [MMM-GoogleDocs-Notes] Failed to list the documents in your drive. The docs API returned an error: Error: unauthorized_client

raspberrypi9 commented 2 days ago

I reauthorized and got this:

[2024-11-20 13:01:36.899] [LOG] [MMM-GoogleDocs-Notes] authorizing... [2024-11-20 13:01:37.180] [LOG] [MMM-GoogleDocs-Notes] getNoteData [2024-11-20 13:01:38.916] [LOG] [MMM-GoogleDocs-Notes] Found 0 documents in drive matching the search {"orderBy":"modifiedTime","q":"mimeType = 'application/vnd.google-apps.document' and name starts with 'MMM' and trashed = false"}. [2024-11-20 13:01:38.917] [LOG] [MMM-GoogleDocs-Notes] Did not find your note in drive.

No3x commented 2 days ago

So the authorization did not work and therefore the module cannot access your Google Drive / Docs at all to create the document. In you user directory is a .credentials directory with a MMM-GoogleDocs-Notes.json file in it. Please delete this file and try to authorize again.

No3x commented 2 days ago

I reauthorized and got this:

[2024-11-20 13:01:36.899] [LOG] [MMM-GoogleDocs-Notes] authorizing... [2024-11-20 13:01:37.180] [LOG] [MMM-GoogleDocs-Notes] getNoteData [2024-11-20 13:01:38.916] [LOG] [MMM-GoogleDocs-Notes] Found 0 documents in drive matching the search {"orderBy":"modifiedTime","q":"mimeType = 'application/vnd.google-apps.document' and name starts with 'MMM' and trashed = false"}. [2024-11-20 13:01:38.917] [LOG] [MMM-GoogleDocs-Notes] Did not find your note in drive.

That's far better. The document should be created now. Make sure to look at the same google account as you used for the authorization step before.

To confirm please restart the Magic Mirror application again and it should log [MMM-GoogleDocs-Notes] Found 1 documents in drive matching the search now.

raspberrypi9 commented 2 days ago

I deleted the Magic Mirror Google Docs Notes json file in the .credentials directory and reran the authorization and it works! Question: The only way it looks like I can get new notes to show up on the Magic Mirror is to kill the magic mirror and restart it. Does it have an automated sync feature where it will update from the google docs and display new notes that I add without restarting the mirror?

Thanks

No3x commented 2 days ago

The module will create a new Google Doc if not present (by using notesPrefix). This implies there is support for only one note at a time currently.

When you edit the document the changes will be shown within the configurable pollFrequency time

default pollFrequency: 5 * 60 * 1000, //5 minutes

I just noticed that the setting maxNotes is outdated by the way.