Sync your Alexa/Todoist shopping list to the Home Assistant shopping list!

I’m unable to get this working.

I’m running Home Assistant Docker.
I install pyscript
It couldn’t find the integration, but I enabled it in my configuraiton.yaml file
I added shopping_list_sync.py to /config/custom_components/pyscript (I also tried making a new folder “pyscript” directly in config)
I reloaded home assistant and went to developer tools, but it only finds pyscript.reload and pyscript start jupyter kernel. I can’t find where I’m supposed to put my files such that they show up in services.

Can someone point me in the right direction for where I’m messing up?

I found out what was going wrong by checking the logs and it was… a lot

First, since I’m using docker I needed to add the pyscript and pyscript_modules folders to my persistent directory I set up when I made a docker instance.

Then I needed to enable execution rights to the shopping_list_sync.py after I made it

chmod +x shopping_list_sync.py

then for some reason I just can’t fathom, it didn’t like the file name “write_file.py” in my pyscript_modules folder so I had to change this to “wf.py”

And of course this meant I needed to change line 7 from

import write_file

to

import wf

and change line 8 from

write_file = reload(write_file)

to

write_file = reload(wf)

once I had made those changes it worked in my container on Truenas.

Now I just need to find out why it doesn’t automatically update my list when something is added on todoist and fix that blocking warning others have been referencing

I was having this problem too. I had to go back to the todoist page and reauthorize the integration, somehow it had lost it’s authorization.

Working perfectly! My Home Assistant is not accessible off-grid (only via tailscale), so I created a button to update the shopping list (triggering the service) next to that list, and an automation to update it a few times a day

Thanks!

All done but got a weird one.

If I add an item or remove an item in HA it pushes it to Todoist and then to alexa, but wont work in return. If i remove an item from Alexa it pushes it to todoist but then not to HA. Manually calling the service fixes it, so I assume its the webhook not working correctly.

I have a weird one…
I also use the “Bring!” integration to sync my Bring! shopping list to HA. This works ok, but because its happening in the back end and not the UI, it doesn’t appear to fire the “shopping_list_updated” event. I know that’s a problem with that particular integration, but I was wondering if its possible to modify this one so it can look through the items on HA and compare them to the items on Todoist and if its not in Todoist, add it (or mark it as completed when its completed).

Also, for those who were having the “blocking call” issue, I was able to update @MrLemur’s code to make it work without the blocking call. I’m far from a python programmer but I was at least able to make these mods to fix the blocking call thanks to the link @fenty17 posted.
My updated version of the code is available here: https://github.com/alexisspencer/shopping_list_sync

2 Likes

@alexismadd - thanks so much for sharing! Delighted to have one less log error!

FYI - my setup of this successfully keeps all lists in sync, regardless of whether I update via HA, Todoist or Alexa.

Glad to help! As I said, I’m far from a python coder but I do have some coding background in other languages that have some similarities so I was able to make those adjustments at least…
I too wasn’t enjoying seeing the errors appearing. Lol
I’m happy for @MrLemur to grab my code adjustments if he thinks they’re OK and update this original post.

1 Like

thanks for this integrations, works flawlessly but I managed to add both shopping list and to do list from alexa …todoist and ha…problem is when i call shopping list script it updated to shopping list and same for todo list but it doesn’t show both at the same time…i want both the categories to be shown say one for shopping list and one for todo list…is it possible to do like that in ha frontend?

Ca anyone help me with Teamviever? I Installled all but it did not work. Please PN me thanks.

The main issue with trying to sync both is there’s only one “shopping list” in home assistant. So if you have a web hook from your Alexa-sync’d to do list in todoist, the home assistant side will simply add/remove from your shopping list

yeah…but no option to have both projects displaced at the same time…But no worries, I found a todoist card from there iam able to add other projects in dashboard.

I followed all the instructions but the shopping_list_sync service IS NOT CREATED
Thank you

I am really new to this scripting. i am looking at my config and i do not see a “pyscript_modules”??

I followed this instruction and I got it to work. I had a couple problems because I wasn’t putting the files in the specified folders, but now it propagates changes both ways from and to the alexa shopping list.

The same happens to me. let’s see if someone can help us
Thank you

Got this working after a few false starts.
First: when you create the first .py file there are two lines you need to update - the API goes in quotation marks on the line for token and the project ID has no quotation marks and neither should have the <> symbols there once you fill the required info.

Creating an automation - Ive never used webhooks before so I didn’t set the trigger as a webhooks. I had tried similar trick to the project ID above just tacking on the number in the url when I was looking at the automation.

Creating the project in todolist: you need a name but you don’t need the app url. Skip that and do the webhooks further down, use v9 and pay attention to the different save buttons.

It all works a treat now, thanks for creating it!

1 Like

Hi! Can you please especify what quotation was that? The service pyscript_sync_shpping_list simply doesn’t apear for me whatsoever.

is anyone having issues syncing alexa shopping list with to do ist list? I cant get them to sync :frowning:

The same thing has been happening to me for a few days.

The things that I add in HA are not synchronized with TODOIS and therefore with Alexa.

And what I add to Alexa is added to TODOIST but it doesn’t get updated in HA.

It seems as if HA is isolated.

1 Like