TASMOTA über Tuya OTA flashen

Vorgehensweise

Die MicroSD-Karte und den Wifi-USB-Dongle in einen Rasberry Pi 2/3 stecken, diesen per Ethernat-Kabel an das lokale Netzwerk anschließen und starten.
Danach die Netzwerk-Adresse ausfindig machen (z.B. Fritzbox) oder Bildschirm Ausgabe und per SSH verbinden.

username: pi
password: raspberry

Nach dem Login erfolg folgende Ausgabe mit einer Kurzanleitung:

+-------------------------------------------------------------------+
| To flash TASMOTA OTA (over the air) do the following steps:       |
|                                                                   |
| sudo -i                                                           |
| cd  /opt/tuya-convert                                             |
| ./start_flash.sh                                                  |
|                                                                   |
| - press multiple time "y" until the AP-Mode starts in a screen    |
| - connect your smartphone to "vtrust-flash" wifi network          |
| - insert the plug into a power-socket and press 5 sec the button  |
| - when the LED blinks fast, press ENTER on the keyboard           |
| - wait until the interim firmware has been installed              |
| - choose no. "2" for TASMOTA firmware to flash                    |
| - HAVE FUN WITH TASMOTA                                           |
+-------------------------------------------------------------------+
May the force be with you!

Hier der Ablauf nochmal dargestellt:

sudo -i
cd  /opt/tuya-convert
./start_flash.sh   

Ausgaben:

tuya-convert v2.4.4
Checking for network interface wlan0... Found.
Checking UDP port 53... Available.
Checking UDP port 67... Available.
Checking TCP port 80... Available.
Checking TCP port 443... Available.
Checking UDP port 6666... Available.
Checking UDP port 6667... Available.
Checking TCP port 1883... Occupied by mosquitto with PID 434.
Port 1883 is needed to run MQTT
Do you wish to terminate mosquitto? [y/N] y

Attempting to stop mosquitto.service
Checking TCP port 8886... Available.
======================================================
  Starting AP in a screen.
  Starting web server in a screen
  Starting Mosquitto in a screen
  Starting PSK frontend in a screen
  Starting Tuya Discovery in a screen

======================================================

IMPORTANT
1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
   This step is IMPORTANT otherwise the smartconfig may not work!
2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
   Make sure nothing else is plugged into your IoT device while attempting to flash.
3. Press ENTER to continue


======================================================
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID                  vtrust-flash
Sending wifiPassword
Sending token                 00000000
Sending secret                0101
................
SmartConfig complete.
Auto retry in 1s. ................................................................................................
IoT-device is online with ip 10.42.42.42
Fetching firmware backup
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1024k  100 1024k    0     0  58484      0  0:00:17  0:00:17 --:--:-- 28629
curl: Saved to filename 'firmware-34e581.bin'
======================================================
Getting Info from IoT-device
VTRUST-FLASH 1.5
(c) VTRUST GMBH https://www.vtrust.de/35c3/
READ FLASH: http://10.42.42.42/backup
ChipID: 34e581
MAC: 24:62:AB:34:E5:81
BootVersion: 7
BootMode: normal
FlashMode: 1M DOUT @ 40MHz
FlashChipId: 144051
FlashChipRealSize: 1024K
Active Userspace: user2 0x81000
======================================================
Ready to flash third party firmware!

For your convenience, the following firmware images are already included in this repository:
  Tasmota v8.1.0.2 (wifiman)
  ESPurna 1.13.5 (base)

You can also provide your own image by placing it in the /files directory
Please ensure the firmware fits the device and includes the bootloader
MAXIMUM SIZE IS 512KB

Available options:
  0) return to stock
  1) flash espurna.bin
  2) flash tasmota.bin
  q) quit; do nothing
Please select 0-2: 2
Are you sure you want to flash tasmota.bin? This is the point of no return [y/N] y
Attempting to flash tasmota.bin, this may take a few seconds...
Flashed http://10.42.42.1/files/tasmota.bin successfully in 14063ms, rebooting...
Look for a tasmota-xxxx SSID to which you can connect and configure
Be sure to configure your device for proper function!

HAVE FUN!
======================================================
Do you want to flash another device? [y/N] n
======================================================
Cleaning up...
Closing AP
Exiting...

FERTIG!

Wifi Driver Realtek 802.11n Installation

Falls der Wifi nano Adapter nicht out of the Box funktioniert, dann folgendermaßen vorgehen.

root@raspberrypi:/opt/tuya-convert# lsusb
Bus 001 Device 004: ID 0bda:f179 Realtek Semiconductor Corp.

In den meisten Fällen handelt es sich um einen RTL8188EU oder RTL8188FU Treiber, der benötigt wird.
In diesem Fall wird letzteres, also RTL8188FU demonstriert:

URL: http://downloads.fars-robotics.net/wifi-drivers/
Dort den Treiber für den verwendetetn Kernel downloaden und installieren.

Aus den folgenden Informationen entnehmen wir 5.4.72-v7 und #1356
Diesen Treiber findet man als Download unter o.g. Link.

root@raspberrypi:/opt/tuya-convert# uname -r
5.4.72-v7+
root@raspberrypi:/opt/tuya-convert# uname -a
Linux raspberrypi 5.4.72-v7+ #1356 SMP Thu Oct 22 13:56:54 BST 2020 armv7l GNU/Linux


Nun downloaden und installieren:

cd /tmp
wget http://downloads.fars-robotics.net/wifi-drivers/8188fu-drivers/8188fu-5.4.72-v7-1356.tar.gz
tar xvfz 8188fu-5.4.72-v7-1356.tar.gz
chmod +x install.sh
./install.sh

Danach den Pi mittels reboot neu starten und das Kommando iwconfig zeigt das wlan0 Interface an.

root@raspberrypi:~# iwconfig
wlan0     unassociated  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency=2.412 GHz  Access Point: Not-Associated
          Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

eth0      no wireless extensions.

lo        no wireless extensions.

Navigation
Eigene Werkzeuge