Flash a Wi-Fi Plug with Tasmota for Hubitat…. WITHOUT soldering! Part I

Ladies and gentlemen, this project is FUN. We’re going to learn how to use a Raspberry Pi to flash a Smart Life/Tuya Smart Wi-Fi plug with Tasmota without soldering – OTA – meaning “Over The Air” – and set it up in Hubitat to automatically reboot a device every night at 2 am. Again, NO soldering. I’m going to give solid, in-depth instructions for each phase of the project, so you will need zero experience in order to duplicate my results. This first entry covering the project will show you how to set up the Pi for flashing the plug.

Most smart home enthusiasts start with smart bulbs or smart plugs these days – plugs and bulbs don’t take any special skills to install, they’re relatively inexpensive, and they’re mature, stable tech. As you’ve learned more, you’ve taken on more advanced projects, in order to enjoy more sophisticated features and functionality. Most of the time, a smart plug is no longer the first thing you reach for in your toolbox, but, sometimes, it is still the best tool for the job. Box fans, HEPA filters, floor lamps, USB chargers, and even VOIP devices are plugged into an outlet and you don’t want to dedicate a home automation module to every single outlet in your home. As you can see in the main image above, I’ve got a whole box of devices to flash to Tasmota!

Here are the goals of the project:

  • Learn how to “flash” (meaning replace, upgrade) the default firmware on many inexpensive devices with Tasmota OTA – for emphasis – no soldering!
  • Configure the device’s template (many plugs already have templates in the DB, but it is best you’re completely prepared).
  • Integrate the device into Hubitat, in order to integrate it into rule machine for interoperability with other devices while maintaining local control.
  • Schedule an action to occur at a specific time of day, every day.

A note on local control – you can buy TP-Link, WeMo, Amazon, and many other brands of smart plugs to do the same thing we will do here. However, if your Internet is out, if the cloud server is down, you’re back to walking over and turning the knob.

Travis Griggs, a member of the Smarter Home Club and a number of other home automation and DIY communities, has a fantastic YouTube channel and was the person who first introduced me to Tasmota and then to the OTA flashing method – HERE is his video on the process, which is where I learned this.

I can’t emphasis enough that Travis is a brilliant guy you should pay attention to. You don’t need to ever use Tasmota to learn many new things from him. Subscribe to his YouTube channel and give yourself a big advantage in how you approach your own projects!

Here are the requirements for this project:

  • Raspberry Pi 3 B+ (LINK to kit with case and power supply)
  • MicroSD card (LINK)
  • Smart Plug Based on Tuya ESP8266 module (LINK )
  • Ethernet cable
  • The ability to look up a device’s IP address on your router

For the Raspberry Pi, I went with a high quality kit, as I will re-use it for a number of different projects, not just flashing Tasmota – the kit I linked to is my favorite. I’ve picked up kits from the “official” sellers, as well as building my own kits from knock-offs, and everything in between, and this is a beautifully thought out package, with a “no tools” enclosure, power supply, heat sinks, and GREAT documentation, at a very fair price. You can save a few dollars putting together your own kit, but I don’t think the potential headaches involved are worth it.

A few notes on the Canakit Raspberry Pi – the power supply in the package is their own brand. When dealing with micro-controllers and mini-PCs, you want to make sure your power supply is well regulated. Do NOT scrimp here! Also, this package has fantastic documentation – a single page read me that anticipates the most common issues, plus a 24 page, well-written quick start guide. Finally, the one thing I do NOT like about the kit is that you have to manually register the warranty within 30 days. It’s there in the guide, though, and a painless process.

The assembly is VERY easy. Make sure you assemble the enclosure before you insert the MicroSD card.

The enclosure comes in three pieces. Separate them and insert the Pi board into the bottom section section. There are tabs to guide the board in.

Take the bottom section (with the rubber pads or “feet”) and snap it into place into the middle section.

Turn the board back over and apply the heat shields (to the CPU and the flash chip). You’ll need to peel the cover off the adhesive, which is tricky if you have clumsy fingers like me.

Snap on the top, insert the MicroSD card, and plug in the power. I used the extension cable that came in the kit because I really like the switch.

We need to download some software:

PuTTY – LINK –  (or whichever Telnet/SSH client you prefer) – we’ll use this because the Pi will run headless – no monitor/keyboard/mouse.

Etcher LINK –  software to flash your MicroSD card with the Pi’s operating system

Raspbian LINK –  said OS for your Pi

In Travis’s video, he downloads Raspbian Stretch Lite, but I grabbed the desktop version, as I’m a Linux outsider and the GUI helps. I almost actually grabbed the version with recommended tools, in case I wanted to re-purpose the Pi, but decided I can do that myself. I can do SOME stuff in Linux, at least! These instructions will let you do a headless setup and use Putty to connect, though if you install the desktop version, you can have the GUI as well.

Keep in mind that you can re-purpose your Raspberry Pi just by swapping out the MicroSD card. That means if you’re not confident that you can run additional apps or services without breaking your ability to flash Tasmota, so set it up how you need!

Install Etcher and plug in your MicroSD card (this assumes you have an SD Card reader on your computer, or else an adapter for your USB port). This is a very simple install, just follow the prompts on screen. After setup completes and Etcher launches, click Select Image, make sure you have the right SD card selected, and then click Flash! If prompted by User Account Control, answer yes, and watch it prepare your MicroSD.

Once the flash is complete, navigate to your SD card in Windows Explorer and create a new text file named SSH in the root directory. The file should not have an extension. Without this file, you won’t be able to connect via Putty for the headless install. Headless means no monitor is required. Once you create the file, right click the “drive” for your SD card in explorer and select “Eject.”

Now, plug the MicroSD card into your Raspberry Pi. Plug in your Ethernet cable, and then the power cable, as well. If you used the switching power cable extension from the Canakit package, press the button to turn on your Pi. You’ll need to get the IP address for the Pi from your router.

Open Putty. Enter the IP address of your Raspberry Pi in the “Host Name” blank. Click the Open button. If you get a warning about the server’s host key, click “Yes”

When promoted with “login as:” type pi
When prompted with “pi@XXX.XXX.XXX.XXX’s password:” type raspberry

You’re now logged into your Raspberry Pi!

Type sudo raspi-config and press enter.
Arrow down to 7. Advanced Options, then press enter
Select “Expand Filesystem” and press enter, then press “OK” when it indicates the partition has been resized.
Arrow down to “Finish” and select “Yes” when prompted to Reboot.

Putty will display a “PuTTY Fatal Error” Message box. Click OK and X out of the Putty Window
If you like to assign static IP addresses, now is a great time to do it.
Restart Putty, connecting to the same address as before (or the new static address, if assigned), using the same login credentials.

Once you’ve reconnected, it is time to update the various packages included with the Raspbian images.
Type “sudo apt-get update” and press enter.
Next, type “sudo apt-get dist-upgrade” and press Enter. Press “Y” and then Enter when prompted to continue.
Now, type “sudo apt-get install network-manager” and press Enter. Press “Y” and then Enter when prompted to continue.

Your Pi is now configured and ready for Tuya Convert! The next entry will cover selecting a Wi-Fi plug for the project, setting up Tuya Convert on your Pi, flashing the plug, and then configuring it.

SmarterHome.club is the website for our Facebook community, The Smarter Home Club – which is an umbrella for all kinds of smart home technologies – home automation, security, custom electronics, weather stations, alternative energy, you name it. DIY focused.

If you’re interested in joining the Smarter Home Club’s Facebook group, please follow this link:

The Smarter Home Club on Facebook