Another solution would be to control it using Home Assistant, Home Assistant (home-assistant.io)
Free software, requires an old device to isntall it on, and can do a lot more than you require. Really easy to set up, and integrates with Sonoff easily.