[SOLVED] Alexa LastVoiceCommand groups

Tags: #<Tag:0x00007f74523b7c70>

I want to create a rule that triggers on a LastVoiceCommand change on any of my Echo devices.

I have created a Group in the .items files with the different lastVoiceCommand items created in PaperUI:

Group alexaLastVoiceCommand
String amazonechocontrol_echo_e5e78250_G090VP04904403JN_lastVoiceCommand //salon
String amazonechocontrol_echo_e5e78250_G090U5099093193X_lastVoiceCommand //sofa
String amazonechocontrol_echospot_e5e78250_G070RQ1382860GQH_lastVoiceCommand //cuisine
String amazonechocontrol_echoshow_e5e78250_G000WV069115071C_lastVoiceCommand //bureau

and the following rule:

rule “New Voice Command”
when
Item alexaLastVoiceCommand changed
then
logInfo(“Rule New Voice Command”, triggeringItem.name + " changed state from " + previousState + " to " + triggeringItem.state)
end

but the rule never triggers.

It works if I replace the trigger “Item alexaLastVoiceCommand changed” in my rule by
“Item amazonechocontrol_echo_e5e78250_G090VP04904403JN_lastVoiceCommand changed or
Item amazonechocontrol_echospot_e5e78250_G070RQ1382860GQH_lastVoiceCommand changed or
Item amazonechocontrol_echoshow_e5e78250_G000WV069115071C_lastVoiceCommand changed or
Item amazonechocontrol_echo_e5e78250_G090U5099093193X_lastVoiceCommand changed”

I would like to understand what is wrong with my Group approach?

Because you didn’t tell openHAB that the items belonged to the group:

Group alexaLastVoiceCommand
String amazonechocontrol_echo_e5e78250_G090VP04904403JN_lastVoiceCommand (alexaLastVoiceCommand) //salon
....

Notice the group name in brackets?
See: https://www.openhab.org/docs/configuration/items.html#groups

You probably also want your rule trigger to be:

rule “New Voice Command”
when
Member of alexaLastVoiceCommand changed
then
logInfo(“Rule New Voice Command”, triggeringItem.name + " changed state from " + previousState + " to " + triggeringItem.state)
end

It works great! Thank you and sorry to have missed such an obvious mistake

Please tick the solution
Thanks