Costco Feit Smart Dimmer Tuya Convert Tasmota

Thank you @123 and @mxr662. It seems there is more reading ahead in my near future :slight_smile:

Happy Holidays.

I can confirm serial flashing works with the latest batch.

I used ESPHome Integrated into HA and created the following script:

esphome:
  name: dimmer
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "XXXXXXXXXX"
  password: "XXXXXXXXXX"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Dimmer 1 Fallback Hotspot"
    password: "XXXXXXXXXX"

captive_portal:

# Make sure logging is not using the serial port
logger:
  baud_rate: 0
  level: NONE

# Enable Home Assistant API
api:
  password: "XXXXXXXXXX"

ota:
  password: "XXXXXXXXXX"

# My dimmer used the hardware serial port on the alternate pins
uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

# Register the Tuya MCU connection
tuya:

# Make the light
light:
  - platform: "tuya"
    name: "test4387"
    dimmer_datapoint: 2
    switch_datapoint: 1
    min_value: 10
    max_value: 1444

In the ESPHome interface you can click three dot menu -> Compile -> Download Binary.

I hooked up 3.3V, Ground, TX, RX to the FTDI USB serial converter and IO0 was hooked up so I could disconnect it from ground after it booted up.

I used esptool.py (installed through pip - comes with python) to erase the flash and then program the ESPHome binary at address 0x0. I had to power cycle and redo the IO0 ground at startup each time.

I then used my router to assign a “static” IP on my DHCP tables.

Home assistant reports its running Firmware: 1.15.3.

Yes you can restore the original firmware if you have a backup copy of it. Tasmota can do OTA updates with non-Tasmota firmwares; however, I don’t believe you’ll be able to do this with the original firmware (or most ESP devices’ OEM firmwares) like 123 Taras alluded to above. The problem is size
 most OEM firmwares fill up / utilize the entire chipset memory (typically 1MB on most ESP devices). To do OTA updates the incoming firmware must be less than half the available memory’s space (half to save the uploaded file, and the other half to unpack and install it on to). You’ll need to flash the original OEM firmware back on the device serially because of that limitation.

Actually, we are in agreement on how to restore the original firmware.

What I said was to explore using Tasmotizer, implying a hard-wired connection, not OTA, (given that the latest models of these switches are incompatible with tuya-convert).

drjb hasn’t flashed the device yet so is able to backup the original firmware with Tasmotizer. Restoring the original firmware will require the same technique (hard-wired) and not OTA.

Oh I know that you know this Taras, lol! It just kind of read like someone could restore the OEM firmware that way, and I didn’t want drjb to misunderstand or get confused when that didn’t work.

If anybody is interested in potential solution; move to ESPHome for those dimmers. I have flashed two out of four dimmers with ESPHome firmware few days ago and on the very same dimmers that did fail with Tasmota FW. So far, all of them are working fine. The other two did fail few times already with Tasmota FW (9.2.0) with missing “heartbeat” and with a need for power cycle to get them going again.

I do not know what Tasmota FW is doing differently compared to ESPHome in terms of communication with the MCU but it does not work properly. The ESPHome is the way to go until this is root caused and fixed with Tasmota binaries.

1 Like

I bought these dimmers in early November, and sadly, as others have reported, are not flashable via tuya-convert. I really didn’t want to return these given I’ve installed 5 of these already (took some time given how crowded some of my gang boxes were), because they were cheap (on sale), and because they worked fairly well (both physically and via Wi-Fi).

I recently discovered local tuya, which I am now using to control them. This isn’t as ideal as Tasmota, but they are fully functional and not connected / dependent on a third party app or service.

Hoping someone discovers an OTA fix some time in the future. I don’t have the tools and patience to crack these open to flash serially.

@alexm011
Are you saying that the ESPHome binary worked OTA with the latest models, or did you have to physically flash it?

I also bought several of these dimmers in Nov when they were on sale, and found this discussion while looking for firmware to override the minimum dimming level (I emailed Feit and was told the lowest possible level it would dim is 30%). I also run a HA server, so would prefer to have them taken out of the cloud as well. That and the Feit app is horrible.

I’m new to this whole Tuya-Convert process, and after getting the Wemos and Pi setup, then failing to flash Tasmota OTA I finally read the last few posts here. sigh

