Voice commands for switches

I have several Z-Wave switches in addition to my Z-Wave lighting controllers. They show up differently inside of HA. I can say or type “Turn off the kitchen light” as that is classified as a light. I cannot say “Turn off the living room light” as that is classified as a switch. I’ve gone through the sentence parsing and it cannot find any targets. It always finds the lights but I cannot find any valid sentence for the switches. The parser finds the targets for the lights but cannot find the targets for the switches. Here are my questions:

  1. How do I find the actual sentences recognized in general (not the git test suite)
  2. How do I turn on and off a switch by specifying an area not the actual switch name

Turn the switches to light, it will solve the problem.

The first question is not entirely clear. The answer to the second is custom sentences.

There is a list of built-in sentences here:

They can use area names, but “turn on” seems to apply to lights not switches.

You can change your switch to a light, as suggested, or simply give it an alias “living room light”. Otherwise it’s custom sentences.

The first sentence is entirely purpose driven. I want to iterate and know every single sentence that is actually accepted by the basic voice command system. I constantly get responses of “Sorry, I couldn’t understand that” when it is an obviously recognizable sentence (but really isn’t). Without any kind of knowledge of what is accepted, it is difficult to diagnose and fix the issue.

Now that integration suggestion is probably going to work great, but why is it even necessary? Shouldn’t anything with an on-off switching capability work the same way internally? This seems like a design miss. Also, why should I need a custom sentence when I’m simply turning on and off a light?

There is a generalization issue here that the parser cannot overcome because a switch and light are different classes.

Similar to my response to the prior reply, why are these treated differently? I’ve spent a few hours today trying to figure out how to do this and it seems wrong. I am a software architect and am fresh to this platform. I would like to contribute and this bit is significantly frustrating.I don’t even know where to begin here.

Because there are no context commands for switches in the system. Few people need this (often it’s undesirable and dangerous). However, it remains possible to implement it individually.

Reply to my reply, that integration worked on my example switch. Thank you!

I’m still trying to understand the context issues as stated by mchk.

There are many critical devices in the switch domain that we make available for voice control, but which you would never want to turn off with an accidental command like “turn off all switches” or “turn off all switches in the kitchen.” Therefore, such built-in commands do not exist. If you need them, create them yourself.

2 Likes

Got it!

Now, new question, what’s the best way to add these commands myself?

I already used the add-on to change the switch to appear as a light and that is doing what I need, but I want to learn about these kinds of details so I’m not floundering around in the system like I have been.

All the information is in the documentation mentioned earlier, give yourself time to comprehend it.
You will just need to create new automations.
The only point for which there is no clear example, and the information is scattered in other sections, is getting room information from the device itself. I recommend looking at these two answers - 1 2

2 Likes
1 Like