logo elektroda
logo elektroda
X
logo elektroda

OpenBeken (OpenECR) Configuration for Tuya Dimmer: GPIO, Templates, MQTT, Home Assistant

User question

howto configure openecr flashed tuya dimmer

Artificial Intelligence Response

Direct answer to the question

• Most Tuya dimmers that you re-flashed with the community firmware are really running OpenBeken (OBK), not “OpenECR”.
• Configuration is done from the built-in Web UI:

  1. Connect to the device’s temporary Wi-Fi AP, supply your own SSID/password.
  2. Either import a ready-made template for your exact model or manually assign the GPIO roles (PWM, button, status LED, etc.).
  3. Fine-tune dimmer parameters (PWM frequency, minimum/maximum brightness, fade rate).
  4. Optional: enable MQTT or Home-Assistant discovery.
    • If your dimmer is a “Tuya-MCU” type (a BK7231 only drives a UART that talks to a triac board) you must start the TuyaMCU driver and map datapoints instead of GPIOs.

Key points
– Identify the hardware category (direct-PWM vs. Tuya-MCU).
– Use the OBK WebUI → Configure Module (GPIO) or TuyaMCU (DP mapping).
– Save calibration commands (DimmerMin, DimmerMax, PWM_Frequency).
– Test on real load, then integrate with your automation platform.


Detailed problem analysis

  1. Firmware nomenclature
    • “OpenECR” appears in some early forks/blogs, but the active, maintained project is OpenBeken (OBK) hosted at https://github.com/openshwprojects/BK7231GUIFlashTool.
    • All current binaries show “OpenBK7231” in the banner; UI and commands are the same regardless of the older name.

  2. First-boot network set-up (common to every device)
    a) Power the dimmer; it boots as AP OBK-<chipMAC> (or OpenBK-...).
    b) Connect with phone/laptop, browse to 192.168.4.1.
    c) Fill “WiFi SSID / KEY”, press Save. Device reboots onto your LAN.
    d) Note the new IP address from your DHCP table or mDNS (obk-xxxx.local).

  3. Two possible hardware architectures

    A. Direct-PWM dimmer (BK7231 drives the triac/MOSFET directly)
    – You will see the lamp flicker briefly when you guess the correct GPIO.
    – Configuration path: Config ▸ Configure Module.

    B. Tuya-MCU dimmer (separate BK7231 ↔ TLSR8258 or Nuvoton triac board)
    – Light never reacts when you change GPIO because real control is via UART.
    – Configuration path: Config ▸ Configure Drivers, start driver TuyaMCU, then map datapoints under Config ▸ TuyaMCU.

  4. Direct-PWM configuration workflow

    Step A – Apply known template (fastest, safest)
    • Open the community list https://openbekeni.github.io/webapp/devicesList.html, search your model (e.g. “QS-WIFI-D01”, “Kesen KS-602”).
    • Copy the JSON, WebUI ▸ Import OBK Settings, paste, press Apply.

    Step B – Manual GPIO discovery (if no template)

    Task Typical role Notes
    Lamp dimming PWM or PWM_n Channel 1
    On/Off push button Btn_Tgl Channel 1, debounced automatically
    Status LED LED_n or WifiLED_n Channel 1 or Wi-Fi
    Zero-cross / triac gate (phase-cut boards) PWM + StartDriver BL0937 only if present

    Procedure:
    • Set a GPIO to PWM, channel 1, Submit, return to main page. If the brightness slider appears and light responds ⇒ keep it. Otherwise reset pin and try next.
    • Repeat to find button (Btn_Tgl) and LED.

  5. Calibrating dimmer behaviour

    Open Web Application ▸ Console and issue:

    DimmerMin 8 # won’t try to drive lamp below 8 %
    DimmerMax 95 # keeps headroom to avoid buzzing at 100 %
    PWM_Frequency 1000 # Hz – experiment 600-4000
    FadeTime 500 # ms between levels (optional)
    save

    Put the same commands in Config ▸ General ▸ Startup command with backlog to ensure persistence.

  6. Tuya-MCU dimmer workflow

    a) Start driver: startDriver TuyaMCU (Web console).
    b) Set UART pins (usually P10=TX1, P11=RX1) in Configure Module.
    c) Reboot, then check console for DP list:

    TuyaMCU: dpId 1 bool val:1 # power
    TuyaMCU: dpId 2 int val:157 # brightness 0-255 or 10-1000 

    d) Map them: TuyaMCU_SetChannelType 1 1 (1=bool), TuyaMCU_SetChannelType 2 2 (2=int).
    e) Use command TuyaMCU_ChangeChannel 1 1 to bind channel 1 (power) and 2 1 to brightness.
    OBK will now expose a standard dimmer entity.

  7. Home-Assistant / MQTT integration

    – MQTT: Config ▸ MQTT, fill broker host, user, password, press Save.
    – Publish: startDriver HADiscovery once; the device announces itself automatically.
    – Native Home-Assistant (no MQTT) is coming in OBK 1.18+, but as of 2024-Q1 MQTT remains the stable path.

  8. Safety, legal, ethical

    • Dimmer works at mains potential—open enclosure only when isolated, use 1 kV-rated probes if measuring.
    • Flashing & third-party firmware voids manufacturer’s warranty and may violate regional radio approvals; deploy at your own risk.
    • Ensure lamps are compatible with leading-edge/triac or PWM dimming; wrong load can overheat or flicker.


