intents icon indicating copy to clipboard operation
intents copied to clipboard

Switch Domain not Working

Open Johnson145 opened this issue 1 year ago • 17 comments

It looks like I just can't interact with entities of the switch domain. That should work already, shouldn't it? Other domains are working just fine.

Whenever I try to enable or disable a switch, Assist responds with

An unexpected error occurred while handling the intent

Furthermore, the log reveals the following:

2023-07-21 17:46:22.345 ERROR (MainThread) [homeassistant.components.conversation.default_agent] Intent handling error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 216, in async_process
    intent_response = await intent.async_handle(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/intent.py", line 106, in async_handle
    result = await handler.async_handle(intent)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/intent.py", line 423, in async_handle
    raise IntentHandleError(
homeassistant.helpers.intent.IntentHandleError: No entities matched for: name=Nachtsound, area=None, domains=None, device_classes=None

Tested English and German.

Of course, I also double checked that there is an entity called Nachtsound.

If I try the same sentence with an actually unknown entity name, Assist instead responds with:

Sorry, I couldn't understand that

Thus, it actually seems to find the entity, although the log suggests something else.

If I use the new Assist Developer Tool, I get this:

intent:
  name: HassTurnOn
entities:
  name:
    name: name
    value: Nachtsound
    text: nachtsound
targets: {}

Johnson145 avatar Jul 21 '23 15:07 Johnson145

What sentence are you using?

tetele avatar Jul 21 '23 16:07 tetele

In English, for instance Turn on the Nachtsound..

Similar sentences fail the same way, too.

Johnson145 avatar Jul 21 '23 16:07 Johnson145

Is it only for this particular light? Does the problem persist with other lights as well?

Is the switch exposed to Assist?

tetele avatar Jul 24 '23 07:07 tetele

Tested again with multiple entities.

Is it only for this particular light? Does the problem persist with other lights as well?

I found one integration for which the switches work correctly. The switches of at least two other integrations consistently produce the error though.

Is the switch exposed to Assist?

Yes, all of them were exposed. I guess that part is working fine. If I disable the exposure, the error message changes to

Sorry, I couldn't understand that

Error still occurs on the latest HA version.

Johnson145 avatar Sep 21 '23 15:09 Johnson145

Same here. Switches do not work with the same error messages as stated by OP. I am on the latest HA version.

pako-github avatar Dec 04 '23 12:12 pako-github

@pako-github could you please paste the log message?

tetele avatar Dec 04 '23 12:12 tetele

Sure (they are similar to that of OP). It is a switched to turn on/off my wifi through the Fritz!Box integration. It is exposed to the Assistant with alias "Internet". And the switch is working, if I used it on a dashboard.

2023-12-04 12:58:27.181 ERROR (MainThread) [homeassistant.components.conversation.default_agent] Intent handling error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py", line 225, in async_process intent_response = await intent.async_handle( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/intent.py", line 107, in async_handle result = await handler.async_handle(intent) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/intent.py", line 424, in async_handle raise IntentHandleError( homeassistant.helpers.intent.IntentHandleError: No entities matched for: name=Internet, area=None, domains=None, device_classes=None

pako-github avatar Dec 04 '23 12:12 pako-github

Can you post a screenshot of the entity settings popup and another one of all the aliases of this entity?

tetele avatar Dec 04 '23 13:12 tetele

Hope that is what you asked for:

2023-12-04-141007_927x1171_escrotum

2023-12-04-141149_917x890_escrotum

pako-github avatar Dec 04 '23 13:12 pako-github

That's exactly what I wanted to see, but I see nothing wrong with your setup, which doesn't help with troubleshooting.

Are all your switches behaving the same?

tetele avatar Dec 04 '23 13:12 tetele

No, other switch are working (although not as intended, but this is probably a bug in the respective integration). It is strange, that the wifi switch is working without problems if I use it with a card on a dashboard.

pako-github avatar Dec 04 '23 13:12 pako-github

OK, after a little testing, it seems like "slow" switches (i.e. switches that are slow to change state because they have to forward a request upstream) manifest this behavior.

@Johnson145 can you tell us what Nachtsound was? What device/service was behind that switch?

tetele avatar Dec 04 '23 15:12 tetele

@tetele You could be right. At least in my case, Nachtsound is also "slow" in that means. It's toggling the night sound mode of a Sonos speaker. I.e. it probably needs to wait for a (HTTP?) request sent by the Sonos integration. From a user perspective, toggling the entity in Home Assistant does result in an "almost immediate reaction" on the Sonos speaker, but of course it's not a synchronous programming action.

Johnson145 avatar Dec 04 '23 16:12 Johnson145

@synesthesiam do you have any ideas here?

tetele avatar Dec 04 '23 20:12 tetele

Root cause: https://github.com/home-assistant/architecture/discussions/740

tetele avatar Dec 15 '23 14:12 tetele

Is there any work around maybe?

pako-github avatar Dec 19 '23 08:12 pako-github

No, unfortunately

tetele avatar Dec 19 '23 08:12 tetele