Update on Tuya Devices (tuya-convert)

Don’t have a Shelly device yet disclaimer

We just need to keep pouring money into Shelly so eventually they’ll make all of these devices that let us overwrite the firmware if we even want to.
From what I hear there’s barely any reason to update the firmware anymore, they natively speak MQTT and let you disable the cloud… I thought I saw.

Now we just need them to fill all these Tuya device gaps.

I’ve had success building from esphome with:

  platform: ESP8266
  board: esp01_1m  

then compiling/downloading, naming thirdparty.bin and flashing via tuya-convert’s 3rd party option. You can also follow the normal process and upload the compiled esphome binary via web “upgrade” in tasmota.

Just bought the Teckin SP22 however it looks they have now Realtek chips to replace the ESP ones. So tuya convert doesn’t work anymore. Looking for a different approach.

This is a closeup of the chip

Date on the board is 08/07/2019 see below;

look at the left top just right of the condensator with the red marking.

Did you saw that excellent news: Tuya convert 2.0 soon!!!

I used this today on some (AU) Brilliant switches that have the updated firmware, worked beautifully.

git clone https://github.com/M4dmartig4n/tuya-convert.git
cd tuya-convert
./install_prereq.sh

Once everything is updated, you can proceed. I had an issue with the SSL dependencies not coming down, someone helped me out with this. Maybe just run it anyways to ensure you get it, or skip this and come back to it if you need it.

sudo pip3 install paho-mqtt pyaes tornado git+https://github.com/M4dmartig4n/sslpsk.git pycrypto

./start_flash.sh
curl http://10.42.42.42/flash3
1 Like

For those who use Proxmox, there is a fork of the Whiskerz Tuya Container by SirRedZ that includes the new SDK: https://github.com/SirRedZ/ProxMox-Tuya-Convert-2.0-Container

Used it yesterday to flash 4 Tuya smart plugs, worked like a charm.

I get this error, could you help, please?

# pip3 install paho-mqtt pyaes tornado git+https://github.com/M4dmartig4n/sslpsk.git pycrypto
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting git+https://github.com/M4dmartig4n/sslpsk.git
  Cloning https://github.com/M4dmartig4n/sslpsk.git to /tmp/pip-req-build-xvoc_uaa
Requirement already satisfied (use --upgrade to upgrade): sslpsk==1.0.0 from git+https://github.com/M4dmartig4n/sslpsk.git in /usr/local/lib/python3.7/dist-packages
Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.7/dist-packages (1.4.0)
Requirement already satisfied: pyaes in /usr/local/lib/python3.7/dist-packages (1.6.1)
Requirement already satisfied: tornado in /usr/local/lib/python3.7/dist-packages (6.0.3)
Requirement already satisfied: pycrypto in /usr/lib/python3/dist-packages (2.6.1)
Building wheels for collected packages: sslpsk
  Running setup.py bdist_wheel for sslpsk ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-xvoc_uaa/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-v_xppu9k --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.7
  creating build/lib.linux-armv7l-3.7/sslpsk
  copying sslpsk/__init__.py -> build/lib.linux-armv7l-3.7/sslpsk
  copying sslpsk/sslpsk.py -> build/lib.linux-armv7l-3.7/sslpsk
  creating build/lib.linux-armv7l-3.7/sslpsk/test
  copying sslpsk/test/__init__.py -> build/lib.linux-armv7l-3.7/sslpsk/test
  copying sslpsk/test/test_sslpsk.py -> build/lib.linux-armv7l-3.7/sslpsk/test
  copying sslpsk/test/example_server.py -> build/lib.linux-armv7l-3.7/sslpsk/test
  copying sslpsk/test/example_client.py -> build/lib.linux-armv7l-3.7/sslpsk/test
  copying sslpsk/test/__main__.py -> build/lib.linux-armv7l-3.7/sslpsk/test
  running build_ext
  building 'sslpsk._sslpsk' extension
  creating build/temp.linux-armv7l-3.7
  creating build/temp.linux-armv7l-3.7/sslpsk
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c sslpsk/_sslpsk.c -o build/temp.linux-armv7l-3.7/sslpsk/_sslpsk.o
  sslpsk/_sslpsk.c:19:10: fatal error: openssl/ssl.h: No such file or directory
   #include <openssl/ssl.h>
            ^~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for sslpsk
  Running setup.py clean for sslpsk
Failed to build sslpsk

Try running this;

sudo apt-get install libssl-dev
2 Likes

Unfortunately, the new SHP2 v2.4 don’t work anymore with this.

Hi all,
I am using Lonsonho powermetering RGB plugs. The last one I received cannot be converted with tuya-convert, I also tried M4dmartig4n’s updatet version.

Below a part of the smarthack-mqtt.log, it looks like the device is connecting but then there is a socket error:
1569782518: New connection from 127.0.0.1 on port 1883.
1569782518: New client connected from 127.0.0.1 as P1 (p2, c1, k60).
1569782518: No will message specified.
1569782518: Sending CONNACK to P1 (0, 0)
1569782518: Received PUBLISH from P1 (d0, q0, r0, m0, ‘smart/device/in/84521276840d8eb1f2c8’, … (111 bytes))
1569782518: Sending PUBLISH to 84521276840d8eb1f2c8 (d0, q0, r0, m0, ‘smart/device/in/84521276840d8eb1f2c8’, … (111 bytes))
1569782518: Socket error on client P1, disconnecting.

I am open to any suggestion. Thanks!

Things to check, are you using authentication? User and Pass. Are your topics correct.

One thing that is weird is that your connections are localhost connections, which may be how it works on Hass.io but since i don’t use that I’m not sure. When other devices connect to your broker are they connecting the same way?

All settings were ok (default from tuya-convert). I did a fresh install of Raspbian Buster on another sdcard with today’s tuya-convert from https://github.com/ct-Open-Source/tuya-convert . The hack was succesful now. Used same settings as before.
Thanks for your input.

Thinking about buying about 40 Teckin SB50 bulbs, can someone confirm that tuya-convert does in fact still work on the SB50? I would hate to buy all the bulbs and then have to send them back because I couldn’t flash them, would rather not waste my money if I can avoid it.

Thanks!

Teckin don’t seem to get the best review… just thought you might to watch this

Has anyone manged to flash the Teckin SP27 plugs? I am about to send back some as I couldn’t flash them despite some fantastic support on GitHub from the people on that project. It sounds like they probably should have been able to be flashed but it just didn’t work for me so I thought I’d ask here before I give up.

I just watched that video today actually, that’s what lead me here and to the teckin bulbs :slight_smile: . They seem to offer the best brightness/features for the cost. When buying 10+ of them, every dollar cheaper the bulb is saves me a fair amount of money. Since I can get them for $10-$11 a bulb, I can live with the trade off that they are not THAT bright, and even though they don’t have a great soft white, I don’t really like orange light anyways, so that should be fine. My current bulbs are sengled element plus, and I don’t put them all the way “soft white” (2700K), I don’t like the orange it’s provides, so I am thinking the Teckins should be good enough for me. I really am just after the adjustable white temperature feature to use with the circadian lighting custom component. In my house, each light fixture has 2 bulbs (if not more) so that should be bright enough for what I need. And I am probably going to buy a 4 pack and install them and configure them to see how they perform in my house before dropping $400 on 40 of them.

Thanks for looking out!

I use the Yeelights which have been great, plus you don’t need to flash them, they work out of the box without any cloud dependency. They aren’t much more expensive

1 Like

Hmm, I will have to think about that. I found the Yeelight on the bay for about $14/bulb. That would add $160 total to my investment. Depending on how I like the teckin bulbs after I test them, I might do the whole house with the teckins to save some money now and when they start to fail replace them with the yeelight. Yeelight is a better bulb, but $160 is a lot of money I could put towards other home automation goodies.

Thanks for the input. I have some testing to do!

I can 2nd that, had Yeelights for years, great product and haven’t had a single failure.

The SP27’s don’t contain the “power monitoring” functionality, if that’s what you were after. You need the SP23 version plugs. I did the same thing, and sent the SP27’s back.

I have managed to flash my “bricked” SP23’s using the newer version of tuya-convert. Now all 16 plugs are up and running in HA.