SonOff Integration

Sonoff is an affordable device that provides users with smart home control. It is a WiFi-based wireless switch that can connect to a wide range of appliances.

Options:

Replace Firmware (OpenDevice Firmware)

Basically SonOff is an ESP8266, to compile firmware check this guides

ALERT

Select Device: Generic Esp8266, Flash Mode: DOUT

Before turning on the SonOff press the reset button, to put into programming mode

WARNING: Some devices as the "Sonoff basic" have their own power supply on board.
DO NOT USE THIS POWER SUPPLY FOR FLASHING! 

Tips: The USB port does not have enough current to power the module, you need plug it main power after flash

Note: if you have compile errors use version 2.4.1 of Esp Core

An example using Sonoff Basic can be found in the examples:

On IDE: File > Examples > OpenDevice > Projects > SonoffBasic

After Flash:

Access http://192.168.4.1 in browser and configure Wi-Fi and set Server and ApiKey


GPIO Locations:

Basic GPIOs

Remote Updates (OTA)

See: Remote Updates (OTA)

Voice Control

An interesting application is to control this device through voice commands, see this guide for more details

References and Tips:

Using original firmware BETA

This integration allows you to explore new capabilities of this device, connecting it to the OpenDevice platform (without changing the original firmware), allowing it to be controlled through an open server, and using the APIs to develop solutions with that device.

Integration is provided by the extension: sonoff-bridge

At present support for extensions is only allowed in private clouds / raspberry or you can replace the firmware

ATTENTION: It does not work with devices running firmware version >= 1.6! you need replace the firmware  (or check status of this)

Tested Devices:

  • Sonoff Dual (firmware 1.3)

Installation PRIVATE CLOUD

Restart OpenDevice server: ./bin/opendevice restart

Run Wizard to configure Device

After successful setup, you must see on Devices Page:

Configuration PRIVATE CLOUD

The extension uses a separate ssl certificate for communication with SonOff, by default an embedded certificate is used. If necessary you can specify your certificate by editing odev.conf and adding:

sonoff.ssl.certificateFile=conf/sonoff.cert.pem
sonoff.ssl.certificateKey=conf/sonoff.key.pem



Setup Wizard

Download the setup tool (***-standalone.zip), it will prepare the sonoff to connect to the opendevice server. It takes advantage of protocol security "failures", to configure the device and integrates it into OpenDevice

TIPs: It may be necessary to repeat this process more than once.

Settings:

  • ApiKey: Get API Key
  • Server: For local local installations use your LAN IP (Ex.: 192.168.2.121)
  • Default port: 8989