Rest API PUT request with variable for screen-masking webservice?

Hi all,

i have a question in regards to the Rest API sending a http put request.
I am working on a way to mask my homecinema screen and found a cool project using a stepper motor and a webservice to mask the screen. So now i can send http requests using the rest api which works perfectly fine. But i am looking for a way to get a command like this:

  mask_test:
    url: "http://10.7.0.xx:1337/move-to/3500"
    method: put

working with a value that i can set from a dropdown or providing it manually for the beginning.
So for example kind of variable payload i can fill just before running the command. In this case 400 instead of 3500 or whatever value i need. Is this possible and can someone help me achieving this?

mask_test:
url: “http://10.7.0.xx:1337/move-to/variable
method: put
payload: variable

Greetings

Felix

I assume the above is a rest_command configuration?

Both, url and payload parameters support templates, so you should be able to do something like:

    url: "http://10.7.0.xx:1337/move-to/{{ states('input_select.your_dropdown') }}"
    ...
    payload: "{{ states('input_select.your_dropdown') }}"
1 Like

Ha perfect! Thanks thats kind of what i need for the beginning :slight_smile:

1 Like

Already found a solution?