Setup automation for send http

Hi!
Sorry, if has a answer for this, but I’m very, very newbie to this app home assistant. I’ve already read the home assistant manual for automations, I’ve used chatgpt and others to try, but I didn’t succeed. How can I do, to create an event with a button or something in the overview (dashboard) so that when I click on it, it only sends the information “http://192.168.1.100:6095/controller?action=keyevent&keycode=power” which will disconnect a device on my network. Thank you very much for any information.

Set up a command line switch:

In configuration.yaml:

command_line:
  - switch:
      name: "Disconnect my device"
      command_on: "curl -s 'http://192.168.1.100:6095/controller?action=keyevent&keycode=power' > /dev/null"
      command_off: "curl -s 'http://192.168.1.100:6095/controller?action=keyevent&keycode=power' > /dev/null"

After a restart to load the command line integration for the first time, you just need to toggle that switch to make the URL request happen, using the switch.toggle service.

You mention automations, events, buttons and dashboards — what do you actually want? A button to press manually, or an automation to disconnect the device when something else happens?

You can add a button card to your dashboard: set it up like this, but choose your new command line switch rather than turning my central heating on and off :grin: .

Hint: don’t do that.

Thank you for your answer. I will try. about button is a button for press manually. Thanks again!

My mistake: I’ve edited the code above to remove an errant hyphen. Please update and try again.

You shouldn’t need a full restart this time: Developer Tools / YAML / Command Line entities should work.

Thank you Troon!! Works very well!

1 Like