Awesome Open Source
Awesome Open Source


Switching Sonoff Basic and Sonoff S20 (Webserver, local button and MQTT).

Getting started

This project ist split in two parts: sonoffSimple/sonoffSimple.ino is just a simple demo as described here.

The more advanced software (sonoffSocket.ino) supports MQTT, toggle, status and is actively developed. Just copy sonoffSocket.ino into your Arduino-IDE folder. To use mqtt you have to install external library "PubSubClient". Change your SSID and WiFi-Key and activate MQTT if needed (choose a topic too). Connect Sonoff Basic or Sonoff S20 to your FTDI-Adapter and flash it using the Arduino-IDE.

How it works

The socket can be controlled by opening /on (to activate) and /off to deactivate. If MQTT is enabled, send 1 or 0 to your chosen topic (defined at the beginning of your code). Get the current status with /state and toggle with /toggle

More information

This repository is part of article "Bastelfreundlich" from German computer magazine "c't".

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
c-plus-plus (17,930
cpp (1,291
esp8266 (257
sonoff (24

Find Open Source By Browsing 7,000 Topics Across 59 Categories