jekalmin / extended_openai_conversation

Home Assistant custom component of conversation agent. It uses OpenAI to control your devices.
916 stars 129 forks source link

randomly dont find (all) entities #99

Open bsakab opened 8 months ago

bsakab commented 8 months ago

image

Very often an entity cannot be found in for my living room Fehler: "Something went wrong: Unable to find entity ['light.livingroom_couch']"

If I ask the assistant to show me all known entities for this room the list varies randomly

any idea

--- version 1.0 and version 1.0.1 beta1 (update) only version 1.0.1 beta1, messed up downgrade

Traceback (most recent call last): File "/config/custom_components/extended_openai_conversation/init.py", line 173, in async_process response = await self.query(user_input, messages, exposed_entities, 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/extended_openai_conversation/init.py", line 299, in query message = await self.execute_function_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/extended_openai_conversation/init.py", line 344, in execute_function result = await function_executor.execute( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/extended_openai_conversation/helpers.py", line 197, in execute return await self.execute_service( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/extended_openai_conversation/helpers.py", line 238, in execute_service self.validate_entity_ids(hass, entity_id or [], exposed_entities) File "/config/custom_components/extended_openai_conversation/helpers.py", line 165, in validate_entity_ids raise EntityNotFound(entity_ids) custom_components.extended_openai_conversation.exceptions.EntityNotFound: Unable to find entity ['light.livingroom_couch']

bsakab commented 8 months ago

(update) only version 1.0.1 beta1, messed up downgrade

jekalmin commented 8 months ago

Thanks for reporting an issue.

Please correct me if I'm wrong.

If this is true, it seems it should also happen in 1.0.1-beta1. It's gpt which passed a wrong entity_id.

bsakab commented 8 months ago

You are absolutely right The name of the entity is: light.livingroom_couch but the ID of the entity is: light.light_livingroom_couch

That could be the reason why chatgpt is confused. I tested it and the prompt "switch on light light_livingroom_couch" works and "switch on light livingroom_couch" does not work So avoiding multiple terms like "light" in the entity id should fix this problem.

I downgraded from the beta to stable 1.0 Version and I thought it fixed that issue. But today that behavior appeared also on Version 1.0.

Thanks for ypur support.

jekalmin commented 8 months ago

So avoiding multiple terms like "light" in the entity id should fix this problem.

I think so. Since entity_id and friendly_name of attributes matter in gpt, changing entity_id might solve the problem.

ayjbachata commented 7 months ago

I've also seen this issue a lot. So the solution is to edit entity IDs to avoid duplicates? Or is it to have the full entity ID match the friendly name?

Do aliases help with this?