I have the following script as the tap_action on a custom-button-card. It passes an integer to a script to tell the script how many times to arrow up in a menu. As written, the script expects an integer value (x) for stepcount. What I’d like to do is substitute for the value x the state of a random helper I created that will supply a random number between 0 and 16.
tap_action:
action: call-service
service: script.denon_favorites_reverse
service_data:
stepcount: x
station: Foobar
When I look at {{ states.sensor.randomsteps.state }} in Developer Tools, it correctly returns an integer, but that specification causes the execution of this tap action to barf and not run, which makes sense now that I think about it because the call to the script doesn’t evaluate the sensor value, it just tries to call the script with the value it has at the time of the call. Is there a way to supply the value of sensor.randomsteps as the stepcount?