Run url line

Health to all,
Within the local network, I need to run URL lines to automate preset cameras and other devices that only work with html commands.
I tried this but obviously opens another page and it doesn’t work remotely …
How can I do?

  - entity: camera.ingresso
    tap_action:
      action: url
      url_path: >-
        http://user:[email protected]:8202/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-number=1
    service: rest_command.curl_api
    name: Preset 1
    icon: mdi:numeric-1-box

Can anyone help me?

I assume your camera is hosted on a different device than whatever you’re running HA on?

The IP 192.168.1.202 won’t be accessible from outside of your local network without a reverse proxy or similar system.

Are you trying to have HA simply ping that URL?

yes, I have Onvif integration to view the camera but it doesn’t handle the “Preset” on this model, so I would like to use the Url line as a command!
I am new to HA and would like to know if there is a way to do this:

 http://user:[email protected]:8202/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-number=1

without opening the page

I think the code you’re providing is from Lovelace, right? I think your best plan is to first create a new REST switch entity (in your Configuration):

switch:
  - platform: rest
    resource: http://IP_ADDRESS/ENDPOINT
    method: POST
    name: name_of_switch

Then you can create a button card (or other card) in your Lovelace that will tell HA to perform the REST call behind the scenes, as opposed to simply opening a new browser (or Lovelace) tab/window.

1 Like

If it isn’t a true switch but rather a button (it doesn’t have an on/off state), use a RESTful command instead.

1 Like

Ah yes, even better. Then he can just call the command as a service, for example:

    - service: rest_command.my_request
1 Like