ct-Open-Source / tuya-convert

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

WiFI-W6B #721

Open DJ-Q opened 4 years ago

DJ-Q commented 4 years ago

I have a "No Neutral" 2 gang touch light switch. The markings on the board say WIFI-W6B and i can see a ESP8285 on board.

I can't get this to flash using tuya convert. The switch seems to connect to the AP and then immediatley comes out of pairing mode. Tuya convert just says

SmartConfig complete. Resending SmartConfig Packets

over and over and then fails with

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

I have used the same setup to successfully flash smart plugs - so know my installation and method works - is there anything that would stop this switch from accepting tuya convert?

kueblc commented 4 years ago

Check the *.log files in the scripts folder

Can't help much without these

is there anything that would stop this switch from accepting tuya convert

New firmware (#483)

broekhuijsen commented 4 years ago

Hi there,

I have exactly the same device. I have tried many many times, but it does not work.

After failing all these times, I have installed the tuya app to see if it even would work. And it does.

Checked the firmware

WiFi 1.1.1 MCU 1.1.1

I hereby upload my files, hoping it is helpful.

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

broekhuijsen commented 4 years ago

Here some pictures of the board.

It also supports 433 Mhz

20200806_235643 20200806_235637

duvalt commented 4 years ago

Hi, Same model for me and same problem ... Do you know where to connect wires (3.3, GND, TX, RX and GPIO-0) for wired flashing ? Thanks in advance.

Update Find this : https://codesandbolts.com/girier-smart-wall-switch-wifi-w6-b-custom-firmware/

broekhuijsen commented 4 years ago

Update Find this : https://codesandbolts.com/girier-smart-wall-switch-wifi-w6-b-custom-firmware/

Wow this is a great find. I have been looking on the internet for this, but could not find anything and was going to try this today with trial and error.

Now I can use my saturday for other fun things :D and there are still two of these in the mail, so I was already afraid to be stuck with tuya for these.

Thanks.

broekhuijsen commented 4 years ago

@duvalt can you manage to flash the device with this pin out? For mine, it doesn't seem to work with my board :(

duvalt commented 4 years ago

@duvalt can you manage to flash the device with this pin out? For mine, it doesn't seem to work with my board :(

Hi, not yet, waiting for ftdi/usb converter, should be delivered in 10 days ...

broekhuijsen commented 4 years ago

@duvalt can you manage to flash the device with this pin out? For mine, it doesn't seem to work with my board :(

Hi, not yet, waiting for ftdi/usb converter, should be delivered in 10 days ...

Ok, well I was not able to do so. I have flashed many devices already with tasmotizer, but this one just won't budge. Now the gpoio0 came lose from the pcb so it is game over for this one. :'(

Maybe there will be a new version of tuyaconvert in the future that will work. I hope I will have more luck with the other two that are coming in.

I wish you good luck, let me know if you managed.

joeldavidw commented 4 years ago

Hi! I am the owner of the blog mentioned above. Sorry to hear that you were not able to flash your device! Not sure if this information would help but I used this CP2102 USB to TTL UART from AliExpress to flash my device.

broekhuijsen commented 4 years ago

Hi! I am the owner of the blog mentioned above. Sorry to hear that you were not able to flash your device! Not sure if this information would help but I used this CP2102 USB to TTL UART from AliExpress to flash my device.

Thanks for the tip. I however have read that there is not really a huge difference between what I am using and what you used:

https://www.banggood.com/FT232RL-FTDI-USB-To-TTL-Serial-Converter-Adapter-Module-p-917226.html?rmmds=myorder&cur_warehouse=CN

So far I have been successful at flashing almost everything. I gues this board just didn't want to cooperate :D

Soon I will receive the other switches at home, let's see if I will be able to flash those. If not, my plan is to hide sonoff basics in my ceiling and then to trigger them with RF buttons through the Sonoff RF bridge and my home-assistant.

https://www.aliexpress.com/item/4000415317711.html?spm=a2g0s.9042311.0.0.3f6c4c4dBkmWJ3

adamb94 commented 4 years ago

Hi, to flash this you need to Exchange RX with TX. It was successful for me.

Do you have pinout for button and relays for this?

iondulgheru commented 4 years ago

I somehow wrote the firmware using serial with the reset pin also connected to ground while booting, and removing the connection from ground after i run esptool command. But I also don't have the pinout for button and relays for this.

broekhuijsen commented 4 years ago

I tried exchanging the RX and TX pins, but no success. I also tried flashing with GPiO0 constantly connected, but nope.

I still didn't receive my other switches, because, well Portuguese postal service... sigh...

Let's see if I manage next time. It would be cool if one of those chinese companies would release all their devices with a minimal web page to flash your software. Or even better, release the hardware with tasmota pre-installed.

There should be a market for that.

broekhuijsen commented 4 years ago

Just one thing, did you manage to flash it with the module mounted in the switch? Because I took it out to flash it.

adamb94 commented 4 years ago

I disconnected W6B-WiFi from rest of switch and had GPIO0 connected to groud constantly during flash. I used cheapest Uart cable found on aliexpress :-) You need to have flash for ESP8285 1MB

DJ-Q commented 4 years ago

just to confirm- i have successfully flashed tasmota onto this switch using USB-UART adapter and following the pin out above, swapping RX and TX

Thanks to the blog author for providing the info.

joeldavidw commented 4 years ago

@iondulgheru @adamb94 I used this template https://templates.blakadder.com/zuczug_3gang.html for the buttons and relays.

broekhuijsen commented 4 years ago

Hmm, I have received the new boards, and again I cannot flash. But I might have found out why.

I have bought a fake FTDI chip apparently. Gonna order a real one in a store nearby.

broekhuijsen commented 4 years ago

Yesss success!!! The FTDI device that I received, turned out to be a fake as well, and it didn't work. But I also ordered a device based on a PL2303 chip (the only other one they had at that store). This chip officially does not work with Windows 10, but luckily someone found out that installing a very old driver resolves that problem.

I even managed to flash the first switch that lost it GPIO0 pad by carefully scratching some of the layer on top of the copper track that lead to that pad.

broekhuijsen commented 4 years ago

The templates that I figured out:

1 gang:

{"NAME":"JR-SEU01-1","GPIO":[0,157,0,0,0,17,0,0,21,0,0,0,0],"FLAG":7,"BASE":2}

2 gang:

{"NAME":"JR-SEU01-2","GPIO":[0,157,0,17,18,0,0,0,0,21,22,0,0],"FLAG":7,"BASE":2}

moshe19803 commented 4 years ago

What software you use to flash?

broekhuijsen commented 4 years ago

What software you use to flash?

I use tasmotizer, very easy to use.

I never managed to flash with an FTDI, even not a real one.

moshe19803 commented 4 years ago

So what hardware you use if you don't use FTDI? tasmotizer with?

broekhuijsen commented 4 years ago

The PL2303, but you must install an old driver.

juan11perez commented 4 years ago

@joeldavidw thank you for posting this pinout. It worked for me as you've laid it out.

However, I could not flash with tasmotizer. It would connect and brake at about 14% progress. I was able to flash with Pyflasher and these settings: boud rate 921600 flash mode DOUT

@broekhuijsen thank you for the template. this switch also provides power consumption. Great!!

honzapatCZ commented 3 years ago

image Just pull RST to GND and no need to cut traces or whatever General rule for unmarked chips is 1 or 4 is RST try to pull it UP or DOWN and it will prob. work

kwirk commented 3 years ago

Some really useful information in this thread. Thanks all for sharing.

So I bought two similar switches, a 1-gang and a 2-gang version. They are slightly different from the one in the picture, as mine are missing the 433MHz components, missing the buzzer (despite the instructions saying it should buzz/beep), and has an blue LED above flashing pins.

The 1-gang flashed (with ESPHome) no trouble whatsoever, using pinouts from @joeldavidw's blog, but the 2-gang was being stubborn, producing timeout and invalid header errors from esptool. I tried re-soldering, checking continuity back to esp8285 pins, using an external power supply, …

In the end I was able to flash the 2-gang switch by using a sequence of: powering up the device without GPIO0 low; putting GPIO0 low then briefly putting RST to low (that's the unlabelled pin between GPIO0 and GROUND from @joeldavidw's blog) to reset the esp8285; and then finally esptool worked.

9magic commented 3 years ago

Hi,

@honzapatCZ thank you for the info about RST pin and a nice picture. I have two unbranded WiFI-W6B switches. I could not use tuya-convert any more. I needed to connect this tuya mcu RST pin to ground and then I flashed with tasmotizer successfully.

I set up the switch without neutral line in the wall and connected capacitor in parallel to the lightbulb. I used @broekhuijsen's template from above but the power readings were swinging around 400W when the light was out and did not change significally when I turned it on.

I cut the power to the switch and went to bed:) Next day I tested actual consumption from the other switch and concluded that the readings are false. I could not use the power calibration commands from tasmota.

