Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamhowto configure openecr tuya dimmer
• “OpenECR” configuration is done from the device’s embedded Web Console (port 80) after you have flashed the Tuya dimmer with an OpenECR/OpenBeken image.
• Minimum sequence (replace the datapoint-IDs with those of your dimmer):
startDriver TuyaMCU # activates serial link to Tuya-MCU
setChannelType 1 toggle # ch-1 = main ON/OFF
setChannelType 2 dimmer # ch-2 = brightness
tuyaMcu_setDimmerRange 0 1000 # map MCU range 0-1000 → 0-100 %
linkTuyaMCUOutputToChannel 1 bool 1 # dpID 1 ↔ ch-1
linkTuyaMCUOutputToChannel 2 val 2 # dpID 2 ↔ ch-2
save # store to flash
reboot
• Put the above lines in autoexec.bat (Config ▶ Files) or in “Change startup command” so they re-execute on every power-up.
• Verify operation on the Dashboard, then (optionally) add MQTT parameters for Home-Assistant or any broker.
What exactly is “OpenECR”?
• In the Tuya ecosystem, most 2021-2024 Wi-Fi dimmers no longer use ESP8266 but Beken BK7231T/N SoCs.
• The actively-maintained open-source firmware for those chips is OpenBeken (OpenBK).
• “OpenECR” is a community fork aimed at the rarer ECR6600/ESWIN parts; the CLI, Web UI and command set are intentionally kept identical to OpenBeken.
=> The configuration procedure below is valid for both names; only the binary you flash differs.
Prerequisites
• Dimmer already flashed with OpenBeken/OpenECR (OTA via Tuya-Cloud-Cutter or wired using bkwriter/bflash).
• First-boot Wi-Fi wizard finished – the module has an IP on your LAN (check DHCP table).
• Safety: device is still on the bench powered from an isolated 230 V/110 V supply or test lead; mains work requires competence and insulation.
Understanding the Tuya architecture
• The BK7231 runs your open firmware.
• A secondary microcontroller (Tuya-MCU, usually an Nuvoton 8-bit or Holtek 32-bit) drives the TRIAC/MOSFET and measures zero-crossings.
• Communication between them is a 9600 baud UART with proprietary packets. Each function is a “Datapoint” (dpID).
Typical dimmer:
dpID 1 → switch (dpType bool)
dpID 2 → brightness (dpType value, 0-1000)
dpID 3 → optional power metering or fade-time
Discovering your dpIDs
a) In the Web Console set verbose log:
tuyaMcuCfgMode 2 # enables raw UART log
b) Toggle the wall button and move the front-panel slider; the console shows frames like
TuyaMCU: { "datapoint":2, "value":375 }
Note the numbers that change – those are your dpIDs.
Mapping dpIDs to OpenECR channels
OpenECR’s internal objects are called channels. You must:
• tell the firmware what type every channel is (setChannelType)
• link external dpIDs to those channels (linkTuyaMCUOutputToChannel)
Example with dpID 1 (switch) and dpID 2 (dimmer):
setChannelType 1 toggle # bool on/off
setChannelType 2 dimmer # 0-100 % (internally 0-255)
linkTuyaMCUOutputToChannel 1 bool 1
linkTuyaMCUOutputToChannel 2 val 2
Define dimmer range and curve
Tuya MCUs often use 0-1000; some older ones use 0-255. Check min/max values captured earlier then:
tuyaMcu_setDimmerRange 0 1000 # adjust if yours differs
Optional: logarithmic curve for LED-friendly perception:
setOption DimmerCurve 1 # 0=linear,1=log
Persist settings
Either upload a small autoexec.bat file containing all commands or set
startUpCommand autoexec.bat. Press Save & Reboot.
MQTT / Home-Assistant integration (optional)
Open Web ▶ Config ▶ MQTT
• Broker IP / user / pass
• “Client Topic” unique per device, e.g. dimmer/stairs
After restart Home-Assistant’s MQTT auto-discovery will present:
• dimmer/stairs/1 – switch
• dimmer/stairs/2 – brightness
If you prefer manual YAML, a minimal configuration is:
mqtt:
light:
- name: "Stairway Dimmer"
unique_id: stair_dimmer
command_topic: "dimmer/stairs/1/set"
state_topic: "dimmer/stairs/1/get"
brightness_command_topic: "dimmer/stairs/2/set"
brightness_state_topic: "dimmer/stairs/2/get"
brightness_scale: 1000 # must match tuyaMcu_setDimmerRange
Channel2 set to 745 etc.10 1000.• 2023-2024: majority of “Tuya Wi-Fi” lighting products have moved to BK7231T; ESP8266 versions are rare.
• Active OTA exploit project Tuya-Cloud-Cutter supports many dimmers and can flash OpenBeken without opening the casing.
• An experimental OpenECR6600 fork targets LSC/Action dimmers using ESWIN-ECR chips – progress is public on Elektroda and Discord channels.
• Matter-over-Wi-Fi integration is being prototyped inside OpenBeken (branch matter-beta). Expect native Matter light device in future releases.
Why channel abstraction?
OpenECR inherits from OpenBK’s HA-like philosophy: internal channels are agnostic of the transport (MQTT, HTTP, Web UI). Linking dpIDs decouples Tuya specifics from automation layers.
| Command cheat-sheet: | Task | Command | Comment |
|---|---|---|---|
| Dump MCU state | tuyaMcu_dump |
one-time table | |
| Enable raw log | tuyaMcuCfgMode 2 |
verbose UART sniff | |
| Disable log | tuyaMcuCfgMode 0 |
normal | |
| View / edit autoexec | Files ▶ editor | persists cfg | |
| Factory reset | reset 2 |
keeps Wi-Fi if reset 1 |
Analogy – think of Tuya-MCU as a sound mixer: it owns the faders; OpenECR is the front-panel that just tells the mixer “channel 2 to 37 %”.
• Firmware replacement voids CE/FCC conformity and manufacturer warranty.
• Dimmer operates at lethal voltages; any internal flashing or probing must follow IEC 61557 isolation standards.
• Radio emissions must stay within 2.4 GHz limits (EN 300 328). Ensure Wi-Fi TX power is not forced beyond region’s EIRP cap.
Implementation best-practices:
• Keep a backup of the original Tuya firmware with bflash r 0x0 0x100000 original.bin.
• After every configuration milestone issue backupConfig (creates config *.bak).
• Use resistive dummy load (60 W incandescent) while first testing dimming – many LED lamps flicker at unsupported phase angles.
Potential challenges & fixes:
• “ON/OFF works, dimming does nothing” → wrong dpID or dimmer range.
• “Device reboots when dimming fast” → UART overflow, increase baud with tuyaMcu_setBaud 115200 (only if MCU supports).
• Not all Tuya dimmers expose brightness over UART (some use PWM directly from BK7231 → treat like a fan speed controller). In that case configure PWM1 instead of Tuya-MCU driver.
• Early OpenECR builds < 1.13 had a bug where linkTuyaMCUOutputToChannel was not stored – upgrade to ≥ 1.14.230 and re-apply.
• Cloud features (OTA via Tuya app) are lost; plan a manual fallback procedure.
• Investigate Zero-Cross adaptive algorithms to mitigate LED flicker – OpenBeken’s roadmap item.
• Contribute dpID templates to the public “Beken-Devices” repository to ease other users’ setup.
• Explore OpenBK-Matter branch for future proof, cloud-independent commissioning.
Resources:
• Docs: https://openbekeniot.github.io/OpenBK7231T
• Community: https://discord.gg/83JvHFmU6C (channel #bk-light)
• Tuya-Cloud-Cutter device list: https://github.com/tuya-cloudcutter/tuya-cloudcutter
Configuring a Tuya dimmer under OpenECR/OpenBeken consists of:
autoexec.bat, restarting, and optionally enabling MQTT for smart-home integration. By following the outlined commands and validation steps you obtain fully local, cloud-free control with precise dimming and future extensibility.