I have the same script over and over, so I am trying to simplify it by rewriting the script to use variables. However, I just can’t get it to work. Can a kind soul please tell me what stupid mistake I am making?
This is the script without variables, which does work:
I think I have narrowed it down further, but I still do not know how to fix it. My variable version of the script now works with all parameters except region_id. I think the Roomba expects region_id to be a string. My hard coded example works because the 9 is within single quotes:
region_id: '9'
I tried forcing the value to be a string using both methods below but neither worked:
I’m no expert here but the description for that page refers to automations and amazon alexa integration. I referenced the script page when i edited your example. Not sure exactly how you are using this though. I’m now assuming both are valid.
If that is indeed the issue i would have expected your solutions to resolve it. Sorry I can’t help further with that.
I see what you’re saying. I swapped it around so that variables is at the same level as sequence, but unfortunately I still have the same issue. I’ll keep plugging away at this. I appreciate your help!
What is the end goal? Are you looking to pass parameters to the script to action them? or are you simply trying to have variables in the top of the script?
Hi @calisro. That’s a fair question. I am pretty certain I formatted my initial script incorrectly, which I can fix. But the ultimate goal is to have one single script to which I pass parameters.
In order to pass parameters, you include a section like this:
fields:
message:
description: Message to send
example: This is a message
target:
description: The group/entity to broadcast to
example: group.downstairs_speakers
media_content_type:
description: The type of media
example: audio/mp3
stop_display:
description: Stop the display at the end
example: true
volume:
description: Specify target volume
example: 0.5
delay_to_stop:
description: The Delay to stop the Display
example: 15
Then you can pass them in. I believe the reason your script above though isn’t working with that 9 is because you defined that variable like this: