Sync Alexa Shopping List with Home Assistant

I was experimenting with this:

They initially only supported Amazon UK and they recently added Amazon US as well, however in my experiments in the past week I’m sad to report that it’s not working reliably as well. I’ll follow up with the people behind this project and report the issues I’m encountering, I have a feeling they mainly debug this with Amazon UK, and apparently the websites are somewhat different. Maybe together we’ll be able to solve the issues I’m seeing and maybe it could be a good solution moving forward. Not yet, but there’s hope for the future… I’ll report back once there’s some progress…

2 Likes

I’ve been able to get the client.py to pull the items from my Alexa Shopping List however I have not had any success getting the custom component to update my HA shopping list…so close!!!

For me it would be fantastic if a real sync between HA and Alexa Shopping list would work… So adding and deleting would work in both directions… This would be a great thing because the Alexa App is so bad (slow and clunky), a nice HA Dashboard would be a real treat :slight_smile:

1 Like

I was in the same boat and posted an issue on the Github repo and the developer quickly responded. I’m using the HASS add-on and entered the IP Address of my HASS instance into the integration and it didn’t work. When I changed it to “localhost” and enabled debugging, it worked for me. Not sure if the debugging is necessary, but that’s what got the sync to start working.

Is there any way to modify the quantity, remove 1 apple, of the Alexa list without deleting the entire item?

hello my friends, im new here, and looking for the same soluction you are. anybody finded soluction ? or using python are the best at moment ?

I was sad… I couldn’t get the Alexa Shopping List add-on to work for me. So… I developed my own Alexa Skill using AI and now I can pretty much make Alexa do anything I need it to do in regards to Home Assistant, like getting a status of a sensor and adding/removing items to/from the HA Shopping List. All of my code has been uploaded to a repository on GitHub here. I haven’t had the time to write an in-depth tutorial, but it’s essentially identical to the process for creating Home Assistant’s Alexa Smart Home Skill. If anyone tries it out or attempts to reverse engineer it, I’m happy to answer any questions to the best of my ability.

I explain more of how the skill works in this thread - Using Alexa Media Player “last called” service - #52 by Pirol62

Very nice work!!! I tried many other solution without success. Your is working fine.
congratulations.

I updated the process in Node-RED to delete the items directly in Alexa after the synchronization finishes successfully.
in this way


its working fine
the principal part is the function definition:

let items = msg.payload;

// 1. Create the string for Home Assistant
let displayValues = items.map(item => item.value);
let hstMsg = { payload: displayValues.join(',') };

// 2. Prepare ALL items for deletion (No filter)
let itemsToDelete = items.map(i => {
    return {
        payload: {
            item: String(i.id),
            version: parseInt(i.version)
        }
    };
});

return [hstMsg, itemsToDelete];

and in Remove Item node like this:

1 Like

Can you please share the nodered JSON code?
am trying to replicate but am running into a lot of issues. Truly appreciate it.

I wanted to do this too but quickly found out the API is no longer available for list and didn’t like the selenium way

Hi all,
Here is the JSON code

