Flashing Tuya/Smart Life based RGBW bulbs to use in Home Assistant
by Andrew Calcutt
—
last modified
2019-12-08T22:14:42+00:00
This guide is a reference to install the 'Tasmota' firwmware on your smart life smart bulb to allow use in Home Assistant (freeing it from some unknown cloud)
References
- Tuya-Convert (a script that allows you to update tuya devices firmware through wifi)
- Kali Linux (a live cd/usb bootable linux that has all the tools we need. the tuya-convert scripts may work with other versions of linux, but they say they are made to work with kali linux)
- How to Configure Tasmota with Home Assistant - Auto Discovery and Legacy - Tasmota Tips Episode 2 ( A good guide on setting up MQTT in Homeassistant, and connecting tasmota to it)
- Tasmota Device Templates Repository (a place to find user submitted configurations and check compatibility with tasmota for various tuya based devices)
Flashing the bulb with tasmota firmware
- Boot into kali linux (I used 'kali-linux-2019.4-amd64.iso' on a Dell E6430 for this, which had a supported wireless card out of the box)
- In kali, Connect to a wifi connection with internet access
- Open a shell and download tuya-convert with the following commands
- git clone https://github.com/ct-Open-Source/tuya-convert
- cd tuya-convert
- ./install_prereq.sh
- Disconnect from the wifi connection with internet
- Update your bulbs firmware
- ./start_flash.sh
- The script requests that you connect something (anything) to the 'vtrust-flash' ap before starting the flash. I connected to this with my cell phone during the flash only.
- The script makes you put the bulb into fast blinking mode. In my bulbs case, this means your turn the light on and off 3 times, then it starts blinking.
- The script asks what firmware you want, I selected '2.) flash tasmota'
- The flash should tell you it has completed, read carefully in case there are some extra steps (mine did not have any but I read some devices do)
- Connect directly to the new bulb wifi access point, it should be called 'tasmota-xxxx'
- Configure the bulbs wifi network, by going to 192.168.4.1 in your web browser.
- In the bulb configuration, scan for your wifi network (don't type it in).
- Make sure you get the password correct. I have not done it yet, but i read if you put wrong info here, you could be locked out of the device, so make sure it is right.
- In the bottom field, give the device a easy to find name, since this should show up in your DHCP server when you look for it later.
- After saving the settings, the device will restart and connect to the wifi network you set. You will no longer see the 'tasmota-xxxx' network.
- Find the new devices IP in your DHCP server. it should have whatever name you set in the previous step. You will then browse to this IP in your web browser
- At the bulb config page, choose the 'Firmware Upgrade' button, set the OTA Url (I left this default), and click 'Start Upgrade'. The bulb will install a firmware update and reboot (takes about a minute)
- Once the bulb reboots, you can set its configuration options. A good place to look for a configuration is the 'Tasmota Device Templates Repository'. For my devices i did the following.
- Go to 'Configuration --> Configuration Other'
- Set your device Template string, for my devices I used the fowllowing
- LED Candelabra 4.5W
- {"NAME":"DOGAIN","GPIO":[0,0,0,0,40,41,0,0,38,39,37,0,0],"FLAG":0,"BASE":18}
- OHLUX Smart WiFi LED Light Bulbs7W E26 and Sinvitron Led Wifi Smart Light Bulb E26 9W
- {"NAME":"OHLUX","GPIO":[0,0,0,0,37,40,0,0,38,41,39,0,0],"FLAG":0,"BASE":18}
Set up bulb for Home Assistant Auto Discovery
- On your Home Assistant Server, set up MQTT. I used this helpful youtube video ( How to Configure Tasmota with Home Assistant - Auto Discovery and Legacy - Tasmota Tips Episode 2 )
- Go to 'Hass.io', 'Add-on store' and install mosquitto broker
- Under the mosquitto broker page, set up the login information in the config, use the example shown here ( https://www.home-assistant.io/addons/mosquitto/ )
- "logins": [ {"username": "local-user", "password": "mypw"} ],
- Once this is set the mosquitto add-on can be started.
- Configure Home Assistant to use the new MQTT broker just created
- Go to 'Configuration -> Integrations' and you should see a MQTT configure button.
- Cleck 'Enable Discovery', then click submit.
- Set up your bulb to connect to your new Home Assistant Server MQTT Broker
- Go to your bulbs ip address in a browser.
- 'Configuration --> Configuration MQTT'
-
Host [Your MQTT Server, same as the Home Assitant server IP]
Port [1883]
User [Username set up in MQTT config]
Password [Username set up in MQTT config]
Client and Topic can be left default, but I usually set them to something identifiable. - Go back to the main page and select console, and look for the following (If you do not see this, restart the light and look again)
-
20:30:59 MQT: Attempting connection...
20:30:59 MQT: Connected - If you see connected, your MQTT is working
- enable 'Home Assistant automatic discovery'
- Go back to the bulb main page and select 'Console'
- Enter 'SetOption19 1' and hit enter
- Home Assistant automatic discovery should now be enabled, you home assistant should now detect the new devices
Document Actions