Open shedman214 opened 1 month ago
I will update the readme soon but you need to add the rest_command
block from https://github.com/SavageCore/HA_Addons/tree/main/alexa_shopping_list_sync#home-assistant-setup to your main config, then you can setup automations.yml
I will update the readme soon but you need to add the
rest_command
block from https://github.com/SavageCore/HA_Addons/tree/main/alexa_shopping_list_sync#home-assistant-setup to your main config, then you can setup automations.yml
@SavageCore Would this be what I add to my config.yaml
name: "Alexa Shopping List Sync"
description: "Sync your Alexa Shopping List with Home Assistant"
version: "0.1.7"
slug: "alexa_shopping_list_sync"
init: false
url: "https://github.com/SavageCore/HA_Addons/tree/main/alexa_shopping_list_sync"
arch:
- armhf
- armv7
- aarch64
- amd64
- i386
startup: services
ports:
5000/tcp: 5000
options:
email: "joe.bloggs@example.com"
password: "hunter2"
mfa_secret: "OTP Secret"
login_url: "https://www.amazon.co.uk/ap/signin?openid.pape.max_auth_age=3600&openid.return_to=https%3A%2F%2Fwww.amazon.co.uk%2Falexaquantum%2Fsp%2FalexaShoppingList&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_alexa_quantum_uk&openid.mode=checkid_setup&language=en_GB&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0"
list_url: "https://www.amazon.co.uk/alexaquantum/sp/alexaShoppingList"
ha_token: ""
ha_url: "ws://homeassistant.local:8123/api/websocket"
schema:
email: str
password: password
mfa_secret: password
login_url: str
list_url: str
ha_token: str
ha_url: str
@shedman214 No, within configuration.yaml
(the main HA config) add this block:
rest_command:
add_shopping_list_item:
url: "http://localhost:5000/add_item"
method: post
payload: '{"item": "{{ item }}"}'
headers:
Content-Type: application/json
update_shopping_list_item:
url: "http://localhost:5000/update_item"
method: put
payload: '{"item": "{{ item }}", "new_item": "{{ new_item }}"}'
headers:
Content-Type: application/json
complete_shopping_list_item:
url: "http://localhost:5000/complete_item"
method: put
payload: '{"item": "{{ item }}"}'
headers:
Content-Type: application/json
remove_shopping_list_item:
url: "http://localhost:5000/remove_item"
method: post
payload: '{"item": "{{ item }}"}'
headers:
Content-Type: application/json
This defines the rest commands to be used by the automations
@shedman214 No, within
configuration.yaml
(the main HA config) add this block:rest_command: add_shopping_list_item: url: "http://localhost:5000/add_item" method: post payload: '{"item": "{{ item }}"}' headers: Content-Type: application/json update_shopping_list_item: url: "http://localhost:5000/update_item" method: put payload: '{"item": "{{ item }}", "new_item": "{{ new_item }}"}' headers: Content-Type: application/json complete_shopping_list_item: url: "http://localhost:5000/complete_item" method: put payload: '{"item": "{{ item }}"}' headers: Content-Type: application/json remove_shopping_list_item: url: "http://localhost:5000/remove_item" method: post payload: '{"item": "{{ item }}"}' headers: Content-Type: application/json
This defines the rest commands to be used by the automations
@SavageCore do I change "localhost" or leave it?
Yes, leave it as it is. That connects to the internal server started by the add-on.
Thank you
@SavageCore I'm getting this error after i restarted HA.
That means rest_command is already defined somewhere else, have a search for it and just copy and paste the rest of the block without rest_command, making sure it's indented one, currently it isn't.
@SavageCore I think i fixed it right?
Yes, that looks better, you can verify it with a site like https://www.yamllint.com/
rest
needs renaming back to rest_command
Yes, that looks better, you can verify it with a site like https://www.yamllint.com/
rest
needs renaming back torest_command
That worked
@SavageCore is this correct or how do I add this part?
That is correct yes, don't change those, they're HA events from the shopping list add-on.
You can change the alias
, that's just a name for your reference. id
can also be changed but they must be unique.
@SavageCore Final automation, also which shopping list would I add to from home assistant? example would be if I want to add bread to my shopping list from HA?
alias: Shopping list
description: ""
triggers:
- trigger: event
event_type: shopping_list_updated
event_data:
action: add
id: add to list
alias: add list
- trigger: event
event_type: shopping_list_updated
event_data:
action: update
id: update list
alias: update list
- trigger: event
event_type: shopping_list_updated
event_data:
action: remove
id: remove from list
alias: remove list
conditions: []
actions:
- alias: add list
if:
- condition: trigger
id:
- add to list
then:
- action: rest_command.add_shopping_list_item
metadata: {}
data: {}
- alias: update list
if:
- condition: trigger
id:
- update list
then:
- action: rest_command.complete_shopping_list_item
metadata: {}
data: {}
- alias: remove list
if:
- condition: trigger
id:
- remove from list
then:
- action: rest_command.remove_shopping_list_item
metadata: {}
data: {}
mode: single
i added "eggs" to my HA shopping list and got this error?
This is from the add-on
I'd double check you have the correct login_url
and list_url
. Doesn't seem like Selenium is on the login page
@SavageCore I believe i followed the instructions correctly. Login:
List:
@SavageCore so i got it to work and the only issue I have is when I add or remove an item from HA shopping list. it does not add/remove from alexa shopping list.
any update on the remove /and add items through HA. Thank you
@shedman214 I would double check the automation is the same as in the readme. If nothing showing in add-on logs it seems the HA event isn't being listened to
@SavageCore so i got it to work and the only issue I have is when I add or remove an item from HA shopping list. it does not add/remove from alexa shopping list.
With the last HA updates I found that the command to launch the action changes.
alias: 'ASLS: Add new shopping list item to Alexa'
triggers:
- trigger: event
event_type: shopping_list_updated
event_data:
actions: add
-> Change to "action" withot "s"
I was fighting with that, but now in the docs are updated.
@SavageCore so i got it to work and the only issue I have is when I add or remove an item from HA shopping list. it does not add/remove from alexa shopping list.
With the last HA updates I found that the command to launch the action changes.
alias: 'ASLS: Add new shopping list item to Alexa' triggers: - trigger: event event_type: shopping_list_updated event_data: actions: add
-> Change to "action" withot "s"
I was fighting with that, but now in the docs are updated.
@granda1987 everytime I change it to action it adds the " s"back on its own?
everytime I change it to action it adds the " s"back on its own?
The syntax for Home Assistant YAML changed in 2024.10.0: https://community.home-assistant.io/t/update-all-yaml-to-newest-syntax/779140/9
ok what would i update to accommodate for the change?
I have completed the steps to set up the amazon shopping list but for the automation. I cannot find the rest command to add or update the shopping list