Current information and trends

• OpenBeken 1.17 (Feb 2024) added GUI “pin tester” and WebOTA from GitHub CI – no need for USB-UART after first flash.
• Community now maintains Device Cloud, allowing the firmware to auto-download templates by model ID.
• Upcoming 1.19 roadmap: Matter-bridge driver and direct ESP-Home API compatibility.


Supporting explanations and details

Example manual configuration (common BK7231N board “QS-WIFI-D01”):

P6 → LED_n (ch 1) # blue indicator
P9 → Btn_Tgl (ch 1) # front button
P24 → PWM (ch 1) # MOSFET gate

After assigning, the main page will show:

• On/Off toggle
• Brightness slider (0-100 %)
• Real-time power reading if BL0937 driver present

Hold the button >2 s to dim continuously: enable with SetOption32 20.


Ethical and legal aspects

• Open-source firmware promotes right-to-repair and local-only control (no forced cloud).
• Always respect RF spectrum rules—OBK keeps original Wi-Fi 2.4 GHz parameters, so compliance usually unchanged.
• When reselling modified devices, provide licensing notice (OBK is GPL-2.0).


Practical guidelines – checklist

  1. Flash → verify serial log shows OpenBeken banner.
  2. Join AP, give Wi-Fi creds, record IP.
  3. Look for template; if not found, do manual GPIO/DP mapping.
  4. Set DimmerMin/Max, PWM_Frequency, FadeTime.
  5. Integrate with MQTT or HA-Discovery.
  6. Heat-run for 30 min at full load; check case stays < 60 °C.
  7. Export JSON backup (Backup Settings) for quick recovery.

Typical pitfalls & fixes
• No light response → wrong hardware type; try TuyaMCU driver.
• Lamp only turns on above 40 % → raise DimmerMin.
• Audible buzz → increase PWM_Frequency or lower Max.
• Device bricks after pin change → you assigned UART pins; re-flash via 3V3-UART.


Possible disclaimers or additional notes

• Phase-cut dimmers with non-isolated triac require RC snubber; OBK cannot fix LED bulb flicker due to driver topology.
• Firmware still experimental on BK7231U (PSRAM variant) – GPIO numbering differs.
• OTA upgrade from very early “OpenECR v0.5” may fail; perform serial re-flash once.


Suggestions for further research

• Follow #OpenBeken on GitHub for new device templates.
• Study AN-1025 (ON-Semi) for in-depth triac dimming physics.
• Evaluate Matter-bridge branch if you plan future-proof smart-home migrations.
• Consider energy-monitor add-on (HLW8032 driver) for combined dimmer + power metering projects.


Brief summary

Configuring an “OpenECR”-flashed Tuya dimmer is, in practice, an OpenBeken Web-UI job: join its AP, load or create a template, calibrate dimming commands, and integrate via MQTT/Home-Assistant. Identify whether the board is direct-PWM or Tuya-MCU, then use the corresponding GPIO or Datapoint workflow. Fine-tune DimmerMin/Max and PWM frequency for flicker-free results, observe mains-safety rules, and back-up your settings. With these steps you will have a fully local, cloud-free smart dimmer ready for daily use or further automation experiments.

Ask additional question

Wait...(2min)
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.