Revision [3106]

This is an old revision of SonoffSetup2017 made by ZorrUno on 2018-04-28 16:36:25.

 

Flashing and using a Sonoff with Tasmota firmware


Final Setup Test

Once flashed, I set the 'startup mode' to be on, so it can be used as a normal switch. I didn't really have to worry about running buttons into its i/o.

Then, whenever mains is switched on, it turns on... and turn on time seems to be about half a second, so pretty much little difference noticeable between that and a normal switch. About 25 seconds later it will pick up the on/off value from mqtt server (if it is available)

Advantages with this setup:
I can just chuck in a sonoff in a light circuit anywhere, and set it up (eg pull out a downlight and install a sonoff in-line). I use the existing main switch - and it works normally without any mqtt server running. Later I put some buttons in another flush box beside the mains switch (ELV buttons, connected to the sonoff, or a sonoff dev or NodeMCU etc), and cover the mains switch with a flip pdl plates. The new buttons just change the values in MQTT server.


I then get:
...... I'll be wasting power if power outage occurs and wifi/mqtt doesn't come back up
...... There will be some annoyance in a power outage, with possibly 30 seconds of lighting at night after a power cut until sonoff connects back to wifi/mqtt
..... obviously this only works with wifi/mqtt running though

Bulk Sonoff Order, August 2017

https://docs.google.com/spreadsheets/d/1eKHTiDvcRtCvblBAWTz8rt6XeRTrIfBDK974giLYWFE/edit?usp=drivesdk

Correct Connections for FTDI

Tested and working.

Sonoff RF Bridge (2018 version)
Ensure switch on Bridge is off, and button is D0 for programming
Pins TDI: Blue GND, CTS (No connection) Orange VCC, Green (TXD), Yellow (RXD), DTR (No Connection)
Sonoff: Blue (GND), Yellow (TX), Green (RX), Orange (VCC 3.3v)
https://photos.app.goo.gl/EAVtb427VNELB9a33
Info on new RF Bridge Layout: https://github.com/arendst/Sonoff-Tasmota/issues/1126

4 Channel Switch
https://photos.app.goo.gl/VJg2FZHWuzAYtyGM6

Devices

https://www.itead.cc/sonoff-wifi-wireless-switch.html

useful youtube tutorials

https://www.youtube.com/watch?v=n4MDRm2yAJg
http://www.andremiller.net/content/programming-an-itead-sonoff-wireless-smart-switch-esp8266

Tasmota

Tasmota Firmware - clone as a zip
https://github.com/arendst/Sonoff-Tasmota

Atom Text Editor with platform i/o

- install Atom https://atom.io/
- install packages, "platform-ide" (from within the Atom menus - recent versions... it may already be installed))
- Atom complained clang wasn't installed, needed to install in ubuntu
sudo apt-get install clang

- had issues with Clang in Ubuntu... Go to Atom's Preferences menu, click packages, autocomplete-clang, settings, and change 'Clang Command" from "clang" to clang-4.0 (or the version running on your linux)
- Open Project, click on the Sonoff-Tasmota-development folder

Issues with USB serial

- in Ubuntu, I needed to add my user to the dialout group
sudo adduser $USER dialout

- Probably need to logout and in again to make this work
Later I had more permissions on this TTY and had to change permissions on this port
sudo chmod a+rw /dev/ttyUSB0

- The UDev rules should be added to. Platform I/O suggests this (as root)
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/scripts/99-platformio-udev.rules > /etc/udev/rules.d/99-platformio-udev.rules

http://docs.platformio.org/en/latest/faq.html#platformio-command-not-found-an-error-pkg-resources-distributionnotfound

Setup the firmware before flashing

- Update the user_config.h with wireless SSID, Password (as MINIMUM) and MQTT server details
- change the value of #define CFG_HOLDER - otherwise the values won't stick. Suggest incrementing by 1.
- save

Connect Sonoff

- https://github.com/arendst/Sonoff-Tasmota/wiki/Hardware-Preparation
- solder the board pins (see tutorials everywhere)
- Set up a usb ftdi/serial programmer (I got a ch340g for $8 from trademe)
- make sure you set it to 3.3V...

Pins TDI: Blue GND, Orange VCC, Green TXD, Yellow RXD
Sonoff: Tot to bottom: Blue (GND), Yellow, Green, Orange (VCC 3.3v)

- connect up the sonoff in programming mode (hold button and power up, release)
- in the Sonoff-Tasmota-development folder is a platformio.ini file. Click on it
- in Atom PlatformIO menu, click upload

Monitor the serial happenings

- Use Atoms inbuilt serial monitor 115200, /dev/ttyUSB0 (in my case)
- check serial data for IP of device and that it connects to wifi etc. This will help a lot if it isn't doing what you think it should.

Adding remotes and 433 devices to an RF Bridge

https://github.com/arendst/Sonoff-Tasmota/issues/1181
Essentially you go to the console (via the web interface) and type RfKey1 2 . The sonoff will beep once, then you press a button on the remote. The Sonoff will beep a couple of times.


Configure it more on its web interface if you like

- my device is at http://192.168.1.113/ - it runs a web server for config etc
- Can also add new firmware like this if needed

MQTT

- Get a MQTT client, I used MQTTlens for chrome, mqttfx was too flakey
- subscribe to stat/sonoff/POWER (seems to need caps?)
- publish cmnd/sonoff/power toggle (or on/off)

MQTT Example for 4 Channel

Publish cmnd/sonoff-mollie-fan/power4 with a message of 1

--
CategoryMicrocontrol
CategoryHomeAutomation
CategoryLinux
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki