Restfull switch "is_on_template"

Hi!

I’m trying to make a restfull switch in home assistant to controll an esp8266 device which is sending IR commands.
The problem is i cant make homeassistant recognize the state of the switch which results in it instantly turns off and sends the command two times.

My esp8266 code ends with this:

client.println(“Content-Type: text/html”);
client.println("");
client.println("<""!DOCTYPE HTML>");
client.println("<“html>”);
client.print(“on”);

How do i configure the “is_on_template” in my switch config to make it recognize the state of the switch?
Or is it necessary to change the code in esp8266 and make it print something else as reply?

//overb

use Content-Type: text/plain and just send on or off.