Now I use template without power meter from https://templates.blakadder.com/zuczug_1gang.html

Shaman2 commented 3 years ago

Hi. Somebody write this 2-gang W6B switch to ESPHome? Can you show me code?

kwirk commented 3 years ago

Hi. Somebody write this 2-gang W6B switch to ESPHome? Can you show me code?

Not tested this on my 2-gang switch (as not currently installed), but this derived from my 1-gang one which is working well.

status_led:
  pin:
    number: GPIO1

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      inverted: True
      mode: INPUT_PULLUP
    id: button1
    on_press:
      then:
        - light.toggle: light1
  - platform: gpio
    pin:
      number: GPIO4
      inverted: True
      mode: INPUT_PULLUP
    id: button2
    on_press:
      then:
        - light.toggle: light2

light:
  - platform: binary
    name: "Light 1"
    id: light1
    output: relay1
  - platform: binary
    name: "Light 2"
    id: light2
    output: relay2

output:
  - platform: gpio
    id: relay1
    pin: GPIO13
  - platform: gpio
    id: relay2
    pin: GPIO14
Shaman2 commented 3 years ago

Hi. Somebody write this 2-gang W6B switch to ESPHome? Can you show me code?

But radio rf433 channel after reflashing is not working?

Shaman2 commented 3 years ago

