ct-Open-Source / tuya-convert

A collection of scripts to flash Tuya IoT devices to alternative firmwares
MIT License
4.64k stars 498 forks source link

device did not appear with the intermediate firmware #472

Open jcageman opened 4 years ago

jcageman commented 4 years ago

I am trying to flash a Woox R5077 (tuya wifi bulb) wifi RGB GU10 lightbulb. Today i already did it succesfully with one, but i didn't use that bulb for some time with the tuya app. The one i'm trying now has been used recently with the tuya app and its firmware might have been updated?

Any suggestions for trying?

I get the following output from running start_flash.sh:

./start_flash.sh 
Checking for network interface wlo1... Found.
Checking UDP port 53... Occupied by systemd-resolve with PID 2159.
Port 53 is needed to resolve DNS queries
Do you wish to terminate systemd-resolve? [y/N] y
Attempting to stop systemd-resolved.service
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... Available.
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.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
..................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
..................
SmartConfig complete.
Resending SmartConfig Packets
..................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
................
SmartConfig complete.
Resending SmartConfig Packets
..........
Device did not appear with the intermediate firmware
Check the *.log files in the scripts folder
Do you want to try flashing another device? [y/N] n

Logs smarthack-mqtt.log smarthack-psk.log smarthack-udp.log smarthack-web.log smarthack-wifi.log

kueblc commented 4 years ago

could not establish sslpsk socket: <class 'ssl.SSLError'> returned a result with an error set

This line in your psk log suggests your OpenSSL is outdated.

jcageman commented 4 years ago

could not establish sslpsk socket: <class 'ssl.SSLError'> returned a result with an error set

This line in your psk log suggests your OpenSSL is outdated.

i checked and this is due to my own attempts reading issues on github, one recommended changing psk-frontend.py shebang to python3, afterwards i reverted it back, which shows expected errors again in the error logs. thanks for noticing though! Sorry for the mess in the logs, should have cleared them.

kueblc commented 4 years ago

Could you please check your OpenSSL version?

Run openssl version. I believe it should be at least 1.1.1.

jcageman commented 4 years ago

openssl version OpenSSL 1.1.1 11 Sep 2018

kueblc commented 4 years ago

OK great, we can rule that out. Can you repeat the process while recording the network traffic? Run tcpdump -i wlo1 -w capture.pcap and attempt start_flash again.

jcageman commented 4 years ago

I cleaned all my log files and did one more try. Probably better to look at these:

smarthack-mqtt.log smarthack-psk.log smarthack-udp.log smarthack-web.log smarthack-wifi.log

jcageman commented 4 years ago

had to rename extension, since github doesn't support upload of .pcap files apparently, but its the pcap file as requested capture.txt

kueblc commented 4 years ago

This latest attempt, the device never connected. I can see the device MAC address in your earlier wifi log. See if you can get there again.

FYI once the device makes a connection (appears in wifi log) you do not need to repeat the pairing process with each attempt. It will automatically reconnect when you run start_flash again unless you put it back into pairing mode (resetting the wifi config).

jcageman commented 4 years ago

It just seems i am not able to connect to these specific bulbs (the one in the first log i posted is probably the bulb that i did manage to convert). They are all exactly the same, except that i didn't use the first bulb with the Tuya app recently. I can still pair with the tuya app itself without a problem while pairing so its something else..

kueblc commented 4 years ago

OK I see. It is added to the Tuya app now? Can you retrieve the device info?

meingraham commented 4 years ago

I did see a user post about a week ago that they thought they'd encountered a device with an ESP82xx that would not take the TC flash... because it appeared the the Tuya firmware had been patched ☹️ I hope not...

jcageman commented 4 years ago

OK I see. It is added to the Tuya app now? Can you retrieve the device info?

What info do you need to know? i had tuya-cli working at some point

jcageman commented 4 years ago

[ { name: 'GU10 Smart Bulb R5077 5', id: '75014088b4e62d6bfd59', key: '1ee8539aef2271e4' },

For this specific light i get the above information from tuya-cli by adding it to the app again

kueblc commented 4 years ago

@meingraham could you link to the discussion? A copy of the firmware in question would be really valuable.

@jcageman if you have the device added to your network, you can run tuya-discovery.py on the same network to pick up the relevant device information.

jcageman commented 4 years ago

tuya-discovery.py

Thanks, it says listening and took a long time to give some info back. From the tuya app i was able to find that 75014088b4e62d6bfd59 is the one i am trying to flash at the moment. Would it be possible to join a chat/discord or whatever to speed up the conversation (if you don't mind of course)

192.168.1.107 {'ip': '192.168.1.107', 'gwId': '686633613c71bf33fe74', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key35nu9wt9xxnv4', 'version': '3.3'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.107 {'ip': '192.168.1.107', 'gwId': '686633613c71bf33fe74', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key35nu9wt9xxnv4', 'version': '3.3'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.107 {'ip': '192.168.1.107', 'gwId': '686633613c71bf33fe74', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key35nu9wt9xxnv4', 'version': '3.3'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'} 192.168.1.105 {'ip': '192.168.1.105', 'gwId': '02704107bcddc2a2c4d2', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'} 192.168.1.106 {'ip': '192.168.1.106', 'gwId': '54263524807d3a2ce659', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'key4fv3xs8twchhy', 'version': '3.1'}

ViXXoR commented 4 years ago

I'm having the exact same issue with a new pair of AUKEY SH-PA1s bought off of Amazon.ca within the last couple if weeks. After seeing this I'm really hoping the firmware isn't patched.

kueblc commented 4 years ago

OK it looks like this device should be compatible with tuya-convert.

The last 12 characters of the gwId is the MAC address, which on looking up the OUI, is definitely an Espressif device. Version 3.3 is the TLS firmware so it should be making calls through the psk-frontend which we should see in the psk log.

It seems like the current roadblock is just getting the device added to the vtrust-flash network.

kueblc commented 4 years ago

We don't have an official chatroom but I assure you I am keeping this thread open.

@ViXXoR can you provide more details as to how your issue is related? The issue we're seeing here is that the device is not pairing. If you have been able to flash other devices but have a device that will not appear in the wifi log, it might be the same issue.

jcageman commented 4 years ago

just checking, but myvtrust-flash network has no password, while i read some guides which say flashmeifyoucan should be the password. I also connect to it with my phone without issues, which is also shown in the logs, but the bulb doesn't somehow.

ViXXoR commented 4 years ago

I believe it is related.

I just flashed a couple CE plugs a day or two ago with no issues. With the AUKEY, it flashes the intermediate firmware and never goes past that. I get the same "device did not appear" and I see the SSL cipher errors in smarthack-psk log.

kueblc commented 4 years ago

In this issue, @jcageman was not able to install the intermediate firmware, so it is not likely related. The SSL cipher errors are irrelevant as the device never connected, so they are from another device (likely the mobile device).

kueblc commented 4 years ago

@jcageman the password requirement was removed a few versions back to make the process easier.

kueblc commented 4 years ago

@jcageman I have another idea, since you're able to get the device added to tuya-cli, we can issue a command to force the device to switch from your home network to vtrust-flash.

kueblc commented 4 years ago

I'm assuming you already have tuyapi, if not do npm i -g tuyapi.

Then open a NodeJS repl, node.

Paste the following

const {MessageParser, CommandType} = require('tuyapi/lib/message-parser')

function switchAP( ip, key ){
    const payload = JSON.stringify({
        ssid: "vtrust-flash",
        passwd: "",
        token: ""
    })
    const parser = new MessageParser({
        key,
        version: 3.3
    })
    const buffer = parser.encode({
        data: payload,
        commandByte: CommandType.AP_CONFIG,
        sequenceN: 0
    })
    const client = new net.Socket
    client.connect( 6668, ip )
    client.on( 'connect', () => {
        client.write( buffer )
        client.destroy()
    })
    client.on( 'error', console.log )
}

Then type switchAP( <device IP>, <device key> )

This should ask the device to switch from your home network to the vtrust-flash network. I believe it is OK to do this even when vtrust-flash isn't running, it will connect when it becomes available and then you can skip the pairing process.

ViXXoR commented 4 years ago

@kueblc I may have made an incorrect assumption in saying that the intermediate firmware was flashed. My output matches what the OP was showing, so I may in fact be in the same boat. I'll simply follow this thread and try any solutions that come up and see if they help.

kueblc commented 4 years ago

@ViXXoR you can check if the intermediate flashed by looking in your web log. If it did, you should see two requests for upgrade.bin. The output for a device that fails to complete the process will look the same regardless of the underlying cause, but you can find out more by reading the logs.

jcageman commented 4 years ago

I'm assuming you already have tuyapi, if not do npm i -g tuyapi.

Then open a NodeJS repl, node.

Paste the following

const {MessageParser, CommandType} = require('tuyapi/lib/message-parser')

function switchAP( ip, key ){
  const payload = JSON.stringify({
      ssid: "vtrust-flash",
      passwd: "",
      token: ""
  })
  const parser = new MessageParser({
      key,
      version: 3.3
  })
  const buffer = parser.encode({
      data: payload,
      commandByte: CommandType.AP_CONFIG,
      sequenceN: 0
  })
  const client = new net.Socket
  client.connect( 6668, ip )
  client.on( 'connect', () => {
      client.write( buffer )
      client.destroy()
  })
  client.on( 'error', console.log )
}

Then type switchAP( <device IP>, <device key> )

This should ask the device to switch from your home network to the vtrust-flash network. I believe it is OK to do this even when vtrust-flash isn't running, it will connect when it becomes available and then you can skip the pairing process.

do i have to be in pairing mode for this or just execute after already being paired to tuya app? seems not to be doing anything.

switchAP(192.168.1.102, keywrqvhydt3ghp3) ...

kueblc commented 4 years ago

You need to execute that on a network which the device is already connected to. If it is paired to your home network and set up with tuya-cli, use the key from that and IP address of the device on your network.

kueblc commented 4 years ago

You may also try changing CommandType.AP_CONFIG to CommandType.AP_CONFIG_NEW, not sure if that also changed with version 3.3.

jcageman commented 4 years ago

You need to execute that on a network which the device is already connected to. If it is paired to your home network and set up with tuya-cli, use the key from that and IP address of the device on your network.

Did exactly that as far as i know and the script is just hanging without doing anything

I used the discovery script to make sure i used the right information:

192.168.1.102 {'ip': '192.168.1.102', 'gwId': '75014088b4e62d6bfd59', 'active': 2, 'ability': 0, 'mode': 0, 'encrypt': True, 'productKey': 'keywrqvhydt3ghp3', 'version': '3.3'}

kueblc commented 4 years ago

Also make sure that the key is the one from tuya-cli, not the productKey from tuya-discovery

kueblc commented 4 years ago

Once you run the switchAP function, the change should take effect immediately, but there won't be any output. You can verify that the device has disconnected from your home network though.

jcageman commented 4 years ago

Oke, seems to be hanging still.

I found the key

[ { name: 'GU10 Smart Bulb R5077 5', id: '75014088b4e62d6bfd59', key: '3baea4fcf4fd3549' },

Still get the following and the device is still part of the network

switchAP(192.168.1.102,3baea4fcf4fd3549)
...

Tried commandByte: CommandType.AP_CONFIG_NEW as well

kueblc commented 4 years ago

switchAP(192.168.1.102,3baea4fcf4fd3549)

You must quote the arguments, sorry for not mentioning

switchAP("192.168.1.102", "3baea4fcf4fd3549")

jcageman commented 4 years ago

switchAP("192.168.1.102", "3baea4fcf4fd3549")

my javascript sucks, was already doubting. It executes right away, tried both options again, not errors, but device is still part of the network

kueblc commented 4 years ago

Are you able to ping 192.168.1.102?

jcageman commented 4 years ago

Are you able to ping 192.168.1.102?

ping 192.168.1.102
PING 192.168.1.102 (192.168.1.102) 56(84) bytes of data.
64 bytes from 192.168.1.102: icmp_seq=1 ttl=255 time=11.7 ms
64 bytes from 192.168.1.102: icmp_seq=2 ttl=255 time=39.8 ms
64 bytes from 192.168.1.102: icmp_seq=3 ttl=255 time=6.24 ms
64 bytes from 192.168.1.102: icmp_seq=4 ttl=255 time=86.4 ms
kueblc commented 4 years ago

Hmm I am a loss right now. If we can't establish a connection, we won't be able to tell if the firmware has changed. It looks like it should be able to flash if we can get past the pairing step.

jcageman commented 4 years ago

ok, i managed to connect the device though!

const TuyAPI = require('tuyapi');

const device = new TuyAPI({
  id: '75014088b4e62d6bfd59',
  key: '3baea4fcf4fd3549'});

(async () => {
  await device.find();

  await device.connect();

  let status = await device.get();

  console.log(`Current status: ${status}.`);

  await device.set({set: !status});

  status = await device.get();

  console.log(`New status: ${status}.`);

  device.disconnect();
})();

This toggles the light!

kueblc commented 4 years ago

Excellent, so for sure we have the correct key.

Now I'm wondering if the AP_CONFIG command format has changed.

Are you comfortable and able to modify DNS requests on your home network, ie through dnsmasq on your router or on a home server? If you can capture *.tuya(us|eu|cn).com requests, we can redirect them to our fake-registration-server.

meingraham commented 4 years ago

I can't find the chat. All I know was that when I saw it I ordered some of the GD-30W Diffuser so I'd get the version that I can easily Tuya-Convert... before the stock upgrades to a later Tuya firmware.

I'll keep my eyes & ears open for more buzz... should it come up again. And I will ask folks to download the firmware for analysis.

jcageman commented 4 years ago

dnsmasq

Never done anything like it, i would like to have a look at the tuyAPI first, maybe we are just slightly off (i have a feeling we are already close)

jcageman commented 4 years ago

I tried modifying your script a bit and added logging, but its really connecting and writing the data to it. Might really indicate a change in how to connect to these lights.

We might be able tocapture the registration process from the app.

Tomorrow i will try to flash one of the other devices which seems to be version 3.2 and see how that goes

bryeartem commented 4 years ago

Not to hijack the thread... but I think I was having a similar issue... and seeing this in the web log... any suggestions? Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "./fake-registration-server.py", line 224, in post self.reply(answer, encrypted) File "./fake-registration-server.py", line 85, in reply payload = b64encode(AES.new(options.secKey.encode(), AES.MODE_ECB).encrypt(pad(answer))).decode() File "/home/brian/.local/lib/python3.7/site-packages/Crypto/Cipher/_mode_ecb.py", line 135, in encrypt c_uint8_ptr(plaintext), File "/home/brian/.local/lib/python3.7/site-packages/Crypto/Util/_raw_api.py", line 235, in c_uint8_ptr raise TypeError("Object type %s cannot be passed to C code" % type(data)) TypeError: Object type <class 'str'> cannot be passed to C code [E 191229 21:24:28 web:2246] 500 POST /gw.json?a=tuya.device.dynamic.config.get&et=1&gwId=03046203807d3a2d771e&t=87&v=1.0&sign=f515eaf936ba6a2a11dea08041d888de (10.42.42.1) 7.59ms

kueblc commented 4 years ago

@bryeartem not related to this issue, feel free to open a new one with your full logs attached. For a quick fix you might try adding .encode() after answer on line 85 of fake-registration-server.

jcageman commented 4 years ago

this morning i tried with a few light bulbs from tuya that showed version 3.2 and they flashed without any problems. These are just normal light bulbs not spots like the GU10 one i couldn't flash.

ViXXoR commented 4 years ago

@kueblc I may have made an incorrect assumption in saying that the intermediate firmware was flashed. My output matches what the OP was showing, so I may in fact be in the same boat. I'll simply follow this thread and try any solutions that come up and see if they help.

FWIW, and I feel silly having not tried this before posting, after plenty of power-cycling and watching log files, I started thinking it may be a connectivity issue. I moved some things around and got the plug just a few physical inches from the vtrust-flash source. After that, I was able to flash two plugs without issue. I guess the antennas in some devices are significantly weaker than others.

Sorry for adding fuel to the fire without troubleshooting more myself.

RedGlow commented 4 years ago

I had a similar problem, and the solution was to turn off my firewall (it was stopping the communication between the raspberry with tuya convert and the lamp).

(for @kueblc : yes, I did the same error TWICE because apparently I have the memory of a goldfish xD)

deiger commented 4 years ago

It seems I have the same issue, with a version 3.3 device:

smarthack-mqtt.log

1578428296: mosquitto version 1.4.10 (build date Wed, 13 Feb 2019 00:45:38 +0000) starting
1578428296: Using default config.
1578428296: Opening ipv4 listen socket on port 1883.
1578428296: Opening ipv6 listen socket on port 1883.
^C1578428442: mosquitto version 1.4.10 terminating

smarthack-psk.log

new client on port 443 from 10.42.42.31:39720
('could not establish sslpsk socket:', SSLError(1, u'[SSL: NO_SHARED_CIPHER] no shared cipher (_ssl.c:661)'))
^CTraceback (most recent call last):
  File "./psk-frontend.py", line 111, in <module>
    main()
  File "./psk-frontend.py", line 104, in main
    r,_,_ =  select.select(readables, [], [])
KeyboardInterrupt

smarthack-udp.log

Listening for Tuya broadcast on UDP 6666
Listening for encrypted Tuya broadcast on UDP 6667
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
10.42.42.28 b'{"ip":"10.42.42.28","gwId":"e62b573f2a5e6906","active":0,"ablilty":0,"encrypt":true,"productKey":"a3g9fxaujjgtei27","version":"3.3"}'
^C

smarthack-web.log

Listening on 10.42.42.1:80
^CReceived SIGINT, exiting...

smarthack-wifi.log

Configuring AP interface...
RTNETLINK answers: File exists
RTNETLINK answers: File exists
Starting DNSMASQ server...
Starting AP on wlan0...
Configuration file: /dev/stdin
wlan0: Could not connect to kernel driver
Using interface wlan0 with hwaddr b8:00:00:00:00:00 and ssid "vtrust-flash"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 
wlan0: AP-STA-CONNECTED 28:6d:cd:16:48:91
wlan0: AP-STA-CONNECTED 60:00:00:00:00:00
wlan0: AP-STA-DISCONNECTED 28:6d:cd:16:48:91
wlan0: AP-STA-CONNECTED 28:6d:cd:16:48:91
wlan0: AP-STA-DISCONNECTED 28:6d:cd:16:48:91
wlan0: AP-STA-CONNECTED 28:6d:cd:16:48:91
wlan0: interface state ENABLED->DISABLED
wlan0: AP-STA-DISCONNECTED 28:6d:cd:16:48:91
wlan0: AP-STA-DISCONNECTED 60:00:00:00:00:00
wlan0: AP-DISABLED 
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
AP closed
Stopping DNSMASQ server...
kueblc commented 4 years ago

@deiger, this is a different issue. tuya-convert only supports ESP82xx devices and yours is unfortunately a WinnerMicro based device.