Elektroda.com
Elektroda.com
X

Search our partners

Find the latest content on electronic components. Datasheets.com
Elektroda.com

Tasmota replacement for BL602, programming, pairing with Home Assistant.

p.kaczmarek2 2742 29
This content has been translated flag-pl » flag-en View the original version here.
  • Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Hello, here I will present the world's first Tasmota replacement for the BL602 devices, offering, among others. the possibility of pairing our device with Home Assistant via MQTT. I will show here how you can easily upload a firmware to 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. Additionally, I will present two interesting demos from SDK BL602.

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

    Used module from BL602
    Development boards with BL602 (or related) systems can be bought at relatively low prices, but the main principle of my operation is to "free" available IoT products with closed programming of their manufacturers, so I used such a product for this topic as well.
    This product served as a testing ground for me: RGB LED strip with IR and WiFi remote control - MWIR-RGB Magic Home Pro .
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    I have described the details in the "Teardowns" section of our forum:
    https://www.elektroda.pl/rtvforum/topic3881416.html
    This driver has a BL602 on board and 3 PWM-controlled transistors:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Sketch of connections:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.

    What is this firmware?
    The firmware repository is here:
    https://github.com/openshwprojects/OpenBK7231T_App
    My firmware for BL602 is basically a port of my OpenBeken. I have rewrote most of my OpenBeken recently so now my firwmare is cross-platform application supporting the BK7231T, BK7231N, XR809 and BL602 chips.
    The initiative was started on these topics:
    WB2S / BK7231 Tutorial - we create our own firmware - UDP / TCP / HTTP / MQTT
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    For the user - downloading the compiled OpenBL602 / OpenBeken firmware for BL602
    My Github repository has a script that automatically compiles binaries online for BK7231N, BK7231T and XR809 platforms, unfortunately BL602 is not yet supported by it.
    For this reason, download the firmware from the releases_bl602 folder:
    https://github.com/openshwprojects/OpenBK7231T_App/tree/main/bl602_release
    It may change in the future and we will download the firmware 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 cables.
    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 leave it open (we connect it only for the duration of programming)
    - ground to ground
    - 3.3V power supply (if there is LDO on the board, then 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.
    NOTE: If you connect the 5V power supply from USB to the LDO input (or the 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 the USB itself ... so always remember to disconnect external power supply first!



    For the user - loading the firmware
    To upload the firmware , youneed to:
    1. Connect the BOOT signal to the power supply through a 10k resistor
    2. Disconnect and reconnect power (reboot with BOOT signal raised to power)
    3. In BLDevCube.exe select files in turn:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    4. Make sure that the UART port is not in use (e.g. if you have it open in RealTerm, close it)
    5. Click "Download" (which means "send the firmware to BL602"):
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Ready!
    Now, to start the firmware , disconnect BOOT (leave it loose), disconnect the power for a moment, and then restore it.
    The device logs will still be available with baud = 2,000,000 (as in the demos from the SDK).


    For the user - OpenBL602 configuration
    The configuration of my firmware port on BL602 is analogous to the configuration described in these topics:
    - Qiachip Smart Switch - BK7231N / CB2S - interior, programming
    - Garden Tuya CCWFIO232PK Double Relay - BK7231T - Programming
    It is also worth reading the topic:
    Home Assistant Tutorial - configuration, WiFi, MQTT, Zigbee, Tasmota
    After restarting the device, you should see an open Access Point named like OpenBL602_1A1B2C3D4E5:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Connect to it and open the page with the address 192.168.4.1. Configure just like Tasmota (set WiFI SSID and passport, set the pin roles, set MQTT IP, user name, password, etc).
    For this particular RGB LED strip, the roles of the pins are as follows:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    In the current version, my firmware does not support the IR remote that has this strip.

    For the user - pairing with the Home Assistant
    There is an "Generate Home Assistant Config" option in the OpenBL602 panel, but it is not always enough. In case of 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

    Save it in configuration.yaml. If you have several lights, put the light prefix with a colon once.
    After restarting the Home Assistant, you can control the bar:
    Tasmota replacement for BL602, programming, pairing with Home Assistant. Tasmota replacement for BL602, programming, pairing with Home Assistant. Tasmota replacement for BL602, programming, pairing with Home Assistant. Tasmota replacement for BL602, programming, pairing with Home Assistant.
    The current version has a drawback - after restarting Home Assistant it does not read the current brightness and color values. This will be fixed, but it does not affect the control of this led strip.

    For developer - 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 will have to learn how to compile. You will need MSys2 to compile the firmware. Download and install it from here:
    https://www.msys2.org/#installation
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Windows may be blocking MSys - please continue anyway.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Choose the installation directory:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    After installation, run msys2. It still needs to be updated.
    Execute the command:
    pacman -Syu
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Then also pacman -Su
    Then pacman -S make
    Tasmota replacement for BL602, programming, pairing with Home Assistant.

    For the developer - downloading the SDK and compiling the project
    Unfortunately, the SDK download becomes more complicated here. 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, namely b3898a520d6e5a34a5f4de8241fcc1c1d3b071b9.
    People other than me also have problems 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 compile my project, please download my modified version from here:
    https://github.com/openshwprojects/OpenBL602
    This is because the main OpenBK application (or OpenBL), called App, is shared between different SDKs of different platforms, and the same SDKs contain the basics of the projects in which the main App is compiled.
    Projects in the SDK are located in the customer_app folder:
    Here is a list of them:
    Code:

    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 is as simple as going to the project folder and calling ./genromap
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    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.
    But in my experience it is usually not needed and the script finds the path by assuming that the SDK is two directories higher than the project being built. On the other hand, 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 joined by the linker.
    The generated files are located in the build_out folder, for example: customer_app \ bl602_sharedApp \ build_out


    For the developer - Demko sdk_app_gpio
    Since we learnt how to compile ourselves, it's time to test the demos of the functionality provided to us by the SDK developers.
    One of the most interesting demos is sdk_app_gpio.
    The sdk_app_gpio demko allows you to configure GPIO pins from the UART console. The command syntax is "gpio-func ".
    For example, the command:
    Code:
    gpio-func 8 0 0 0
    

    configures GPIO pin 8 as an output with no pull up / down resistors.
    The baud of the demo is 2,000,000.
    This is how the demo looks after launch:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    After sending the pin control command:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Then you can set this pin low or high with:
    Code:

    gpio-set 

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

    gpio-get

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

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

    Getting his 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, too, we control it via UART commands. Baud as before.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    For starters, it's worth getting to know the whole list of commands through the fairly obvious help command:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Let's try wifi_ap_start:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    wifi_scan also works. We have all the code for this demo so we can see what and how it is realized.

    Summary
    Another platform supported! I started with XR809 support , next I took care of the BK7231T and BK7231N . Now the BL602 has been supported. The next in line are the Realtek and W600 chips, but will I also manage to get them working? We'll see.
    In the queue of devices for testing and flashing, I still have a bulb with BL602, but I do not think there will be problems with that - the board with the WiFi module has available required pads, i.e. RX, TX and BOOT. I will describe it in our forum "Teardowns" section soon.
    As for the stability of the current firmware version for BL602, I tested it for two days, including deliberately shutting down the router (checking if it would catch the event disconnect and reconnect) and I did not encounter any problems, but of course I will continue to test and fix any problems on a regular 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 constantly add support for new functionalities to the firmware and collect information about what works. As far as I know, the most popular ones are, for example, Sonoff 40 probably uses BL602.

    Cool? Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    p.kaczmarek2
    Level 26  
    Offline 
    p.kaczmarek2 wrote 1720 posts with rating 3439, helped 94 times. Been with us since 2014 year.
  • #2
    khoam
    Level 41  
    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
    Level 26  
    https://itead.cc/product/sonoff-iplug-series-wi-fi-smart-plug-s40-s40-lite/
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    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 30  
    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
    Level 26  
    @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 4  
    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. Tasmota replacement for BL602, programming, pairing with Home Assistant.

    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
    Level 26  
    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.
    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 4  
    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
    Level 26  
    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.
    You can clearly see which pins are routed.

    PS: also post photo of the second side of the board...
  • #10
    _Minims_
    Level 4  
    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.
  • #11
    p.kaczmarek2
    Level 26  
    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 4  
    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
    Level 26  
    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.
    Edit maybe:
    Tasmota replacement for BL602, programming, pairing with Home Assistant.
  • #14
    roli1
    Level 3  
    I just flashed succsessfully a BL602 as you described.

    Tasmota replacement for BL602, programming, pairing with Home Assistant.
    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
    Level 26  
    Hey @roli1 , 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.
    (reconnect to wifi again after changing IP)
  • #16
    roli1
    Level 3  
    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
    Level 26  
    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.
  • #18
    roli1
    Level 3  
    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
    Level 26  
    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 3  
    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
    Level 26  
    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 3  
    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
    Level 26  
    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 4  
    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
    Level 26  
    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:
    Code:

    cmnd/obl9417B7D9/commandName

    https://github.com/openshwprojects/OpenBK7231...mmit/8eaf28dc4a2e6689e59c0ef5a356bc92736e65c7
    so to restart device by MQTT, do:
    Code:

    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 3  
    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:
    Code:

    cmnd/obl9417B7D9/commandName

    https://github.com/openshwprojects/OpenBK7231...mmit/8eaf28dc4a2e6689e59c0ef5a356bc92736e65c7
    so to restart device by MQTT, do:
    Code:

    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
    Code:

    Short device name/0/get

    as MQTT state topic
    and
    Code:

    Short device name/0/set

    as MQTT command topic

    This is the Log from the received MQTT command from Openhab
    Code:

    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 4  
    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 :
    Code:

    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) :

    Code:

    {
        "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:
    Code:

    [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
    Level 26  
    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.