Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Domain not Working #1455

Open
Johnson145 opened this issue Jul 21, 2023 · 17 comments
Open

Switch Domain not Working #1455

Johnson145 opened this issue Jul 21, 2023 · 17 comments

Comments

@Johnson145
Copy link
Contributor

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: {}
@tetele
Copy link
Contributor

tetele commented Jul 21, 2023

What sentence are you using?

@Johnson145
Copy link
Contributor Author

In English, for instance Turn on the Nachtsound..

Similar sentences fail the same way, too.

@tetele
Copy link
Contributor

tetele commented Jul 24, 2023

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

Is the switch exposed to Assist?

@Johnson145
Copy link
Contributor Author

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.

@pako-github
Copy link

pako-github commented Dec 4, 2023

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

@tetele
Copy link
Contributor

tetele commented Dec 4, 2023

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

@pako-github
Copy link

pako-github commented Dec 4, 2023

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

@tetele
Copy link
Contributor

tetele commented Dec 4, 2023

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

@pako-github
Copy link

Hope that is what you asked for:

2023-12-04-141007_927x1171_escrotum

2023-12-04-141149_917x890_escrotum

@tetele
Copy link
Contributor

tetele commented Dec 4, 2023

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?

@pako-github
Copy link

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.

@tetele
Copy link
Contributor

tetele commented Dec 4, 2023

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?

@Johnson145
Copy link
Contributor Author

@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.

@tetele
Copy link
Contributor

tetele commented Dec 4, 2023

@synesthesiam do you have any ideas here?

@tetele
Copy link
Contributor

tetele commented Dec 15, 2023

Root cause: home-assistant/architecture#740

@pako-github
Copy link

Is there any work around maybe?

@tetele
Copy link
Contributor

tetele commented Dec 19, 2023

No, unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants