With RESTful commands, unable to pass a brightness value I have stored in a helper

The quick and dirty:
I have followed some youtube tutorials on getting the text to scroll from a helper. Works great. However I can’t seem to pass a numerical brightness value.
I have updated the RESTful command to accept brightness, as when I use “brightness: 1” it works. But when I modify the code from the text line, it fails.
The line of code I am using is:
brightness: “{{states[‘input_number.matrix1_brightness’].state}}”

Additional information that may or may not be useful:
I have set up a helper called “input_text.matrix1_text” and I have set up an automation that selects a text preset on the WLED matrix, and then passes the restful command below whenever whatever is in that helper changes.
If I change the brightness line to:
brightness: 1
It dims it to a brightness 1
if I leave it as it is, the text does get displayed, but it is as the brightness of the preset I selected to make sure it is in scrolling text more.

service: rest_command.wled_matrix1_text
data:
brightness: “{{states[‘input_number.matrix1_brightness’].state}}”
text: “{{states[‘input_text.matrix1_text’].state}}”

So how do I change that brightness part of the restful command to send the number stored in the matrix1_brightness input_number variable?

Please consult KB for JSON API.

I am using mqtt here in this example which i modified to pass variable bri , adapt the same ( i personally do not understand why not use mqtt as it is by var much more flexible to control wled from HA but sure )

In this case sensor.tuya_ir_temp_sensor_temperature is my temperature sensor and i am passing its variable value to be the brightness


Below text file have the full mqtt automation for the above

mqtt_ha_wled_examples.txt (396 Bytes)

Thank you. I don’t know if that solved it, or if I just forgot to put the {{brightness}} in the publish in quotes. Or if it was both. Either way the issue is solved, thank you.