No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download


PHP based implementation of Sonoff cloud server, running in your own home network. You can control your Sonoff switches without need of changing basic firmware.

Supported devices

In theory all Sonoff devices are supported. But for now, only "Sonoff Basic" will work fine. Please send me LOG file if you want to add support of any other Sonoff device.


  1. Linux based server (Raspberry PI or any generic modern Linux)
  2. PHP 7.x (but PHP 5.x should also be ok) with composer dependency manager (


  1. Create directory for Sonoff Server
pi$ mkdir ~/phpSonoff
  1. Install required libs via PHP composer
pi$ cd ~/phpSonoff
pi$ composer require workerman/workerman workerman/channel
  1. Download Sonoff Server software
pi$ git clone
pi$ mv Sonoff-Server/* .
pi$ rm -rf Sonoff-Server/
  1. Create your own SSL certificates (you can also use self signed from this package)

  2. Edit configuration section in sonoffServer.php file


Run server using:

pi$ php ./sonoffServer.php start -d

WEB GUI can be accessed via:


WEB GUI example:


  1. List of connected devices:

Returns JSON array with connected devices, example:

  1. Update state request:

Where: apikey - Device API Key state - new state ("on" or "off")

Return JSON array with result:


Where: error - error code, 0 is "ok" state - new state

Configuring Sonoff

First, you need to configure your device via eWeLink software (there is also an alternative way, i'll explain it later).

On startup each Sonoff device send HTTPS POST request to configuration server ( You can reroute this requests into configuration page of Sonoff-Server using your home router.