I struggled with this problem so I thought I would share it and its solution in hopes of helping someone who encounters the same problem.
Running OpenHAB 3.1.0 Release version on a Pi 4B.
I am using Alexa Scenes to control my exterior lights which aggregate many different lights across several different Alexa Skills. I use an Item bound to the Send A Routine channel of an Amazon Echo Thing to run the routine.
It worked great when I sent a specific routine name in a Rule created in the UI. But when I tried to use a value in a Rules file (so I could run different routines on different days, using a map transform of the date to get the desired scene and then second map transform to get the routine name), it would fail. I turned on DEBUG level logging for the AmazonEchoControl binding and saw that the error was that there was no routine with that name. But I knew that there was a routine with the name, and it ran with that name in the UI Rule.
I finally noticed that when it ran in the UI Rule, there were no quotes around the name of the Alexa Routine, but when I ran it from the Rules file, it had double quotes at the
beginning and end.
I found this way to strip the double quotes, and it works!
The complete rule is:
rule "special exterior lighting using map transform"
when Channel "astro:sun:local:set#event" triggered END
then
val formatter = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")
val String TodayString2 = formatter.format(now())
val String SpecialLighting = transform("MAP","special_lighting_dates.map",TodayString2)
val String SpecialLighting_Alexa_Routine = transform("MAP","special_lighting_alexa_routine_names.map",SpecialLighting).replace("\"","")
EchoShowOffice_StartaRoutine.sendCommand( SpecialLighting_Alexa_Routine.toString )
end