HTTP Post switch

Hi all,

I have a request, I really can’t figure this out:

I want a switch on my overview that turns on/off my speakers (Logitech z906 set)

I’m running a webserver on an ESP8266 and when I open the following link (with the actual IP) it sends an IR signal and powers on/off the speakers:

http://x.x.x.x/ir?button=logitech_z906_power

Now I want to implement this, so that there is a switch available on the overview page to toggle this.

I just installed home assistant, came from Homebridge.io, so I’m very new at this.
Can someone help me what I need to configure or add in the config file?

Thanks in advance!
Cheers,
Viskuh

switch:
  - platform: rest
    name: My Switch
    resource: http://x.x.x.x/ir?button=logitech_z906_power
    method: POST
    

Its up to you to figure out the body_on body_off, etc based on the reply. If you don’t care, you don’t need it and this will just guess the state of the switch and send that command when you push it.