Awesome Open Source
Awesome Open Source

Sonoff Socket S20 firmware

Build Status Donate

Firmware for Sonoff Socket S20 This firmware supports MQTT and Home Assistant

Configuration

You can see buildConfig.example.json, copy it to buildConfig.json and fill out the variables:

{
	"arduino": {
		"root": "/opt/arduino/",
		"cmd": "arduino-builder",
		"hardware": "hardware",
		"tools": "tools-builder",
		"libraries": "libraries",
		"src": "sonoff_socket.ino",
		"build-path": "build"
	},
	"mqtt": {
		"host": "192.168.x.x",
		"port": 1883,
		"clientId": "device-updater",
		"name": "username",
		"password": "secret password",
		"deviceTopicPrefix": "device/"
	},
	"wifi": {
		"ssid": "",
		"password": ""
	},
	"devices": {
		"sonoff-socket-s20": {
			"mqttHost": "192.168.x.x",
			"mqttPort": 1883,
			"mqttUser": "sonoff",
			"mqttPassword": "password",
			"topic": "",
			"fqbn": "esp8266com:esp8266:generic",
			"hardware": "hardware/esp8266com/esp8266/libraries",
			"tools": "hardware/esp8266com/esp8266/tools/",
			"libraries": "hardware/esp8266com/esp8266/libraries",
			"prefs": [
				"build.flash_ld=/opt/arduino/hardware/esp8266com/esp8266/tools/sdk/ld/eagle.flash.1m0.ld",
				"build.flash_freq=40",
				"build.flash_size=1M",
				"build.flash_mode=dout",
				"build.flash_flags=",
				"build.f_cpu=80000000"
			]
		}
	}
}

Requirements

Install dependencies

npm install

Generate configuration, build and update firmware

Just run this command:

gulp --device=sonoff-socket-s20

Demonstration video:

Home Assistant

configuration.yaml:

switch:
  - platform: mqtt
    name: "Éjjeli lámpa"
    state_topic: "smarthome/bedroom/nightlamp/state"
    command_topic: "smarthome/bedroom/nightlamp"
    payload_on: "on"
    payload_off: "off"
    qos: 1
    retain: true
group:
  haloszoba:
    name: Hálószoba
    control: hidden
    entities:
      - switch.ejjeli_lampa

customize.yml:

  switch.ejjeli_lampa:
    icon: mdi:lamp

For more information check out my page here and here.

Donations

  • PayPal: https://paypal.me/gyengus
  • Bitcoin: 1QJzLBK9uQP4RthmKJRQwy3v5sd4XS4S7P
  • Bitcoin Cash: qp04tazu4fe7lv6zr99suu40swqqp747nsm0kcfckv
  • Ethereum: 0x2bD68120A56acBf6Dbd11da2060228b8912C1e3C


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
C Plus Plus (236,216
Arduino (30,655
Internet Of Things (11,850
Socket (10,716
Firmware (10,460
Mqtt (7,861
Esp8266 (4,891
Home Assistant (3,665
Home Automation (2,193
Smart Home (1,578
Sonoff (375
Sonoff Devices (17
Sonoff S20 (8