Elektroda.com
Elektroda.com
X

Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!

p.kaczmarek2 49611 359
This content has been translated flag-pl » flag-en View the original version here.
  • Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    I will present here my Tasmota replacement designed for the BL602 platform by Bouffalo Lab, offering, among others. the ability to pair our device with Home Assistant via MQTT. I will show here how you can easily upload the batch to the BL602 using a simple USB to UART converter, and I will also describe the SDK compilation process for people who would like to program this platform on their own. In addition, I will present two interesting demos from SDK BL602.

    Why program BL602?
    The motivation is the same as with the platforms I discussed earlier. Own firmware allows you to free the IoT product from the manufacturer's servers, avoid possible loss of control over this product when these servers go down, avoid tracking and collecting data by the manufacturer, and additionally allows you to combine products from different manufacturers into one ecosystem. What I'm creating here is a "Tasmota" for other platforms.

    Used module with BL602
    Modules with BL602 (or related) systems can be purchased at relatively low prices, but the main principle of my operation is "release" of finished IoT products with closed programming of their manufacturers, so I used such a product for this topic.
    It served as a testing ground for me RGB LED strip with IR remote control and WiFi - MWIR-RGB Magic Home Pro .
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    I described the details in the "Device interiors" section:
    https://www.elektroda.pl/rtvforum/topic3881416.html
    On board this driver is BL602 and 3 transistors controlled by PWM:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Connection sketch:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!

    What firmware is this?
    The firmware repository is here:
    https://github.com/openshwprojects/OpenBK7231T_App
    My firmware for BL602 is basically a port of my OpenBeken, actually OpenBeken has been reworked so that it is now a cross-platform application supporting the BK7231T, BK7231N, XR809 and BL602 chips.
    The initiative was launched on these topics:
    WB2S/BK7231 Tutorial - we create our own firmware - UDP/TCP/HTTP/MQTT
    [BK7231T] My HTTP server, configurator, MQTT support with Home Assistant

    For the user - downloading the compiled OpenBL602/OpenBeken batch for BL602
    My Github repository has a script that automatically compiles online binaries for the BK7231N, BK7231T and XR809 platforms, unfortunately BL602 is not yet supported by it.
    For this reason, the batch should be downloaded from the releases_bl602 folder:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/bl602_release
    In the future, this may change and we will download the batch from the "Relases" tab on the right.

    For the user - hardware connection
    You need a USB to UART converter with 3.3V logic levels, a 10k resistor, maybe a 3.3V LDO regulator (as it is not on our board) and wires.
    We connect:
    - RX from the module to TX UART
    - TX from the module to RX UART
    - BOOT from the module to the 10k resistor to the power supply, but we leave it open (we connect it only for programming)
    - weight to weight
    - 3.3V power supply (if there is an LDO on the board, we can give 5V to its input from USB)
    Details here:
    https://www.elektroda.pl/rtvforum/topic3881416.html
    For me it looks like this:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    NOTE: If you connect the 5V power supply from USB to the LDO input (or step down converter) on the BL602 board and then connect the 12V power supply, you will damage at least the USB to UART adapter and maybe also the USB itself ... during programming disconnect the external power.

    For the user - uploading the batch
    In order to upload the batch, we need to:
    1. Connect the BOOT signal to the power supply through a 10k resistor
    2. Disconnect and reconnect power (reboot with BOOT signal up to power)
    3. In BLDevCube.exe, select the following files:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    4. Make sure that the UART port is not in use (e.g. if we do not have it open in RealTerm - if so, we close it)
    5. Click "Download" (which means "send the batch to BL602"):
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Ready!
    Now, to run the batch, we disconnect the BOOT (leave it loose) and disconnect the power for a while, then restore it.
    Device logs will still be available with baud = 2000000 (as in SDK demos).


    For the user - OpenBL602 configuration
    The configuration of my batch port on the BL602 is analogous to the configuration described in these topics:
    - Qiachip Smart Switch - BK7231N/CB2S - interior, programming
    - Garden double relay Tuya CCWFIO232PK - BK7231T - programming
    It is also worth reading the topic:
    Tutorial Home Assistant - configuration, WiFi, MQTT, Zigbee, Tasmota
    After restarting the device, an open Access Point with a name like OpenBL602_1A1B2C3D4E5 should appear:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    We connect to it and open the page with the address 192.168.4.1. We configure it just like Tasmota (we give the directions for our WiFi, we set the roles of pins, we give the directions for MQTT ...
    For this particular RGB LED strip, the roles of the pins are as follows:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    In the current version, my firmware does not support the IR remote that has this bar.

    For the user - pairing with Home Assistant
    There is a "Generate Home Assistant Config" option in the OpenBL602 panel, but it is not always enough. In the case of the RGB controller, this option "doesn't know" that you need to combine three PWMs into one color controller.
    For this reason, I recommend taking only the device name from it, e.g. obl42DACAB0 and inserting it manually into this template:
    Code: yaml
    Log in, to see the code

    We save it in configuration.yaml. If we have several lights, we put the light prefix with a colon once.
    After restarting Home Assistant, we can control the bar:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working! Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working! Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working! Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    The current version has a drawback - after restarting Home Assistant does not read the current value of brightness and color. This will be replenished, but it does not affect the control of this bar.

    For the programmer - MSys2 installation
    You do not need to compile the firmware yourself, because I provide ready-made binary files. But if you want to modify my code yourself, you'll still need to learn how to compile. You will need MSys2 to compile the firmware. It must be downloaded and installed from here:
    https://www.msys2.org/#installation
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Windows may be blocking MSys - proceed anyway.
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    We select the installation directory:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    After installation, run msys2. It still needs to be updated.
    We execute the command:
    pacman -Syu
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Then also pacman-Su
    Then pacman -S make
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!

    For the developer - download the SDK and compile the project
    Unfortunately, this is where things get complicated. The official SDK is here:
    https://github.com/pine64/bl_iot_sdk
    As of today (April 2022), however, the latest version of the SDK from Github does not compile correctly, you should use the older version, more precisely b3898a520d6e5a34a5f4de8241fcc1c1d3b071b9.
    People other than me are also having problems with compiling the latest version:
    https://github.com/pine64/bl_iot_sdk/issues/94
    NOTE: If you are downloading the SDK with the intention of using it to build my project, please download my modified version from here:
    https://github.com/openshwprojects/OpenBL602
    This is because the main OpenBK (or OpenBL) application, called App, is shared between various SDKs of different platforms, and these SDKs themselves contain the basis of projects in which these main Apps are compiled.
    Projects in the SDK are located in the customer_app folder:
    Here is their list:
    
    benchmark_security_aes
    bl602_boot2
    bl602_boot2_mini
    bl602_demo_event
    bl602_demo_joylink
    bl602_demo_nano
    bl602_demo_noconnectivity
    bl602_demo_wifi
    bl602_huawei_cloud
    sdk_app_audio_udp
    sdk_app_ble_sync
    sdk_app_blog
    sdk_app_cli
    sdk_app_cronalarm
    sdk_app_dac
    sdk_app_easyflash
    sdk_app_event
    sdk_app_fdt
    sdk_app_gpio
    sdk_app_hbnram
    sdk_app_heap
    sdk_app_helloworld
    sdk_app_http_client_socket
    sdk_app_http_client_tcp
    sdk_app_i2c
    sdk_app_ir
    sdk_app_mdns
    sdk_app_pwm
    sdk_app_romfs
    sdk_app_spi_pdm
    sdk_app_spi_wave
    sdk_app_timer
    sdk_app_uart_ctl
    sdk_app_uart_echo
    

    Compilation comes down to going to the folder of a given project and calling ./genromap
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    You still need to call:
    - export BL60X_SDK_PATH=~/your_path_to_Sdk/
    - export CONFIG_CHIP_NAME=BL602
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    But in my experience, it is usually not needed and the script itself finds the path by assuming that the SDK is two directories higher than the project being built. In turn, CONFIG_CHIP_NAME is required if we want to execute the "clean" command of the project to remove intermediate .o files generated by the compiler, which are then linked by the linker.
    The generated files are in the build_out folder, for example: customer_app\bl602_sharedApp\build_out


    For developer - Demko sdk_app_gpio
    Now that we can compile on our own, it's time to test the functionality demos provided by the developers of the SDK.
    One of the most interesting demos is sdk_app_gpio.
    The sdk_app_gpio demo allows you to configure GPIO pins from the UART console. The command syntax is "gpio-func ".
    For example, the command:
    gpio-func 8 0 0 0
    

    configures GPIO pin 8 as an output without pull up/down resistors.
    The baud of a demo is 2,000,000.
    This is what the demo looks like when launched:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    After sending the pin control command:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Then you can set this pin low or high with:
    
    gpio-set  
    

    In the case of the input pins, we have an analogous UART gpio-get command:
    
    gpio-get 
    

    For the curious - the implementation of gpio-func looks like this:
    Code: c
    Log in, to see the code

    In turn, setting the pin:
    Code: c
    Log in, to see the code

    Retrieving its status:
    Code: c
    Log in, to see the code


    For the developer - Demko bl602_demo_wifi
    Another interesting demo from the SDK is a program showing the operation of WiFi. Here we also control it through UART commands. Baud as before.
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    To begin with, it is worth getting to know the entire list of commands through the quite obvious help command:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Let's try wifi_ap_start:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    wifi_scan also works. We have the entire code of this demo so we can see what and how it is implemented.

    Summary
    Another platform released! I started with release XR809 , then I took care of BK7231T and BK7231N . Now BL602 has been released. Next in line are the Realtek and W600 systems, but will it work with them too? We'll see.
    In the queue for programming, I still have a bulb with BL602, but I don't think there will be any problems with it - on the board with the Wi-Fi module, pads are required, i.e. RX, TX and BOOT. I will put the description in the "device interiors" section.
    As for the stability of the current version of the firmware for BL602, I tested it for two days, including deliberately turning off the router (checking if it catches the disconnect event and reconnecting) and I did not encounter any problems, but of course I will continue to test and fix any problems on an ongoing basis.
    For details about the project, please visit its official repo:
    https://github.com/openshwprojects/OpenBK7231T_App
    PS: If you know any IoT or similar devices based on BL602 or a related system, let me know - I am constantly adding support for new functionalities to the firmware and collecting information on how it works. From what I know, the Sonoff 40, for example, probably uses the BL602.

    Cool? Ranking DIY
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 5843 posts with rating 5827, helped 279 times. Been with us since 2014 year.
  • #2
    khoam
    Level 42  
    p.kaczmarek2 wrote:
    As far as I know, the more popular ones are for example Sonoff 40 I think it is using BL602.

    Can you provide some link to describe this Sonoff model? I can't find.
  • #3
    p.kaczmarek2
    Moderator Smart Home
    https://itead.cc/product/sonoff-iplug-series-wi-fi-smart-plug-s40-s40-lite/
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Minir3 też:
    https://notenoughtech.com/home-automation-review/sonoff-minir3/
    Quote:

    Unlike other Sonoff devices, Sonoff MINIR3 is not ESP based. At heart, we can find BL602/BL604 RISC-V WiFi & Bluetooth 5.0 LE SoC. A move to RISK-V is an interesting jump as the replacement for ESP8266 with a similar price point and better specification.

    It also means that anyone hoping to flash is, can’t rely on the usual toolchain used for ESP based devices. I have no doubt that thanks to RISK-V’s “opensourceness”, we will see appropriate tools to handle that, but if you are hoping to get one now with the intention of tasmotising it – you will be disappointed.
  • #4
    zgierzman
    Level 31  
    Beautiful. I follow my colleague @ p.kaczmarek2's posts and I am very impressed. Integrating the products of various Chinese manufacturers in one proprietary environment requires a lot of commitment.
    But please, somebody explain to me, what is the practical value of controlling a light bulb in a toilet via the Internet?

    I understand the control of security systems - burglary or fire, but the ability to change the color of the lighting?

    You can change the color of the lighting or turn off the lamp without moving from the couch. But choosing the right application, clicking through the options, and selecting a preset can take many times longer than clicking a physical button.
    For people with disabilities, bedridden, this is the only option, but for a theoretically able-bodied user?
    Spend 45 seconds dim the lights on your cell phone or move four letters off the couch and do it in 15 seconds?
    Well, unless for someone such an effort and burning 10 kcal, it is already beyond strength ...
  • #5
    p.kaczmarek2
    Moderator Smart Home
    @zgierzman you asked an interesting question, because paradoxically I was not a Smart Home user until I started firwmare, and now I have specially plugged Beken products just to test them, not because I use them in practice, but I will try to answer anyway.

    I know from the target users of the software (especially those who support the project, e.g. by sending products for testing) about:
    - automation (both automatic extinguishing after time / or inactivity, or extinguishing everything, or switching on the light at a given time)
    - work in groups (if they have several smart lights in a larger corridor, also often dimmable, they combine them into groups and their states are synchronized)
    - animations (there is a special protocol for this, where each RGB bulb has its ID and their color is set via UDP), for example: https://www.youtube.com/watch?v=d0ow9qJT8Ak&ab_channel=KaufmanHomeAutomation
  • #6
    _Minims_
    Level 6  
    Hello,

    Thanks for this how to on BL602.
    I will try to use it on my MagicHome CCT : ZJ-BWCE-CCT v1.1

    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working! Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!

    This device has a bluetooth remote possibility but I don't use it.


    How can I find the GPIO to setup for this kind of device ?

    Thanks ! :-)
  • #7
    p.kaczmarek2
    Moderator Smart Home
    Well, you can test each pin with multimeter, or even, without multimeter, with a high quality photo of both sides of PCB you can easily track where each pin is connected.
    Have you looked into BL602 pinout in the BL602 datasheet?
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Do you know how to recognize first pin? Look at the dot in the corner.

    EDIT: almost only with your current photo, I can narrow down selection to about 5 pins which could be PWMs...
  • #8
    _Minims_
    Level 6  
    I have a multimeter, I can test all bl602 pin on a side, but I don't know where to put the second cable. Which component on my photo is receiving the Pam signal ? Thanks.
  • #9
    p.kaczmarek2
    Moderator Smart Home
    Most likely one of the resistors connected to the base of the transistors. What is the marking on the transistors?

    But you don't need to do this.

    Just flash my firmware, setup the WiFi on OpenBL602 panel, then disconnect strip from USB and disconnect USB to UART from the strip.

    Connect strip controller to 12V (when it's already disconnected from USB to UART converter), wait for it to connect to your wifi, enter OpenBL602 panel again.

    Then, in Configure pins, set each pin to Relay (for a start), maybe start with 4 pins and set them to Relay with channel 1, channel 2 , channel 3, channel 4 (channel is a second column in Pin Configurators).
    Save config.
    Then you will get 4 buttons on the OpenBL602 panel. Press button 1 to toggle pin "relay" with channel 1. Press button 2 to toggle pin "relay" with channel 2. Mark down which pin makes the LED blinks.
    This is your PWM pin.
    Just change it's role from relay to PWM and that's it.
    Here is how I determine which pins you should test:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    You can clearly see which pins are routed.

    PS: also post photo of the second side of the board...
  • #10
    _Minims_
    Level 6  
    Thanks, it's really more clear to me now. I will try to flash tomorrow.

    Is there a way to backup the current FW like in esptool, so I can revert in case of issues ?

    Here is the back of the PCB :

    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
  • #11
    p.kaczmarek2
    Moderator Smart Home
    It also would be helpful to know if all transistors are used together (not recommended, but maybe chinese do that) or is this really a 4 channels controler with only single transistor used (it's possible).

    I already had a WB3S single color LED strip controller that had 4 transistors soldered and 3 of them were unused. One could really extend such a "single color strip" to 4 colors just by soldering wires.

    Hmm the back of the PCB suggests that LED strip supports two channels, Warm White (WW) and Cool White (CW), maybe there are two transistors per channel?

    I don't know about any way of doing firmware backup yet. At least, if you don't break it totally, you can count on my support with the firmware updates and fixes. Do not mess the partitions when flashing, select the files like on my screenshots.
  • #12
    _Minims_
    Level 6  
    I have just checked the 4 transistor, it is written '3400' on top of them.
    How can I check if there is 2 transistors per channel ? Can I check that with the multimeter ?
  • #13
    p.kaczmarek2
    Moderator Smart Home
    Do a better quality photo or put one probe to WW pad and check on which pins of which transistor is there a continuity. The same for CW pad.

    but....
    from a quick glance at the previous photo I would now say that all 4 work together.
    Just tell me, where does the yellow signal controlling gates of transtistor goes? This is the PWM you look for.
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    Edit maybe:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
  • #14
    roli1
    Level 6  
    I just flashed succsessfully a BL602 as you described.

    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    A Accsess Point is shown "OpenBL602_94F30D07" and i can connect to it.

    I just cannot connect to 192.168.4.1

    What i'm doing wrong
    Thanks Roli
  • #15
    p.kaczmarek2
    Moderator Smart Home
    Hey @Roli , good job!
    Maybe it's again DHCP problem? I am battling this issue on Beken chips and it might happen here as well.
    Try setting some static IP instead and tell us if it worked for you:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
    (reconnect to wifi again after changing IP)
  • #16
    roli1
    Level 6  
    Hi
    The Problem is that i can not reach 192.168.4.1 when i'm connected to the BL602 WIFI.
    I solved this, i checked the Gateway Address of the BL602 wifi and could reach the settings page with 192.168.169.1

    But the next problem appeared, when i change the WIFI settings to my ssid and pass, the BL602 never show up on any network scanner, but mqtt is online.
    and if the device is not shown in my router i can not set a static ip address.
  • #17
    p.kaczmarek2
    Moderator Smart Home
    I will check if the 192.168.4.1 is correctly set.

    roli1 wrote:
    but mqtt is online.

    How do you know?

    If MQTT works then device must have joined your network already.

    For me, device shows up on DHCP list like that:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!
  • #18
    roli1
    Level 6  
    Yes it is connected to the network but i cannot find out the ip address.
    I changed the MQTT settings before i changed the wifi settings.
    When i unplug the device Mqtt goes offline when i plug it in it comes online, checked with MQTT Explorer.
  • #19
    p.kaczmarek2
    Moderator Smart Home
    roli1 wrote:
    Yes it is connected to the network but i cannot find out the ip address.

    Well, are you able to enter the list of DHCP clients of your router?
    Can you post a screenshot (if required, hide the parts you do not want to show or send it to my by PM)?
    Can you see the host names of connected devices?
    it is also possible to check router logs to know when the devices has joined the network and take IP from there.

    PS: you are correct with the thing that open access point wifi IP was 192.168.169.1 , I double-checked and it is default IP of BL602, I will fix it soon to be correct 192.168.4.1 just as on other platforms I support. It's a bug.
  • #20
    roli1
    Level 6  
    I got it working now, my router still not show the device but i found it with the Network IP Scanner.
    The Router i use is a Huawei Hybrid Modem, it is very restricted from the Provider and there is no alternative at the moment.

    Thanks for your help!!
  • #21
    p.kaczmarek2
    Moderator Smart Home
    roli1 wrote:

    The Router i use is a Huawei Hybrid Modem, it is very restricted from the Provider and there is no alternative at the moment.

    This is interesting. I didn't expect that, but that's why we're testing. I will create some mechanism to get IP more easily...

    Maybe let's make device respond to a special MQTT query with the IP information or make it respond to UDP broadcast on certain port?
  • #22
    roli1
    Level 6  
    Yes this is very annoying, i have the same problem sometimes with tasmota devices, but there i can use TasmoAdmin to find out.

    Now i have to find out which GPI0's are used, i have the same Magic Home device as @_Minims_, a singe chanel controller, with ON OFF and Dimm, and then how to send MQTT commands in which format.

    Is it possible to reflash the device if something went wrong?
  • #23
    p.kaczmarek2
    Moderator Smart Home
    roli1 wrote:
    Yes this is very annoying, i have the same problem sometimes with tasmota devices, but there i can use TasmoAdmin to find out.

    I will look into supporting TasmoAdmin



    roli1 wrote:

    Now i have to find out which GPI0's are used, i have the same Magic Home device as @_Minims_, a singe chanel controller, with ON OFF and Dimm, ?

    On one of the photos, I most likely already found one of the GPIOs

    roli1 wrote:

    and then how to send MQTT commands in which format.

    Look up first post or use Config->Generate home assistant config (it should work well for single PWM)

    roli1 wrote:

    Is it possible to reflash the device if something went wrong?

    It's possible to reflash by wires again (unless you make a mistake yourself and overwrite bootloader, but I dont know if that's possible).
    It is also possible to reset/safe mode the device by doing 3 or more turn on and off power cycles with running device for less than about 30 seconds (power on, wait 3 sec, power off, etc 3 times).
    It will enable open access point again and also might disable IO (so don't bother testing GPIO in the safe mode).
  • #24
    _Minims_
    Level 6  
    I have flash my device.
    So I have set PWM on GPIO20 and my led strip is dimmable like before.
    Many Thanks.

    More questions features Now ? :-)
    - Is it possible to make the device discoverable via the Tasmota integration in HA
    - Or enable MQTT discovery if you prefer ?
    - Is there a way to change the MQTT topic name ? mine is "obl9417B7D9"
    - Can we have more datas in MQTT such as "WIFI Signal", "Uptime", "Reboot Switch" ?

    Many Thanks for you work.
  • #25
    p.kaczmarek2
    Moderator Smart Home
    Congratulations, it's time to test how stable your device is! Please report all problems back to me. I have so far only one BL602 device.

    _Minims_ wrote:

    - Is it possible to make the device discoverable via the Tasmota integration in HA
    - Or enable MQTT discovery if you prefer ?

    It is certainly possible to do Discovery, but from what I've seen the discovery protocol is a bit more complicated so I decided to give it a lower priority. Things like TuyaMCU are more importatn to do first.

    _Minims_ wrote:

    - Is there a way to change the MQTT topic name ? mine is "obl9417B7D9"

    Config->Names->Short device name? Right now short device name is used as MQTT topic.
    Can you check if it works?

    _Minims_ wrote:

    - Can we have more datas in MQTT such as "WIFI Signal", "Uptime", "Reboot Switch" ?

    How often would you like your device to publish WIFI Signal/Uptime?

    And regarding reboot switch... good idea, I will add it right away.

    Added it as a command.
    You execute commands by MQTT publish:
    
    cmnd/obl9417B7D9/commandName
    

    https://github.com/openshwprojects/OpenBK7231T_App/commit/8eaf28dc4a2e6689e59c0ef5a356bc92736e65c7
    so to restart device by MQTT, do:
    
    cmnd/obl9417B7D9/restart
    

    Ofc right now it is not in the binary, you would have to compile yourself or wait few days for me to publish binary.
  • #26
    roli1
    Level 6  
    I got it working, and fully integrated in OpenHab via MQTT
    Quote:

    Config->Names->Short device name? Right now short device name is used as MQTT topic.
    Can you check if it works?

    I changed the device name, and it works as MQTT topic!
    Quote:

    Added it as a command.
    You execute commands by MQTT publish:
    
    cmnd/obl9417B7D9/commandName
    

    https://github.com/openshwprojects/OpenBK7231T_App/commit/8eaf28dc4a2e6689e59c0ef5a356bc92736e65c7
    so to restart device by MQTT, do:
    
    cmnd/obl9417B7D9/restart
    

    Ofc right now it is not in the binary, you would have to compile yourself or wait few days for me to publish binary.


    In Openhab i use
    
    Short device name/0/get
    

    as MQTT state topic
    and
    
    Short device name/0/set
    

    as MQTT command topic

    This is the Log from the received MQTT command from Openhab
    
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic terrasse_l/0/set
    
    Info:MQTT:MQTT in topic terrasse_l/0/set
    Info:MQTT:channelSet topic 1107389852
    Info:MQTT:channelSet part topic 0/set
    Info:MQTT:channelSet channel 0
    Info:MQTT:MQTT client in mqtt_incoming_data_cb data is 40 for ch 0
    
    Info:GEN:CHANNEL_Set channel 0 has changed to 40
    
    
    Info:MAIN:Channel has changed! Publishing change 0 with 40 
    
    Info:MQTT:Publishing 0 = 40 
    
  • #27
    _Minims_
    Level 6  
    p.kaczmarek2 wrote:
    It is certainly possible to do Discovery, but from what I've seen the discovery protocol is a bit more complicated so I decided to give it a lower priority. Things like TuyaMCU are more importatn to do first.


    Discovery seems simple from my point of view if you already generate HomeAssistant Configuration.
    You have to publish in :
    
    homeassistant/light/<unique id such as MAC ADRESS>/<entity_name>/config
    homeassistant/light/123456789/bedroom_light/config
    homeassistant/light/123456789/bedroom_light_restart/config
    

    as payload you can setup something like this (not tested) :

    
    {
        "unique_id":"123456789_lumiere_bureau",
        "brightness":true,
        "brightness_scale":99,
        "color_mode":false,
        "pl_on": 99,
        "pl_off": 0,
        "command_topic":"lumiere_bureau/1/set",
        "device":{
           "identifiers":[
              "123456789"
           ],
           "manufacturer":"MagicHome",
           "model":"ZJ-BWCE-CCT V1.1        ",
           "name":"Lumiere Bureau",
           "sw_version":"1.0b"
        },
        "name":"Lumiere Bureau",
        "state_topic":"lumiere_bureau/1/get"
     }
    


    Added after 1 [minutes]:

    p.kaczmarek2 wrote:
    Config->Names->Short device name? Right now short device name is used as MQTT topic.
    Can you check if it works?


    It works, thanks :-)

    p.kaczmarek2 wrote:
    How often would you like your device to publish WIFI Signal/Uptime?


    I would say 60sec
  • #29
    edenoregel
    Level 1  
    Hi
    I'm trying to flash my Magic Home RGB controller. I connected RX to TX, TX to RX, GND to GND and V33 to 3V, I tried connecting boot to 10K resistor and then 3V. I get this error:
    
    [10:47:26.606] - Flash load shake hand
    [10:47:26.707] - default set DTR high
    [10:47:26.812] - clean buf
    [10:47:26.844] - send sync
    [10:47:26.949] - ack is b’’
    [10:47:26.950] - retry
    [10:47:26.952] - default set DTR high
    [10:47:27.053] - clean buf
    [10:47:27.085] - send sync
    [10:47:27.188] - ack is b’’
    [10:47:27.189] - retry
    [10:47:27.205] - {“ErrorCode”: “0001”,”ErrorMsg”:”BFLB EFLASH LOADER SHAKEHAND FAIL”}
    [10:47:27.206] - Shake hand redo
    [10:47:29.208] - ack is b’’
    [10:47:29.210] - Not ack OK
    [10:47:29.211] - Read log
    [10:47:29.211] - Read Fail
    


    What am I doing wrong?
  • #30
    p.kaczmarek2
    Moderator Smart Home
    What kind of UART converter? Can you post photos of your setup? Maybe swap RX and TX?
    Do you have the same error when having no conncetion to BL602 at all?

    Btw, 20 days stable uptime:
    Tasmota replacement for BL602, programming, pairing with Home Assistant, now with OTA working!