"turn off garage and porch lights" - multiple values for same slot?

That isn’t actually the example I am trying to solve for. I have a robovac tied into my home assistant. I have it setup so from my tablet dashboard i can select specific rooms/zones to vacuum.

I was thinking about it today, I would like to add voice control into this. BUT today I wanted to just have it hit the kitchen and dining room. So I was wondering, if i create an intent called “GoVacuum” with a slot of “room”. Is it possible to say “go vacuum the kitchen and the dining room” and have it recognize “govacuum” as the intent and the slot “room” would be “kitchen, dining room” or something like that?

This would also work for split level hvac, turning on/off multiple lights ect.

Thanks!

Hey CrankyCoder,

I have done something that seems similar to what you are trying to do. I setup a math intent that does addition, subtraction, division and multiplication with slots for num1, num2 and symbol. the sentence looks like this

what is (0…9999){num1} (times | divided by | plus | minus){symbol} (0…9999){num2}

I imagine you can set up something similar but with more sentences. I assume there would be times you would want to only say one room vs two rooms or more. So you would need a sentence that works for each use case

if its easier you can split them into multiple intents as well. Like GoVacuum1 for one room and GoVacuum2 for 2 rooms. Or you can keep it with 1 intent with multiple sentences and have the intent handling code sort it out

Hope this helps!

You can use a slot LIGHTS

([and]) (garage){light1}
([and]) (porch){light2}

sentences.ini:

[OnOff]
turn (on | off){state} $LIGHTS [$LIGHTS] lights

Unfortunately, in Rhasspy there is no repeat parameter ($LIGHTS)+.

Greetings, Jens

In this case, if i said turn off the porch and garage lights, it would return 1 or the other correct? not both?

It would (perhaps) return both of them. Perhaps, as for “light2” explicitely “porch light” is expected.

Keys/values assigned in the JSON result then will be something like {“light1”: “garage”} and {“light2”: “porch ligths”}

Additionally: One could use the overwrite feature also to set some defaults. E.g. my “weather sentence” looks like that (hope you’ll get the idea behind it despite it’s written in german):

wie ( ist | wird ){Type:heute} ( [das] wetter | [der] Wetterbericht [für] ){Device:wetter} [ ( heute | morgen{Type:morgen} | übermorgen{Type:übermorgen} ) ]

That way default weather response will be for today (heute), as long as there is no specific request for tomorrow (morgen) or “in two days” (übermorgen).

turn off garage and porch lights = “slots”: {“light1”: “garage”, “light2”: “porch”, “state”: “off”}

turn off porch and garage lights = “slots”: {“light1”: “garage”, “light2”: “porch”, “state”: “off”}

turn off garage lights = “slots”: {“light1”: “garage”, “state”: “off”}

turn off porch lights = “slots”: {“light2”: “porch”, “state”: “off”}

Using regex light.* on the passed slots should help with processing.

Greeting, Jens

I see. I was able to get it to work. Not quite as “dynamic” as I had hoped, BUT for specific cases this will absolutely work

You may get some more flexibility using a syntax like

[OnOff]
lights=(garage | porch | bed | whatever )
turn (on | off){state} <lights>{light1} [[[and] <lights>{light3}] [and] <lights>{light2}] lights 
1 Like

Hey rejoe2,

the example applies to the current possibilities and can certainly be written more beautifully.
If there were a repetition operator, it would look like this:

You can use a slot LIGHTS

(garage){light1}
(porch){light2}

sentences.ini:

[OnOff]
turn (on|off){state} ([and] $LIGHTS)+2 lights

I would definitely store the keys in the slot file.

Greetings, Jens

Hi jens-schiffke,

using a slot (instead of the variable) might be a good idea, especially in case one want’s to use this piece of info as well in the controller software (in FHEM, we do not yet look at the slot Rhasspy is pointing to).
Wrt. to including the hard coded key names in the slot as well, unfortunately I don’t have no clue yet about the advantage. This may be different in case the repetition request is accepted and changes the structure of the delivered data.
On the other hand, one will have to deal with the question how to deterime which elements make part of the array to do a loop upon. In Perl this is relatively easy, as we can do that kind of operation via a regex-over-keys to array function. Might be more tricky in other programming lanuages.