Welcome to our Knowledge Base

Sonoff Switch – Tasmota Conversion

You are here:
< Back

Prepare Software Environment

Flash the sonoff hardware

Sonoff Basic, POW and TH Hardware Prep

  • https://github.com/arendst/Sonoff-Tasmota/wiki/Hardware-Preparation
  • Hold the reset button while plugging in the device on USB
  • Look at what COM port the USB is using in Device Manager
  • Run FlashESP8266.exe and to COM port above
  • Unplug and replug the device to reboot
  • Run termite,
    • set preferences
      • COM port above
      • Baud rate 11200
    • Establish Network Connection
      • ssid1 {SSID}
      • password1 {NETWORKPASSWORD}
      • Take note of IP Address
  • Reserve IP address on router
  • Navigate to Device home page http://IPADDRESS above and configure

Sonoff Basic Hardware Prep

Sonoff Dual Hardware Prep

  • In addition to the steps above, the Sonos Dual (Only use R2 or later) requires the Button0 to be shorted to the GND during flash.

Sonoff TH16 Hardware Prep

  • Below is the thermometer mapping
  • https://www.youtube.com/watch?v=erGh0Eca-hc

Add Tasmota devices to Home Assistant

To ease Home Assistant configuration a feature called MQTT discovery is available. (warning: this feature is not included in sonoff-basic.bin and sonoff-classic.bin)
With MQTT discovery, no user interaction or configuration file edit is needed to add new devices to Hass.

For other type of devices, e.g iFan02, example entries for configuration.yaml is available in Home Assistant – Manual Config

On each Tasmota device which should be automatically discovered by Hass, enter the following commands in the web console:


SetOption19 1– Enables MQTT discovery\

By executing command SetOption19 1 the automatic discovery feature is enabled and a retained MQTT message starting with topic “homeassistant/..”, as defined in user_config.h HOME_ASSISTANT_DISCOVERY_PREFIX, is sent containing parameters used by Home Assistant to automatically configure a device.

To disable the automatic discovery feature and remove the retained message, execute command SetOption19 0 and the homeassistant topic is removed from the MQTT server.
Note: This will also remove the device from Home Assistant.

Important:

To keep MQTT discovery messages short, “base topic” feature is used.
This feature is not compatible with the default Tasmota topic prefix/topic/COMMAND, e.g. cmnd/sonoff/POWER
The topic will automatically be changed to topic/prefix/COMMAND, e.g. sonoff/cmnd/POWER
If you want to use a custom fulltopic, it MUST end with %prefix%/ or it will be overwritten with topic/prefix/COMMAND.
This is an example of an allowed fulltopictasmota/%topic%/%prefix%/.

For SONOFF Dual

Configure as DUAL R2 in configuration Module and save

Return to configuration module and set GPIO1 as switch 01 and GPIO9 and switch 09

In console enter seriallog0  #eliminate interferrance

For Sonoff TH16

Return to configuration module and set GPIO14 (Sensor) to Si7021

Itead SI7021 Temperature and Humidity – SI7021 (3) in group 

Set SetOption19 1 #home assistant auto discovery

SetOption8 1 #to set update Fahrenheit

Set TelePeriod 60 #to set update frequency in seconds

https://community.home-assistant.io/t/help-with-electric-smoker-control-using-a-sonoff-th16-and-a-ds18b20-sensor/45092/5

Setup Tasmota devices through Home Assistant

All automatically discovered entities will show up under:
Configuration -> Integrations -> Configured -> MQTT
The entities are grouped by hardware, example for a Sonoff T1 2CH:

References

  • https://github.com/arendst/Sonoff-Tasmota/wiki/Tutorials

Video Tutorials for Tasmota and Home Automation

Initial Configuration

  1. Connect to (AC) power (Serial NOT connected)
  2. If your WiFi was not set prior compile as described in Upload section, configure Wifi by using one of the provided configuration modes: Button Usage or use WPS if your router supports it.
  3. Connect to the device webpage (http://[sonoff-ip]/cn) NOTE: Replace [sonoff-ip] with actual IP address of your Sonoff device.
  4. Select the correct module type from the configuration frontend. If your device is not listed, a user contributed device template (explanation) may be available. If a template is not available, follow the procedure for configuring new devices.
  5. Configure the MQTT broker connection, choose a unique topic, e.g. “sonoff-kitchenlight”
  6. Test communication with the MQTT client of your choice
  7. Integrate with the Control interface or home automation solution of your choice
  8. Test your device for some time at the intended maximum intensity, check for overheating and if necessary, apply some limits in your home automation solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Table of Contents