In hopes of adding some additional info, I tore one apart yesterday hoping to gain some insight and mapped most of the pinouts from the HT66F0185 MCU, so hope this helps. Might try to reverse engineer the MCU/Wifi board if I have time this weekend.

  1. GND
  2. Oscillator
  3. Oscillator
  4. LED 60%
  5. Testpoint (ICP Addr)
  6. LED - 40%
  7. LED - 20%
  8. Testpoint (ICP Clock)
  9. N/C - Routes to a noplace resistor to pin 18 (see pin 18).
  10. Best I can tell, this pin is used to control the load. It routes through the header to mains board and controls a phototriac which I believe regulates the Igt for the AC Load’s main triac.
  11. TYWE2S TX pin
  12. TYWE2S RX pin
  13. LED - On/Off Button
  14. Button - Dimmer Down
  15. On/Off Button
  16. Routes to a 10 resistor then to U3 (noplace 5 pin IC) and mains board header.
  17. Routes to mains board header though a noplace diode.
  18. Button - Dimmer Up
  19. LED - 100%
  20. LED - 80%
  21. Routes to mains board where it’s connected to AC Neutral through two series 1MΩ resistors and a fuse.
  22. +3.3V

Few other notes:

  • Wasn’t able to trace pins 8 & 11, though they could just be N/C
  • All buttons and LEDs are active low.
  • Buttons have an external 10kΩ pull-up to +3.3V
  • 5 Brightness LEDs have a series 1kΩ to +3.3V
  • On/Off LED only has a series 100Ω to +3.3V (why it’s so much brighter). There’s also a pad for a 2nd parallel LED. So if you wanted to make this dimmer, you’d have to replace the resistor with another value, or PWM the pin, which appears to be possible since it’s controlled by the MCU’s PTM output pin for Timer1.
1 Like

I assume the initial connection must be a physical one (OTA becomes possible after the stock firmware is replaced). ESPHome isn’t like tuya-convert which pretends to be the Tuya Cloud service thereby making the initial connection OTA (and immediately permitting OTA updates). New Tuya firmware patched this vulnerability.

Correct. The FW update was done by desoldering the module and connecting to a programmer. As @123 entioned, they patched the Tuya FW and disable OTA update back in Feb/Mar.
After using ESPHome FW for the past few days, I still experience some issues; sometimes, the lights do not turn on (or off) via the HA app. Also, sometimes, the lights just turn off by themselves without any commands been sent. Physical buttons always work properly. So, it seems that those cheap dimmers have some issues. I am still not able to figure out what exactly the issue is.
I have hard time giving up on them since I got six of them.

I wouldn’t call them cheap dimmers 
 but ‘reasonably’ priced instead. :slight_smile:

Hi, could you please guide me or share your YAML for how you did this? I could not find a template for dimmer switch. Thanks.

Also, because Tuya-convert no longer works, you may need to physically flash the device. I followed the steps at https://community.smartthings.com/t/costco-cheap-feit-smart-dimmer-wifi/208142 and it worked as expected. I was able to put Tasmota on it directly that way, and then you can do an online (from the UI) firmware replacement from Tasmota to ESPHome (or you could do ESP Home directly—I did Tasmota first because I knew it would be easy to quickly verify it connected and worked).

Finally had time to desolder the TYWE2S module today, flashed it with the latest Tasmota binary and seems to be working. I was able to get it connected to wifi and open the module. I haven’t configured it yet, but at least the flash was successful.

For anyone planning to do it, here’s what I did. I set the heat gun to 300C/575F and put on a small 5-7mm nozzle. I started by heating up the board directly under the large ground pads until it was somewhat hot to the touch, then flipped it over and clamped it in a pair of helping hands. Starting with one of the rear gnd pads, I focused the heat gun on the pad while very gently lifting up on the corner until until I could see the solder reflow, then lifted it just a bit more to clear the pad. Still holding it up, I let the solder solidify before letting it back down. Then repeated the same process with the other side, sometimes having to swap sides, until both rear pads were free. Finally, I heated up the front solders while slowly lifting up on the antenna end until they came loose. The rear pads are obviously the most difficult, and took 2-4 minutes before breaking loose. Just take it slow and don’t rush it. The front solders came off in about 10 seconds. On the 3rd one I actually added a bit of leaded solder to all the pads first and seemed like the whole process took less than half the time. But not sure if that helped, or I was just getting better at it.

Once flashed, I was able to just solder it back on. First you need to completely clean off the pads so using some solder braid. This is important so it sits flat. Then I put a piece of tape on the back to hold it in place and just added solder to the front pads, and held the iron there for a few more seconds so it would wick up underneath. The ground pads were a bit trickier since there was almost no pad showing, so I just scraped off enough of the solder mask so the iron was touching bare copper.

