top of page

Flash Tasmota on a Dimmer with Tuya Convert and a Mac

Updated: Jan 23, 2022

I recently flashed a Wifi dimmer using Tuya Convert on an old MacBook Pro. This enabled me to use the dimmer of my choice (a Topgreener) with local control (no cloud dependency) via Home Assistant and MQTT. It works beautifully: integrated into my local automations, voice-controlled via Google Home and household members use the physical buttons without issue or protest.


Tuya Convert is supposed to be an easier way of flashing Tasmota firmware (vs cracking open the device, soldering to tiny pins) to your Tuya-based IoT devices, but like many DIY things, it was series of ever-deepening rabbit holes, particularly since I was trying to run Tuya Convert on a Mac. I lived to tell this tale for the benefit of other foolhardy adventurers like me, should you go down this path. Mainly there were two rabbit holes:



Rabbit hole 1: Pick the right device. While Tuya Convert used to widely work with any Tuya-based ESP8266 device, this is no longer true. More devices are shipping with new non-exploitable firmware, or non-ESP MCUs, and you can't can't tell these devices apart unless you buy and try. So, be prepared to do the research. I narrowed down to the Topgreener TGWF500D dimmer after seeing it listed on the Tasmota template site, and after scouring the usual reddit, HA forums. Also, look for recent Amazon reviews to gauge what is likely to still work. Combine this with your other requirements you may have (eg, I wanted UL-listed, decent price, Decora style). Whatever you pick, make sure you buy from a place with a good return policy. Fortunately, I rolled the dice correctly on the first try.


Rabbit hole 2: Assemble the right Linux setup. The Tuya Convert instructions make it seem like you can only flash OTA with a Raspberry Pi with a wifi dongle. I didn't have either and there were just enough mentions of successful flashes with other hardware to give me hope I had options. I had a couple old MacBook Pros with Linux and ultimately learned the most important requirement is a Linux instance with access to a Wifi adapter with AP mode:


- VM instances of Linux won't work. You need to get access to the wifi adapter which isn't normally exposed to the VM instance (I run Mint in a VirtualBox on my MBP 2012). I ended up installing Mint MATE edition on a bootable partition on my even-older Mac (MBP mid 2009, 13-inch). This took an eternity and felt even more painful when considering I just wanted to install a light switch!


- You can use your Mac's built-in Wifi card (no dongle needed) as long as it has AP mode and given the right driver. Not being a Linux expert, this was a bit of an exercise in Googling. Recreating from memory the key commands:

  • Ran a shell command in Mint to get info on my Mac's Wifi card and its driver

lspci -nnk | grep -A2 0280

This told me the kernel was using the "wl" driver for a Broadcom card. OK.

  • I ran a command to get the capabilities of this driver/card combo:

iw list

This did not list "AP mode" under Supported interface modes. Ugh.

sudo apt-get install firmware-b43-installer
  • Removed old "wl" driver for now:

sudo modprobe -r wl
  • Added new "b43" driver

sudo modprobe b43
  • Confirm we now have "AP mode" capabilities:

iw list

Woo hoo! It showed I had "AP mode" support now!


Running the Tuya convert "start_flash.sh" script from here went successfully. I then modified the Tasmota configuration on the device per the Topgreener dimmer template, including updating its dimmer range.


So there you go! I still prefer to use Shelly relays behind my "dumb" switches where I can, as they support local MQTT right out of the box, but the dimmer has continued to work well. Also, knowing my old Macbook Pro is capable of converting any future Tuya devices to Tasmota is another proof-point of why I keep these babies around!




Comments


Commenting has been turned off.
bottom of page