You may want to simply investigate using ESPHome on the Sonoff WiFi switch. This would then provide proper two way communications between the WiFi Switch and Home Assistant.
I flashed a Sonoff S31 smart outlet with ESPHome and it works very well. Hopefully there is a online guide/tutorial to help flash ESPHome on to your Sonoff Switch device.
Thanks for the replies, still have no clue how to do that. I’m new to this and looking at this template switch page is like seeing water burn. For such an easy task it looks like a very difficult proces. Although really appreciated I need more help then just pointing me to a page.
@ogiewon I will look into the ESPHome thing you suggested but it should be possible with my current hardware setup? It’s just setting up a virtual switch with 2 commands
Flashing ESPHome ot the Sonoff switch (if possible) is by far the best way to solve your real problem (control of the switch).
That said, you can add the template switch configuration to your HA configuration.yaml by having it call one of two different REST commands (which you should also add to configuration.yaml).
Hi, I am running domoticz with several flashed sonoff, and i am trying to do exactly what you were asking.
A simple switch calling url A on ON command, and url B on OFF command.
Any chance you remember how you did using the REST command ?