HomeAutomation reflash plugs to Tasmota
I wrote this post explaining why you might want to reflash your plugs. Now lets see how you do it.
I purchased a set of generic plugs that work with the Smart-Life app :
https://amzn.to/2WNxYLV
The first step is to make a plug reflasher.
For this, I used a Raspberry Pi 3 Model B V1.2 with
Image : 2020-08-20-raspios-buster-armhf-full.img
Connect a network cable (or do this via console on device not on SSH)
Turn off WIFI by clicking on wifi symbol and disabling WIFI
git clone https://github.com/ct-Open-Source/tuya-convert
cd tuya-convert
Now we install the bits of software it needs with
./install_prereq.sh
And start the reflasher :
./start_flash.sh
It is handy to open another window and see the log files
cd tuya-convert
tail -f scripts/*.log
Answer the questions to say you are sure you know what you are doing.
To put a plug in the right mode to flash it you normally press the on/off button for about 10 seconds.
When plug is detected pick ‘flash with Tasmota.bin’
Wait 30-40 seconds for plug to be flashed. When it is finished it will say ‘Do you want to flash another device’
Connect to the new Wifi device form your phone. Tasmota-1234
Enter your Wifi name and password in the top two boxes (AP1 SSID and Password)
Click save
Find the new plug on your wifi. I do this by going to my router and looking at the ‘client list’. It will be called tasmota-1234 or will be the one that has the shortest DHCP lease time (30 seconds or so). When you have its IP address, go to that address in your browser.
Click configure Module and pick a plug type. If you cannot find anything lcose, go for ‘Generic (18)’. For the plugs I have, I found ‘GoSund SP1 v23 (55)’ works fine.
Click save and then Main menu.
Click Configuration and MQTT. This is how you will link it to Home-Assistant.
For Host, enter the IP address of your control server. Te IP address stays as ‘1883’.
For Client, give it a name like ‘Plug-01’.
User and Password are for the MQTT user in Home-Assistant. You should already know this as you set it up (see earlier post on MQTT).
For Topic – Give it a unique name. I didn’t change this at the start and found multiple plugs going on and off each time I clicked on one in Home-Assistant. Leave the ‘full topic’ as it is and click SAVE and Main menu.
Click on Configuration and ‘Other’ and set a web admin password. You will need this to get back to this screen. (when you try the login user will be ‘admin’ and the password will be what you set here). Give it a friendly name like Plug-01 and put a tick in the box that says ‘template’
The firmware version will be 8.1.0.2 (this is what currently comes with the tuya-convert program. Click on ‘Firmware-Upgrade’ to get to V9.2.x
Replace the download path with : http://ota.tasmota.com/tasmota/release/tasmota-sensors.bin
And click upgrade. Do not click on ‘Main menu’ – just wait.
The plug will go off the network for about 2 minutes while it downloads and upgrades.
If this restarts and still have 8.1.0.2 as the version, try downloading the file and upgrading using the other option on the same page to upload a file.