-
Notifications
You must be signed in to change notification settings - Fork 636
Hardware TUYA in line dimmer
Property | Value |
---|---|
Manufacturer | TUYA |
Product page | |
Additional info | https://tasmota.github.io/docs/TuyaMCU-Devices/#dm_wf_mdv4-leading-edge-dimmer |
Build flag | TUYA_GENERIC_DIMMER |
110-240VAC in-line leading edge dimmer with maximum load of 300W. Board is marked up as: DM_WF_MDV4 Leading edge dimmer. Original testing is detailed in post #1729. The WiFi control side is done using a TYWE3S but the dimmer control is via a STM8S003F3 MCU under the board rather than PWM from a GPIO. The external button connects to the MCU rather than the TYWE3S.
The LED is a dual colour, RED/GREEN. The green is controlled via GPIO 14 but the red seems to be controlled by the output, possibly directly from the MCU.
GPIO | Usage |
---|---|
0 | Can be modified for local control. See 'Mods' below. |
14 | Green LED |
4 pins can be soldered to the header holes to allow flashing, but the Tx/Rx need to be connected directly to the TYWE3S pins.
To flash, the fourth pin 'Flash' needs to be held at GND before power is applied, and kept at GND during flashing. I think it disables Tx/Rx communication to the MCU. You then need to boot with the GPIO 0 pin held to GND, then released a few seconds after boot.
With reference to #2422 the built-in hardware button can be re-configured to allow local ON/OFF and dimming. By cutting the track on the back and connecting a wire from the switch to GPIO0
on the TYWE3S, you'll be able to use the hardware button. You either use it to "GND during boot" to allow flashing with the TX/RX pins or control the device during normal operation. Using the build definition below, a 3-10 second long press will toggle the output, double click will dim and triple click will brighten. I disabled click
and press
so it didn't accidentally toggle ON/OFF during a double/triple click event.
// Buttons
#define BUTTON_MQTT_SEND_ALL_EVENTS 1
#define BUTTON1_PIN 0 //USE GPIO0 for push button
#define BUTTON1_CONFIG BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_BOOT
#define BUTTON1_RELAY 1
#define BUTTON1_PRESS BUTTON_ACTION_NONE
#define BUTTON1_CLICK BUTTON_ACTION_NONE
#define BUTTON1_DBLCLICK BUTTON_ACTION_DIM_DOWN
#define BUTTON1_TRIPLECLICK BUTTON_ACTION_DIM_UP
#define BUTTON1_LNGCLICK BUTTON_ACTION_TOGGLE
#define BUTTON1_LNGLNGCLICK BUTTON_ACTION_TOGGLE
I have not been able to get any of the other GPIOs on the TYWE3S to work as input GPIOs. They may need external pull-up resistors to help?
If you're looking for support:
- Issues: this is the most dynamic channel at the moment, you might find an answer to your question by searching open or closed issues.
- Wiki pages: might not be as up-to-date as we all would like (hey, you can also contribute in the documentation!).
- Gitter channel: you have better chances to get fast answers from project contributors or other ESPurna users. (also available with any Matrix client!)
- Issue a question: as a last resort, you can open new question issue on GitHub. Just remember: the more info you provide the more chances you'll have to get an accurate answer.
- Backup the stock firmware
- Flash a pre-built binary image
- Flash a virgin Itead Sonoff device without opening
- Flash TUYA-based device without opening
- Flash Shelly device without opening
- Using PlatformIO
- from Visual Studio Code
- Using Arduino IDE
- Build the Web Interface
- Over-the-air updates
- Two-step updates
- ESPurna OTA Manager
- NoFUSS
- Troubleshooting
- MQTT
- REST API
- Domoticz
- Home Assistant
- InfluxDB
- Prometheus metrics
- Thingspeak
- Alexa
- Google Home
- Architecture
- 3rd Party Plugins
- Coding style
- Pull Requests