Command_line to send Http

Hi all and thanks for the community!!
Noob!!
HASS 0.107.7
Trying to send command-line to RPI running Octopi/Enclosure plugin but no results.
In my config.yaml I got this:

- platform: command_line
  switches:
    luz_impresora:
       command_on: '/usr/bin/curl -X GET "http://octopi.local/plugin/enclosure/setIO?status=false&index_id=1&apiKey=7736C8CB4B0XXXXXXXXXXXXXX"'
       command_off: '/usr/bin/curl -X GET "http://octopi.local/plugin/enclosure/setIO?status=true&index_id=1&apiKey=7736C8CB4B0XXXXXXXXXXXXX"'
       friendly_name: Luz Impresora Ender

I got the Switch on my Lovelace but when I try to change it always reverts to original position.

If I write in my browser “http://octopi.local/plugin/enclosure/setIO?status=false&index_id=1&apiKey=7736C8CB4B0XXXXXXXXXXXXXX”, It works perfect, I got action switching ON/OFF the light depending on the true/false command.

Tried without the /usr/bin/… but nothing, removing the -X GET same.
Changed octopi.local for the IP same result.
I checked indentation, also quotation (removing, adding, changing) but no answer at all.
At this moment I’m lost.
I simply need to send that http command to the octopi with HASS
Any help welcome.

Can you run the same command line in the terminal?

My guess is the mDNS server can’t be resolved on the HA instance (octopi.local). Just use the real ip address for now.

You can try to debug mDNS with your Home Assistant…but I don’t really know where to start with that. Could be any number of things…

Thanks for your clue, I will change to real IP and look for debugging.

It took me a little while but, have it working with curl -k

switch:

  - platform: command_line
    switches:
      enclosure_led:
        command_on: !secret led_on
        command_off: !secret led_off

secrets.yaml

led_on: 'curl -k "https://octopi.local/plugin/enclosure/setIO?status=true&index_id=1&apikey={API_KEY}"'
led_off: 'curl -k "https://octopi.local/plugin/enclosure/setIO?status=false&index_id=1&apikey={API_KEY}"'