Just trying out LocalTuya and got the dimmer working as a switch, but can’t seem to get the settings right to work as a dimmer from Home Assistant. What settings did you use?

@4walls @vj950 I did not add these dimmers via YAML, I did so via “Add Integration” under “Config” in HA. I took the following steps:

  1. Add Integration -> Local Tuya
  2. Select the device via the discovery page. Make sure you are assigning these devices using a static IP address.
  3. On the “Entity type selection” screen, select “light.”
  4. Under “Add new entity” screen, you should select “1” for the ID row. This refers to on/off. Under “Brightness (only for white color),” select “2.” This refers to brightness. If the dropdown doesn’t have 1 and 2 (sometimes the dimmer is finnicky like this), what I do is turn on the light manually on dimmer, then start with step 1. Both ID’s should be available.
  5. Continue.

This will allow you turn on/off and set the brightness.

Note: I also wanted to block internet access / DNS to these devices to truly keep them local, but for some reason these devices go into a zombie state. An issue has been raised on the github page. Hope we figure out how to block internet to these devices and control them exclusively via localtuya. This is as of version 3.2.0. My suggestion is not to mess around with blocking internet for these dimmers at this time.

1 Like

Thanks, got it working.

Hi all,

I have a few of these switches from late 2019. At the time I got 1 working and it worked perfectly with ESPHome. I just recently started fresh with HA and got 3 loaded up into ESPHome. Issue being that I don’t get a dimmer entity, I only get on/off. With the lights off ESPHome sees the dimmer value as 0, but once the lights are turned on I get an error on the dimmer. Same issue on all 3 dimmers, and 1 of them is installed on the same circuit/bulbs it worked on with the older firmware.

Any ideas? Is there a way I can use older ESPHome firmware like you can do with Tasmota?

If lights are off log

INFO Reading configuration /config/esphome/living_room_ceiling_lights.yaml...
INFO Starting log output from living_room_ceiling_lights.local using esphome API
INFO Connecting to living_room_ceiling_lights.local:6053 (192.168.20.36)
INFO Successfully connected to living_room_ceiling_lights.local
[18:41:27][I][app:105]: ESPHome version 1.15.3 compiled on Jan 16 2021, 10:17:32
[18:41:27][C][wifi:443]: WiFi:
[18:41:27][C][wifi:303]:   SSID: 'IoT'[redacted]
[18:41:27][C][wifi:304]:   IP Address: 192.168.20.36
[18:41:27][C][wifi:306]:   BSSID: FC:EC:DA:F4:3E:AE[redacted]
[18:41:27][C][wifi:307]:   Hostname: 'living_room_ceiling_lights'
[18:41:27][C][wifi:311]:   Signal strength: -68 dB ▂▄▆█
[18:41:27][C][wifi:315]:   Channel: 11
[18:41:27][C][wifi:316]:   Subnet: 255.255.255.0
[18:41:27][C][wifi:317]:   Gateway: 192.168.20.1
[18:41:27][C][wifi:318]:   DNS1: 192.168.20.1
[18:41:27][C][wifi:319]:   DNS2: (IP unset)
[18:41:27][C][uart_esp8266:075]: UART Bus:
[18:41:27][C][uart_esp8266:077]:   TX Pin: GPIO1
[18:41:27][C][uart_esp8266:080]:   RX Pin: GPIO3
[18:41:27][C][uart_esp8266:081]:   RX Buffer Size: 256
[18:41:27][C][uart_esp8266:083]:   Baud Rate: 9600 baud
[18:41:27][C][uart_esp8266:084]:   Data Bits: 8
[18:41:27][C][uart_esp8266:085]:   Parity: NONE
[18:41:27][C][uart_esp8266:086]:   Stop bits: 1
[18:41:27][C][uart_esp8266:088]:   Using hardware serial interface.
[18:41:27][C][logger:185]: Logger:
[18:41:27][C][logger:186]:   Level: DEBUG
[18:41:27][C][logger:187]:   Log Baud Rate: 0
[18:41:27][C][logger:188]:   Hardware UART: UART0
[18:41:27][C][light:178]: Light 'Dimmer'
[18:41:27][C][light:180]:   Default Transition Length: 0.0s
[18:41:27][C][light:181]:   Gamma Correct: 1.00
[18:41:27][C][tuya.light:027]: Tuya Dimmer:
[18:41:27][C][tuya.light:029]:    Dimmer has datapoint ID 2
[18:41:27][C][tuya.light:031]:    Switch has datapoint ID 1
[18:41:27][C][captive_portal:169]: Captive Portal:
[18:41:27][C][ota:029]: Over-The-Air Updates:
[18:41:27][C][ota:030]:   Address: living_room_ceiling_lights.local:8266
[18:41:27][C][api:095]: API Server:
[18:41:27][C][api:096]:   Address: living_room_ceiling_lights.local:6053
[18:41:27][C][tuya:023]: Tuya:
[18:41:27][C][tuya:034]:   Datapoint 2: int value (value: 0)
[18:41:27][C][tuya:032]:   Datapoint 1: switch (value: OFF)
[18:41:27][C][tuya:046]:   Product: '{"p":"tebc75erlgslgpn5","v":"1.0.8","m":1}'

