Hello, I would like to apply a rule when a member receives a command, this rule will perform actions on items that always use the same “Prefix”, I tried to create a variable to do this of type String, in the log the rule works very well, on the other hand if I try to carry out a “.sendCommand” on it I have errors, my variable not being an object that stuck, how can I recover the variable “LastVol” which makes it the item “ChromecastBureau_LastVol” and make a “LastVol.sendCommand” the goal being to be able to create a variable
like “(prefix +” _LastVol “). sendCommand (ChromecastBureau_Vol as Number)”
what formatting to carry out to achieve this results?
Thanks for your help
Here the rule
rule "Group Google speech recieved bureau" when Member of Ggh_Speech received command then var prefix = "" var LastVol = "" var triggertDevices = Ggh_Speech?.members triggertDevices.forEach [ i | prefix = i.name.replace("_Speech", "") LastVol = i.name.replace("_Speech", "_LastVol") ] logInfo("Prefix =", prefix) logInfo("Prefix =", LastVol) LastVol.sendCommand(ChromecastShannah_Volume.state as Number) end