PROJECT IS CLOSED
ITEAD, unfortunately, added SSL Certificate Pinning feature into their firmware. As a result of such decision: no one else can implement alternative Server.
I used my own server till last time with old firmware, but now here a time to move forward. I'l suggest anyone to switch to alternative firmware. Few days ago i've migrated all my Sonoff to ESPHome and i'm happy now. What you can do:
- Configure and install ESPHome on your Sonoff ( https://esphome.io/devices/sonoff_basic.html ). I configured it with MQTT server, but you can configure it with HomeAssistant API if you wish.
- Configure and install HomeAssistant server, it can be easily installed into mostly any Raspberry PI and similar linux boxes.
=====[ This part is saved for history ]=====
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.
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.
- Linux based server (Raspberry PI or any generic modern Linux)
- PHP 7.x (but PHP 5.x should also be ok) with composer dependency manager (https://getcomposer.org/)
- Create directory for Sonoff Server
pi$ mkdir ~/phpSonoff
- Install required libs via PHP composer
pi$ cd ~/phpSonoff pi$ composer require workerman/workerman workerman/channel
- Download Sonoff Server software
pi$ git clone https://github.com/vponomarev/Sonoff-Server.git pi$ mv Sonoff-Server/* . pi$ rm -rf Sonoff-Server/
Create your own SSL certificates (you can also use self signed from this package)
Edit configuration section in sonoffServer.php file
Run server using:
pi$ php ./sonoffServer.php start -d
WEB GUI can be accessed via:
- List of connected devices:
Returns JSON array with connected devices, example:
- 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
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 (eu-disp.coolkit.cc). You can reroute this requests into configuration page of Sonoff-Server using your home router.