status_led:
  pin:
    number: GPIO1

Which header need?

esphome: name: parents_room_switch platform: ESP8285 board: esp_wroom_02

right? Or ESP8566? Chip on my board is ESP8585

kwirk commented 3 years ago

But radio rf433 channel after reflashing is not working?

Sorry, my model doesn't have rf433, so not sure. Possibly try extra GPIOs as binary sensors if not working.

Which header need?

esphome:
name: parents_room_switch
platform: ESP8266
board: esp8285
Hellcube commented 3 years ago

I have MOES Wi-Fi + RF 1GANG switch (single live wire - no neutral) model: WS-EU-RF. I tryed every possible combination and i can't flash this device. I have switched RX-TX, tryed flashing with tasmotizer, pyflash. Tryed every combination with RST+ GND + GPIO0 to get it into flash mode with no luck. Tryed Tuya-convert. I'm out of ideas...

20210310_093257 20210310_130856 20210310_093243

9magic commented 3 years ago

Hi,

Check the thread for post [image: @honzapatCZ] https://github.com/honzapatCZ honzapatCZ https://github.com/honzapatCZ commented on Dec 21, 2020 https://github.com/ct-Open-Source/tuya-convert/issues/721#issuecomment-749051313

On Thu, Mar 11, 2021, 09:28 Hellcube @.***> wrote:

I have MOES Wi-Fi + RF 1GANG switch (single live wire - no neutral) model: WS-EU-RF. I tryed every possible combination and i can't flash this device. I have switched RX-TX, tryed flashing with tasmotizer, pyflash. Tryed every combination with RST+ GND + GPIO0 to get it into flash mode with no luck. Tryed Tuya-convert. I'm out of ideas...

[image: 20210310_093257] https://user-images.githubusercontent.com/4286625/110757759-0a7cab80-824c-11eb-8762-d26c7b96d096.jpg [image: 20210310_130856] https://user-images.githubusercontent.com/4286625/110757761-0badd880-824c-11eb-97aa-2d689a46e5be.jpg [image: 20210310_093243] https://user-images.githubusercontent.com/4286625/110757785-11a3b980-824c-11eb-90cb-bb3ca5c551f3.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ct-Open-Source/tuya-convert/issues/721#issuecomment-796561513, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE76YDFIN6RKMPRGSH6SNRTTDB5K5ANCNFSM4PND4CLA .

Shaman2 commented 3 years ago

I have MOES Wi-Fi + RF 1GANG switch (single live wire - no neutral) model: WS-EU-RF. I tryed every possible combination and i can't flash this device. I have switched RX-TX, tryed flashing with tasmotizer, pyflash. Tryed every combination with RST+ GND + GPIO0 to get it into flash mode with no luck. Tryed Tuya-convert. I'm out of ideas...

Are you have solved the problem?

Hellcube commented 3 years ago

I have MOES Wi-Fi + RF 1GANG switch (single live wire - no neutral) model: WS-EU-RF. I tryed every possible combination and i can't flash this device. I have switched RX-TX, tryed flashing with tasmotizer, pyflash. Tryed every combination with RST+ GND + GPIO0 to get it into flash mode with no luck. Tryed Tuya-convert. I'm out of ideas...