If lights are on

INFO Reading configuration /config/esphome/light_switch_kitchen_wine.yaml...
INFO Starting log output from light_switch_kitchen_wine.local using esphome API
INFO Connecting to light_switch_kitchen_wine.local:6053 (192.168.20.37)
INFO Successfully connected to light_switch_kitchen_wine.local
[18:42:07][I][app:105]: ESPHome version 1.15.3 compiled on Jan 17 2021, 18:26:47
[18:42:07][C][wifi:443]: WiFi:
[18:42:07][C][wifi:303]:   SSID: 'IoT'[redacted]
[18:42:07][C][wifi:304]:   IP Address: 192.168.20.37
[18:42:07][C][wifi:306]:   BSSID: FC:EC:DA:F4:3E:AE[redacted]
[18:42:07][C][wifi:307]:   Hostname: 'light_switch_kitchen_wine'
[18:42:07][C][wifi:311]:   Signal strength: -68 dB ▂▄▆█
[18:42:07][C][wifi:315]:   Channel: 11
[18:42:07][C][wifi:316]:   Subnet: 255.255.255.0
[18:42:07][C][wifi:317]:   Gateway: 192.168.20.1
[18:42:07][C][wifi:318]:   DNS1: 192.168.20.1
[18:42:07][C][wifi:319]:   DNS2: (IP unset)
[18:42:07][C][uart_esp8266:075]: UART Bus:
[18:42:07][C][uart_esp8266:077]:   TX Pin: GPIO1
[18:42:07][C][uart_esp8266:080]:   RX Pin: GPIO3
[18:42:07][C][uart_esp8266:081]:   RX Buffer Size: 256
[18:42:07][C][uart_esp8266:083]:   Baud Rate: 9600 baud
[18:42:07][C][uart_esp8266:084]:   Data Bits: 8
[18:42:07][C][uart_esp8266:085]:   Parity: NONE
[18:42:07][C][uart_esp8266:086]:   Stop bits: 1
[18:42:07][C][uart_esp8266:088]:   Using hardware serial interface.
[18:42:07][C][logger:185]: Logger:
[18:42:07][C][logger:186]:   Level: DEBUG
[18:42:07][C][logger:187]:   Log Baud Rate: 0
[18:42:07][C][logger:188]:   Hardware UART: UART0
[18:42:07][C][light:178]: Light 'Dimmer'
[18:42:07][C][light:180]:   Default Transition Length: 0.0s
[18:42:07][C][light:181]:   Gamma Correct: 1.00
[18:42:07][C][tuya.light:027]: Tuya Dimmer:
[18:42:07][C][tuya.light:029]:    Dimmer has datapoint ID 3
[18:42:07][C][tuya.light:031]:    Switch has datapoint ID 1
[18:42:07][C][captive_portal:169]: Captive Portal:
[18:42:07][C][web_server:131]: Web Server:
[18:42:07][C][web_server:132]:   Address: light_switch_kitchen_wine.local:80
[18:42:07][C][ota:029]: Over-The-Air Updates:
[18:42:07][C][ota:030]:   Address: light_switch_kitchen_wine.local:8266
[18:42:07][C][api:095]: API Server:
[18:42:07][C][api:096]:   Address: light_switch_kitchen_wine.local:6053
[18:42:07][C][tuya:023]: Tuya:
[18:42:07][C][tuya:026]:   Configuration will be reported when setup is complete. Current init_state: 1
[18:42:07][C][tuya:027]:   If no further output is received, confirm that this is a supported Tuya device.

This looks odd, are one of these working and the other not? You logs are from two different devices.

[18:41:27][C][tuya.light:029]: Dimmer has datapoint ID 2
[18:42:07][C][tuya.light:029]: Dimmer has datapoint ID 3

Andy

It is 2 different devices but all 3 dimmers output the same error. If I pull logs while they are off the dimmer level can be read and shows zero. If I pull the log with any of them on it gives that same error.