Calling URL from the automation in the UI

Hi, when i make an automation in the UI, i would like to call an URL in the action part of it.

Is that possible without first making a vswitch in yaml and then call that vswitch?

You could use the shell command integration to expose a wget or curl command as a service, and then call it in your automation.

edit: wget and curl are command line tools specifically designed to retrieve URLs

No. You will have to configure something in YAML first. If you just want to hit a URL to tell another application something happened you can use either REST command or Notify REST. You can also use a RESTful Switch if the thing can be turned on and off via URL. But all of these options must be configured in YAML first.

Ok, thanks!
So, i’m trying to use the rest_command to be able to set the 3 different states in my alarm with a URL call.

In YAML i have this :

rest_command:
  away:
    url: "http://ipadress/Password/preset/2"
  home:
    url: "http://ipadress/Password/preset/0"
  night:
    url: "http://ipadress/Password/preset/1"

But it doesn’t work.
I see the 3 services in the UI, can use them in the automation as an action, but they’re not working.
What am i missing or doing wrong?

It’s pretty tough to say, you’re not really providing a lot of info. Your config is valid, that’s really all I can tell from that.

What’s in your logs, any errors? Have you turned on debug logging for the rest command component, what does that say? Have you confirmed that it is in fact reaching the other service? If so what logging does that service provide? Have you confirmed from the doc of your alarm service that you have the API correct?

If you haven’t done this yet you should use Postman or curl or something first. Hit those URLs directly with a tool like that and confirm that everything is working correctly. Then you should just be able to plug them in and use them from HA.

I had the rest_command with the three services in the top of my yaml config. As a try and error action, i placed this piece of config more at the bottom of the yaml config file, and now it works!
.
Maybe it has something to do with that there is also another piece of config in the yaml file with a “- platform: rest” command?