-
Notifications
You must be signed in to change notification settings - Fork 289
Wiki Home
OpenBK7231T/OpenBeken is a Tasmota/Esphome replacement for new Tuya modules featuring MQTT and Home Assistant compatibility. This repository is named "OpenBK7231T_App", but now it's a multiplatform app, supporting build for multiple separate chips:
- BK7231T (WB3S, WB2S, WB2L, etc)
- BK7231N (CB2S, CB2L, WB2L_M1, etc)
- T34 (T34 is based on BK7231N)
- XR809 (XR3, etc)
- BL602
- W800 (W800-C400, WinnerMicro WiFi & Bluetooth), W801
Please use automatically compiled binaries from the Releases tab. To build yourself for a given platform, just checkout first our version of SDK and then checkout this app repository into it, details later.
OpenBeken features:
- Tasmota-like setup, configuration and experience on all supported platforms
- OTA firwmare upgrade system (for Beken chips); to use OTA, drag and drop RBL file (always RBL file) on OTA field on new Web App Javascript Console
- MQTT compatibility with Home Assistant
- Support for multiple relays, buttons, leds, inputs and PWMs
- Driver system for custom peripherals, including TuyaMCU, I2C bus and BL0942, BL0937 power metering chips
- Supports multiple I2C devices, like TC74 temperature sensor, MCP23017 port expander, PCF8574T LCD 2x16 (or other?), etc
- NTP time from network (can be used with TH06 and other TuyaMCU devices)
- RGBCW LED lighting control compatible with Home Assistant (both PWM LEDs and SM2135 LEDs)
- LittleFS integration for large files (resides in OTA memory, so you have to backup it every time you OTA)
- Command line system for starting and configuring drivers
- Short startup command (up to 512 characters) storage in flash config, so you can easily init your drivers (eg. BL0942) without LittleFS
- Simple scripting and events system (allows you to mirror Tasmota rules, for example catch button click, double click, hold)
- Automatic reconnect when WiFi network goes out
- and much more
- can't find what you are looking for? feel free to contribute and develop the feature yourself
For Info see BK7231T
For Info see BK7231N
For Info see XR809
Follow the BL602 guide: https://www.elektroda.com/rtvforum/topic3889041.html
For Info see W100/W101
It is also possible to build a part of our App for Windows platform. It basically creates a Windows .exe for our HTTP server, so developers can create our configurator, etc, pages faster, without having any Tuya modules at hand. For building on Windows, use MSVC projects in the app directory. It is using Winsock and creates a TCP listening socket on port 80, so make sure your machine has it free to use.
You can set pin roles in "Configure Module" section or use one of predefined templates from "Quick config" subpage. For each pin, you also set coresponding channel value. This is needed for modules with multiple relays. If you have 3 relays and 3 buttons, you need to use channel values like 1, 2, and 3. Just enter '1' in the text field, etc. Currently available pin roles:
- Button
- Button_n (as Button but pin logical value is inversed)
- Relay
- Relay_n (as Relay but pin logical value is inversed)
- LED
- LED_n (as Led but pin logical value is inversed)
- Button Toggle All - this button toggles all channels at once
- Button Toggle All_n (as above but pin logical value is inversed)
- PWM - pulse width modulation output for LED dimmers (with MQTT dimming support from Home Assistant)
- WiFi LED - special LED to indicate WLan connection state. LED states are following: LED on = client mode successfully connected to your Router. Half a second blink - connecting to your router, please wait (or connection problem). Fast blink (200ms) - open access point mode. In safe mode (after failed boots), LED might not work.
- DigitalInput - this is a simple digital input pin, it sets the linked channel to current logical value on it, just like digitalRead( ) from Arduino. This input has a internal pull up resistor.
- DigitalInput_n (as above but inversed)
- ToggleChannelOnToggle - this pin will toggle target channel when a value on this pin changes (with debouncing). you can connect simple two position switch here and swapping the switch will toggle target channel relay on or off
- DigitalInput_NoPullUp - same as DigitalInput but with no programmable pull up resistor. This is used for, for example, XR809 water sensor and door sensor.
- DigitalInput_NoPullUp_n (as above but inversed)
- ADC (Analog to Digital converter) - converts voltage to channel value which is later published by MQTT and also can be used to trigger scriptable events
Device is counting full boots (full boot is a boot after which device worked for 30 seconds). If you power off and on device multiple times, it will enter open access point mode and safe mode (safe mode means even pin systems are not initialized). Those modes are used to recover devices from bad configs and errors.
You can enable a simple TCP server in device Generic/Flags option, which will listen by default on port 100. Server can accept single connection at time from Putty in RAW mode (raw TCP connection) and accepts text commands for OpenBeken console. In future, we may add support for multiple connections at time. Server will close connection if client does nothing for some time.
There are some extra short commands for TCP console:
- GetChannel [index]
- GetReadings - returns voltage, current and power
- ShortName the commands above return a single ASCII string as a reply so it's easy to parse.
RGBCW light bulbs are now supported and they are compatible with HA by rgb_command_template, brightness_value_template, color_temp_value_template commands. Please follow the guide below showing how to flash, setup and pair them with HA by MQTT:
https://www.elektroda.com/rtvforum/topic3880540.html#19938487
Home Assistant and Node Red. Please refer to this example:
https://www.elektroda.com/rtvforum/viewtopic.php?p=20031489#20031489
https://www.elektroda.com/rtvforum/topic3898502.html
Detailed description and step by step tutorial on Elektroda.com is coming soon.
Please refer to this step by step guide: https://www.elektroda.com/rtvforum/topic3887748.html
https://www.elektroda.com/rtvforum/topic3895572.html
There are two ways.
-
Go to Config -> Startup state and set it from GUI here.
-
Use use short startup command from Options or create "autoexec.bat" in LittleFS file system in web panel and execute commands from there.
For example, for RGBCW LED, you can do startup command:
backlog led_dimmer 100; led_basecolor_rgb #FF00FF; led_enableAll 1
For simple relay, in this example on channel number 5, you can do:
backlog SetChannel 5 1
For direct PWM access (for single-color strips etc) you can do:
backlog SetChannel 5 90
I have prepared several detailed teardowns and flashing guides for multiple supported devices. Each comes in two languages - English and Polish.
Outdoor two relays smart switch CCWFIO232PK (BK7231T): https://www.elektroda.com/rtvforum/topic3875654.html https://www.elektroda.pl/rtvforum/viewtopic.php?p=19906670#19906670
Australian Double Power Point DETA 6922HA-Series 2 (BK7231T) (English only) https://community.home-assistant.io/t/detailed-guide-on-how-to-flash-the-new-tuya-beken-chips-with-openbk7231t/437276
Qiachip Smart Switch module (BK7231N/CB2S): https://www.elektroda.com/rtvforum/topic3874289.html https://www.elektroda.pl/rtvforum/viewtopic.php?t=3874289&highlight=
Tuya RGBCW 12W light bulb (raw PWMs, no I2C, BK7231N) https://www.elektroda.com/rtvforum/topic3880540.html#19938487 https://www.elektroda.pl/rtvforum/viewtopic.php?t=3880540&highlight=
LSPA9 CB2S + BL0942 power metering plug: https://www.elektroda.com/rtvforum/topic3887748.html https://www.elektroda.pl/rtvforum/viewtopic.php?t=3887748&highlight=
XR3/XR809 water sensor guide: https://www.elektroda.com/rtvforum/topic3890640.html
https://www.elektroda.pl/rtvforum/viewtopic.php?t=3890640&highlight=
SM2135 LED configuration https://www.elektroda.com/rtvforum/topic3906898.html
https://www.elektroda.pl/rtvforum/viewtopic.php?t=3906898
I had some reports from users saying that they are unable to flash BK7231T with CP2102 but CH340 works. So, maybe try different USB to UART dongle. Some of them might not be reliable enough for flashing.
For technical insights and generic SDK information related to Bekken and XRadio modules, please refer:
https://www.elektroda.com/rtvforum/topic3850712.html
https://www.elektroda.com/rtvforum/topic3866123.html
https://www.elektroda.com/rtvforum/topic3806769.html
If you want to support project, please donate at: https://www.paypal.com/paypalme/openshwprojects
Special thanks for Tasmota/Esphome/etc contributors for making a great reference for implementing Tuya module drivers
Wiki Home Link