SavageCore / HA_Addons

MIT License
4 stars 0 forks source link

No entity match error #12

Closed RocketKuhr closed 2 weeks ago

RocketKuhr commented 2 weeks ago

Hi,

i get an error in protocoll.

[13:16:44] INFO: Starting Alexa Shopping List Sync [2024-09-03 13:16:59 +0200] [85] [INFO] Running on http://0.0.0.0:5000 (CTRL + C to quit) [2024-09-03 13:16:59,279] [ERROR] An error occurred while fetching items: Failed to get items: {'code': 'home_assistant_error', 'message': 'Service call requested response data but did not match any entities'}

Verison is 0.1.4, installed on Intel Nuc, running HASS OS. There is one item in my Alexa-List, which I created new.

SavageCore commented 2 weeks ago

OK, try 0.1.5 and let me know how you get on. You'll still see that messaged logged but it should return None so that the script will continue adding items...

RocketKuhr commented 2 weeks ago

Hi, unfortunately I get the same error. BrVon meinem iPhone gesendetAm 03.09.2024 um 17:32 schrieb Oliver Sayers @.***>: OK, try 0.1.5 and let me know how you get on

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

SavageCore commented 2 weeks ago

Hmm, can you try the request manually for me? Download insomnia and create a new WebSocket request.

The url to replace wss://example.com/chat is your ha_url

Select JSON in the first dropdown and send the auth request:

{
  "type": "auth",
  "access_token": "ey..."
}

Replacing access_token with ha_token then click Send. That should connect you and you'll receive auth_ok back.

Then enter the following JSON to make the request:

{
  "id": 1,
  "type": "call_service",
  "domain": "todo",
  "service": "get_items",
  "return_response": true,
  "service_data": {
    "entity_id": "todo.shopping_list"
  }
}

What is shown under data?

If HA is working correctly then you should receive similar to this:

{
    "id": 1,
    "type": "result",
    "success": true,
    "result": {
        "context": {
            "id": "",
            "parent_id": null,
            "user_id": ""
        },
        "response": {
            "todo.shopping_list": {
                "items": [
                    {
                        "summary": "Milk",
                        "uid": "",
                        "status": "needs_action"
                    }
                ]
            }
        }
    }
}

Also just to check, the shopping list intergration is installed, right? https://www.home-assistant.io/integrations/shopping_list

Do you get the same issue if you manually add something else to the list?

RocketKuhr commented 2 weeks ago

Hi again,

get it now…had to change the entity_id to „todo.einkaufsliste“ (german 😉 ) If read the homeassistant_websocket.py right, then is this the reason why i didn´t get items. Because my call is { "id": 1, "type": "call_service", "domain": "todo", "service": "get_items", "return_response": true, "service_data": { "entity_id": "todo.einkaufsliste" } }

right? Possible to made runnable for german also?

btw, this is the response:

{ "id": 1, "type": "result", "success": true, "result": { "context": { "id": "01J6Y5YYA0JP0CGH0NX38KQFC4", "parent_id": null, "user_id": "98aa881e02724d80ad623249ee4a863e" }, "response": { "todo.einkaufsliste": { "items": [ { "summary": "test", "uid": "95a279323f8c49ec9a69966c09094522", "status": "needs_action" }, { "summary": "bla", "uid": "f4e87f90d3fe4a23b77a7850b6ab010e", "status": "needs_action" } ] } } } }

SavageCore commented 2 weeks ago

Thanks for doing that. Yup, the issue is the entity_id.

2 ways around this. First is to just change your entity_id:

Go to Settings => Devices & Services => Entities then search for todo and change Shopping list / Einkaufsliste Entity ID* to todo.shopping_list

That should work, although not sure what side effects it will have with other parts of HA. Can you still manually change the list?

Second, I've started to rework the code to change this based on selected language. I'd appreciate if you can test it! My entity_id wasn't updating when changing language, so I believe that gets set on first install or something.

To try it out, you can stop the add-on from my repo. Then install it locally. To do that:

  1. Enable and setup the Samba share add-on or otherwise get to your addons directory
  2. Download the code and extract it into addons/alexa_shopping_list_sync so you have addons/alexa_shopping_list_sync/Dockerfile etc.
  3. Go to the HA add-on store and check for updates (top right 3 dot menu)
  4. Install Alexa Shopping List Sync from under Local add-ons
  5. Configure and start as usual

It may well be best to just let people know in the readme to update their entity_id though... hmm.

RocketKuhr commented 2 weeks ago

This works! I´ve tried it with the locally from my samba share. First I got an error "requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:..." But saw then, that i generated the HA_Token for a user which is only allowd to login locally. After i changed that, it works. Now I got all new items from alexa-shopping list in my HA-shopping list. Nice work man!!

SavageCore commented 2 weeks ago

Thanks for confirming, I will push an update later, once that happens you can then uninstall the local version and continue with the one from the repo.

Ideally I'll get a full list of translations for this...