How to make a switch that sends command to a web interface

I apologise in advance if this seems trivial. I have spent several days trying to solve this problem, and I have read various Home Assistant help documents. I have only been using Home Assistant for a week or so, and I have no programming experience.

What I am looking to do is to switch on relays which have a web server built in. I can do this easily by typing into the address bar of Google Chrome eg
if I type xxxx:// it will switch relay1 on
if I type xxxx:// it will switch relay1 off.

(hopefully you can guess what xxxx is - the forum didn’t like me typing it there as I’m a new member)

I have tried writing command line instructions (based on Home Assistant documentation examples), I have tried using telnet similarly - both in the configuration YAML, and I also tried to get a template working. All unsuccessful.

I think I need to put something like this into the configuration YAML:


but a) I can’t find the switch anywhere to add to the Home Assistant display and b) I don’t think it works. I wondered whether I should be using a template or using a shell commmand, but most of this stuff is beyond my knowledge at the moment. Would be great to be able to get something to work then I could experiment and improve it, but I’m not even off first base!

That is an outdated format that is no longer valid. Please see the example lower down on this page:


  - switch:
      name: Relay switch
      command_on: "curl -k ''"
      command_off: "curl -k ''"

Also in future please format your pasted config correctly for the forum. See or

1 Like

Thankyou - all working now!