How to load a link in scripts

To switch the audio input on the media player I need to load a local link in a script or automation, how can I do this in Home Assisstant ?

Set ut a restful command

Then you should be able to call this command from the script

1 Like

Can you show me example of the script with

 url: https://slack.com/api/users.profile.set
 method: POST

in the help I can see only configuration.yaml or automation

The action is the same.
Or use the gui and it will help you

what’s the name of the action?
what to select in the gui ?

when I try it in gui for script I see nothing

did you restart HA after adding it to configuration.yaml?

No because I didnt add anything in configuration.yaml

in help for configuration.yaml I see this but its not look like useful thing

# Example configuration.yaml entry
rest_command:
  example_request:
    url: "http://example.com/"

To use this integration, add the following lines to your configuration.yaml file. After changing the configuration.yaml file, restart Home Assistant to apply the changes.

What the following lines where can I find it ?

Just replace it with your URL and it should work.

# Example configuration.yaml entry
rest_command:
  example_request:
    url: "https://slack.com/api/users.profile.set"
    method: post

I dont understand if I add my url in

rest_command:
  example_request:
    url: "http://example.com/"

how its help me call the url from script ?

It creates an entity I believe. Or if it’s just a service call…

now its finally works!

Is it right that I should always add all my url’s to configuration.yaml ? and then use them by the name I set for them ?

I believe so…

1 Like