Are you have solved the problem?

nope still no luck. I will try again today...

duvalt commented 3 years ago

Hi Guys, I think the problem is linked to the USB / TTL converter you're using. I never managed to flash WIFI-W6B board with FT232RL and it works fine with CP2102. Hope it will help you

broekhuijsen commented 3 years ago

Hi Guys, I think the problem is linked to the USB / TTL converter you're using. I never managed to flash WIFI-W6B board with FT232RL and it works fine with CP2102. Hope it will help you

I confirm. I never managed to flash with FTDI, but other flashers seem to work fine.

CP2102 has one big disadvantage, the driver automatically is disabled because aparently there are a lot of counterfeit products and the provider of the hardware has chosen to cripple the hardware by driver and you have to replace the driver by an older version every time to be able to flash.

Lately I am using this thing as my default flash device, works almost every time for everything.

Shaman2 commented 3 years ago

Lately I am using this thing as my default flash device, works almost every time for everything.

CH340G no need to change driver for work?

lubino123 commented 3 years ago

What About 433? Do you know pins? :/

EDV64 commented 3 years ago

Hi Guys, I also had a long time to try flash this WiFI-W6B. My solution is to unsolder and lift up pin 11 of unmarked chip (see yellow route on screen above). This route is connected to U0RXD (pin 25) of ESP8285 and probably blocking UART exchange. Also don't forget about GPIO0. Good luck all.

xkolm036 commented 3 years ago

Thanks @EDV64 it works for me. I was not able to flash WIFI-W6B but after unsolder pin 11 tasmotizer flash new bin file without any problem.

Shaman2 commented 3 years ago

Thanks @EDV64 it works for me. I was not able to flash WIFI-W6B but after unsolder pin 11 tasmotizer flash new bin file without any problem.

pin 11 need solder after flash or leave unsolder? What pin 11 do?

xkolm036 commented 3 years ago

Thanks @EDV64 it works for me. I was not able to flash WIFI-W6B but after unsolder pin 11 tasmotizer flash new bin file without any problem.

pin 11 need solder after flash or leave unsolder? What pin 11 do?

My scenario was:

  1. Unsolder pin 11 on unmarked chip (marked by orange line on the picture)
  2. Connect pins 3v3, RX, TX, GPIO0 (connect to the ground) and GND to USB-UART adapter (in my case NodeMcu v2 CP2102)
  3. Connect USB-UART adapter to PCs USB
  4. Flesh new bin file by Tasmotizer
  5. Solder back pin 11.

But I have no idea what is the funtion of pin 11 I just try it.

EDV64 commented 3 years ago

Thanks @EDV64 it works for me. I was not able to flash WIFI-W6B but after unsolder pin 11 tasmotizer flash new bin file without any problem.

pin 11 need solder after flash or leave unsolder? What pin 11 do?

The reason of action is so the pin 11 connected to pin 25 of ESP8266, which is U0RXD of UART. If output level signal of pin 11 unmarked chip will low, RX line of ESP will not receive data from UART. But don't forget about 25 pin of ESP8266 is also GPIO3, so it was possible a normal sensor or data exchange between unmarked chip and ESP on this line. Probably it can be a output of touch sensor in 3-way switch... don't know, I have 1-way one. Resuming - if you plan regulary flashing throw UART, you don't have to solder pin 11 back. And alternatively, if all future updates will be throw OTA, then you can return this pin back. P.S. I think if you will find a reason of logic on pin 11 and regulary flashing exclusively throw UART will needed, it will possible to cut the existing trace and connect pin 11 to any other free GPIO of ESP8266...

Hellcube commented 3 years ago

@EDV64 worked for me to Thank You! all works fine even 433 control. I will hook it up to the wall tomorrow. 20210328_114310 20210328_115749 20210328_120219 20210328_120822 I made a backup if some one needs it. Moes 1gang WiFI-W6B backup.zip

Thanks again every one.

Shaman2 commented 3 years ago

worked for me to Thank You! all works fine even 433 control. I will hook it up to the wall tomorrow.

May better only cut off this line for you? Are you found what for this 11 contact?

Somebody try to use buzzer for tasmota or esphome beep function?

mincaeuro commented 3 years ago

Not sure if some tried this, but I was able to flash it without touching the chip:

Shaman2 commented 3 years ago
* (vcc->3.3v, rx->tx,tx->rx, gnd->GPi0)

gnd from UART adapter to gpio0? You are not connected gnd on W6B board?