[{“id”:“3141360816c8e7b4”,“type”:“tab”,“label”:“Flow 1”,“disabled”:false,“info”:“”,“env”:},{“id”:“e43b77dd4550b44a”,“type”:“ha-button”,“z”:“3141360816c8e7b4”,“name”:“Update Shopping List”,“version”:0,“debugenabled”:false,“outputs”:1,“entityConfig”:“xxxxxxxxxxxxxxxxx”,“outputProperties”:[{“property”:“payload”,“propertyType”:“msg”,“value”:“string”,“valueType”:“entityState”},{“property”:“topic”,“propertyType”:“msg”,“value”:“”,“valueType”:“triggerId”},{“property”:“data”,“propertyType”:“msg”,“value”:“”,“valueType”:“entity”}],“x”:520,“y”:200,“wires”:[[“9090b4260abf7e93”,“1220666b30e15dab”]]},{“id”:“f209edffca5b827a”,“type”:“alexa-remote-event”,“z”:“3141360816c8e7b4”,“name”:“”,“account”:“put here your data”,“event”:“ws-device-activity”,“x”:210,“y”:200,“wires”:[[“1880922c1bc91fa5”,“a538251f7c35f6fc”]]},{“id”:“67c372ab5edd5da2”,“type”:“inject”,“z”:“3141360816c8e7b4”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“0 7-21 * * *”,“once”:false,“onceDelay”:“10”,“topic”:“”,“payload”:“”,“payloadType”:“date”,“x”:610,“y”:100,“wires”:[[“9090b4260abf7e93”]]},{“id”:“1880922c1bc91fa5”,“type”:“switch”,“z”:“3141360816c8e7b4”,“name”:“Success?”,“property”:“payload.data.utteranceType”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“GENERAL”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:420,“y”:140,“wires”:[[“3fb7de8493caf86e”]]},{“id”:“3fb7de8493caf86e”,“type”:“switch”,“z”:“3141360816c8e7b4”,“name”:“Shopping list?”,“property”:“payload.description.summary”,“propertyType”:“msg”,“rules”:[{“t”:“cont”,“v”:“shopping list”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:600,“y”:140,“wires”:[[“9090b4260abf7e93”]]},{“id”:“9090b4260abf7e93”,“type”:“alexa-remote-list”,“z”:“3141360816c8e7b4”,“name”:“”,“account”:“put here your data”,“config”:{“option”:“getListItems”,“value”:{“list”:{“type”:“str”,“value”:“put here your data”}}},“x”:800,“y”:140,“wires”:[[“dd354411878a7aad”,“bbaba99cd9e5caf2”]]},{“id”:“dd354411878a7aad”,“type”:“debug”,“z”:“3141360816c8e7b4”,“name”:“debug 5”,“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“payload”,“targetType”:“msg”,“statusVal”:“”,“statusType”:“auto”,“x”:800,“y”:100,“wires”:},{“id”:“bbaba99cd9e5caf2”,“type”:“function”,“z”:“3141360816c8e7b4”,“name”:“function 1”,“func”:“let items = msg.payload;\n\n// 1. Create the string for Home Assistant\nlet displayValues = items.map(item => item.value);\nlet hstMsg = { payload: displayValues.join(‘,’) };\n\n// 2. Prepare ALL items for deletion (No filter)\nlet itemsToDelete = items.map(i => {\n return {\n payload: {\n item: String(i.id),\n version: parseInt(i.version)\n }\n };\n});\n\nreturn [hstMsg, itemsToDelete];”,“outputs”:2,“timeout”:0,“noerr”:0,“initialize”:“”,“finalize”:“”,“libs”:,“x”:980,“y”:140,“wires”:[[“0de6aa72dc8b9498”,“f28f388d41228b77”],[“1db7fbe78770d13a”]]},{“id”:“0de6aa72dc8b9498”,“type”:“debug”,“z”:“3141360816c8e7b4”,“name”:“debug 7”,“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:“”,“statusType”:“auto”,“x”:980,“y”:80,“wires”:},{“id”:“f28f388d41228b77”,“type”:“api-call-service”,“z”:“3141360816c8e7b4”,“name”:“Transfer value to HASS”,“server”:“put here your data”,“version”:7,“debugenabled”:false,“action”:“input_text.set_value”,“floorId”:,“areaId”:,“deviceId”:,“entityId”:[“input_text.shoppingliststring”],“labelId”:,“data”:“{"value":"{{payload}}"}”,“dataType”:“json”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“blockInputOverrides”:false,“domain”:“input_text”,“service”:“set_value”,“x”:1290,“y”:80,“wires”:[]},{“id”:“a538251f7c35f6fc”,“type”:“debug”,“z”:“3141360816c8e7b4”,“name”:“debug 9”,“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:“”,“statusType”:“auto”,“x”:220,“y”:100,“wires”:},{“id”:“1220666b30e15dab”,“type”:“alexa-remote-list”,“z”:“3141360816c8e7b4”,“name”:“”,“account”:“put here your data”,“config”:{“option”:“getListItems”,“value”:{“list”:{“type”:“str”,“value”:“put here your data”}}},“x”:800,“y”:280,“wires”:[[“444d0218fd3d5332”]]},{“id”:“444d0218fd3d5332”,“type”:“function”,“z”:“3141360816c8e7b4”,“name”:“function 2”,“func”:“let items = msg.payload;\n\n// 1. Create the string for Home Assistant\nlet displayValues = items.map(item => item.value);\nlet hstMsg = { payload: displayValues.join(‘,’) };\n\n// 2. Prepare ALL items for deletion (No filter)\nlet itemsToDelete = items.map(i => {\n return {\n payload: {\n item: String(i.id),\n version: parseInt(i.version)\n }\n };\n});\n\nreturn [hstMsg, itemsToDelete];”,“outputs”:2,“timeout”:0,“noerr”:0,“initialize”:“”,“finalize”:“”,“libs”:,“x”:980,“y”:280,“wires”:[[“cf1da4149b38235a”],[“e181a591ab85639b”]]},{“id”:“cf1da4149b38235a”,“type”:“api-call-service”,“z”:“3141360816c8e7b4”,“name”:“Transfer value to HASS”,“server”:“put here your data”,“version”:7,“debugenabled”:false,“action”:“input_text.set_value”,“floorId”:,“areaId”:,“deviceId”:,“entityId”:[“input_text.shoppingliststringfarmacia”],“labelId”:,“data”:“{"value":"{{payload}}"}”,“dataType”:“json”,“mergeContext”:“”,“mustacheAltTags”:false,“outputProperties”:,“queue”:“none”,“blockInputOverrides”:false,“domain”:“input_text”,“service”:“set_value”,“x”:1270,“y”:280,“wires”:[]},{“id”:“de3c5fa27fb7a997”,“type”:“alexa-remote-list”,“z”:“3141360816c8e7b4”,“name”:“”,“account”:“put here your data”,“config”:{“option”:“removeItem”,“value”:{“list”:{“type”:“str”,“value”:“put here your data”},“item”:{“type”:“msg”,“value”:“payload.item”},“version”:{“type”:“msg”,“value”:“payload.version”}}},“x”:1190,“y”:400,“wires”:[[“86c031919ee649b3”]]},{“id”:“86c031919ee649b3”,“type”:“debug”,“z”:“3141360816c8e7b4”,“name”:“debug 2”,“active”:false,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“true”,“targetType”:“full”,“statusVal”:“”,“statusType”:“auto”,“x”:1220,“y”:540,“wires”:},{“id”:“e181a591ab85639b”,“type”:“delay”,“z”:“3141360816c8e7b4”,“name”:“”,“pauseType”:“delay”,“timeout”:“1”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“allowrate”:false,“outputs”:1,“x”:980,“y”:400,“wires”:[[“de3c5fa27fb7a997”]]},{“id”:“1db7fbe78770d13a”,“type”:“delay”,“z”:“3141360816c8e7b4”,“name”:“”,“pauseType”:“delay”,“timeout”:“1”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“allowrate”:false,“outputs”:1,“x”:980,“y”:200,“wires”:[[“32463a6c032c0ba6”]]},{“id”:“32463a6c032c0ba6”,“type”:“alexa-remote-list”,“z”:“3141360816c8e7b4”,“name”:“”,“account”:“put here your data”,“config”:{“option”:“removeItem”,“value”:{“list”:{“type”:“str”,“value”:“put here your data”},“item”:{“type”:“msg”,“value”:“payload.item”},“version”:{“type”:“msg”,“value”:“payload.version”}}},“x”:1170,“y”:200,“wires”:[]},{“id”:“xxxxxxxxxxxxxxxxx”,“type”:“ha-entity-config”,“server”:“xxxxxxxxxxxxxxxxx”,“deviceConfig”:“xxxxxxxxxxxxxxxxx”,“name”:“Update Shopping List”,“version”:6,“entityType”:“button”,“haConfig”:[{“property”:“name”,“value”:“Updat Shopping List”},{“property”:“icon”,“value”:“”},{“property”:“entity_picture”,“value”:“”},{“property”:“entity_category”,“value”:“config”},{“property”:“device_class”,“value”:“update”}],“resend”:false,“debugEnabled”:false},{“id”:“xxxxxxxxxxxxxxxxx”,“type”:“server”,“name”:“Home Assistant”,“addon”:true},{“id”:“xxxxxxxxxxxxxxxxx”,“type”:“ha-device-config”,“name”:“Node Red Buttons”,“hwVersion”:“”,“manufacturer”:“Node-RED”,“model”:“”,“swVersion”:“”},{“id”:“7bdc5fa7eae53679”,“type”:“global-config”,“env”:,“modules”:{“node-red-contrib-home-assistant-websocket”:“0.80.3”,“node-red-contrib-alexa-remote2-applestrudel”:“5.0.55”}}]

After being away for some time, I finally found the time to get back to this setup. Thank you @freitasaz for the improvements and great ideas. I took some of them, modified and improved, I added a full explanation and my most updated code to my page here: