logo elektroda
logo elektroda
X
logo elektroda

[BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

p.kaczmarek2 178080 1242
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • ADVERTISEMENT
  • #1052 20287316
    p.kaczmarek2
    Moderator Smart Home
    You can try hot air with the right amount of flux, you can also try to add ordinary lead binder, but I don't know how much space there is and what module it is.

    Or provide more complete logs instead of downloading the screen.

    This is what the log from BK7231 looks like, do you get such a log in the UART?
    
    
           
    V:BK7231S_1.0.5
    
    CPSR:000000D3
    
    R0:E56F05AF
    
    R1:AC3E48E8
    
    R2:6A7FBF7C
    
    R3:5333FCE4
    
    R4:CB643E15
    
    R13:ABF7DBA7
    
    R14(LR):B8FE67F7
    
    ST:6CF21514
    
    J 0x10000
    
    prvHeapInit-start addr:0x41f4a0, size:133984
    [01-01 18:12:15 TUYA Info][mqc_app.c:175] mqc app init ...
    [01-01 18:12:15 TUYA Info][sf_mqc_cb.c:42] register mqc app callback
    [01-01 18:12:15 TUYA Debug][mqc_app.c:118] mq_pro:5 mqc_handler_cnt:1
    [01-01 18:12:15 TUYA Debug][mqc_app.c:118] mq_pro:31 mqc_handler_cnt:2
    [01-01 18:12:15 TUYA Debug][uni_thread.c:215] Thread:sys_timer Exec Start. Set to Running Status
    [01-01 18:12:15 TUYA Debug][log_seq.c:732] read from uf. max:0 first:0 last:0
    [01-01 18:12:15 TUYA Debug][svc_online_log.c:288] svc online log init success
    [01-01 18:12:15 TUYA Err][tuya_ws_db.c:314] kvs_read fails gw_bi -1
    [01-01 18:12:15 TUYA Err][ws_db_gw.c:111] gw base read fails -935
    [01-01 18:12:15 TUYA Debug][tuya_bt_sdk.c:89] ty bt cmmod register finish 1
    [01-01 18:12:15 TUYA Debug][tuya_ble_api.c:301] ble sdk inited
    !!!!!!!!!!tuya_bt_port_init
    [01-01 18:12:15 TUYA Debug][tuya_ble_api.c:337] ble sdk re_inited
    [01-01 18:12:15 TUYA Notice][tuya_bt_sdk.c:130] ty bt sdk init success finish
    [01-01 18:12:15 TUYA Debug][tuya_device.c:259] < TUYA IOT SDK V:1.0.2 BS:40.00_PT:2.2_LAN:3.3_CAD:1.0.2_CD:1.0.0 >
    < BUILD AT:2020_09_25_17_24_52 BY embed FOR ty_iot_wf_bt_sdk_bk AT bk7231t >
    IOT DEFS < WIFI_GW:1 DEBUG:1 KV_FILE:0 SHUTDOWN_MODE:0 LITTL[01-01 18:12:15 TUYA Debug][tuya_device.c:260] template_demo:1.0.0
    [01-01 18:12:15 TUYA Notice][tuya_device.c:261] firmware compiled at Sep 27 2021 07:47:11
    [01-01 18:12:15 TUYA Notice][tuya_device.c:262] Hello, is this really working? Let's compile and check!
    bk_rst:0 tuya_rst:0[01-01 18:12:15 TUYA Notice][tuya_device.c:263] system reset reason:[(null)]
    [01-01 18:12:15 TUYA Debug][tuya_ws_db.c:438] init fs. Path: (null)
    [01-01 18:12:15 TUYA Notice][simple_flash.c:432] key_addr: 0x1ee000   block_sz 4096
    [01-01 18:12:15 TUYA Notice][simple_flash.c:500] get key:
    0xcb 0x4e 0x3e 0xa4 0x0 0x30 0x9d 0xab 0x65 0x6d 0x8d 0xbf 0xe4 0xb9 0x3f 0x35
    [01-01 18:12:15 TUYA Notice][tuya_main.c:311] **********[template_demo] [1.0.0] compiled at Sep 27 2021 07:47:10**********
    [01-01 18:12:15 TUYA Debug][uni_thread[bk]tx_txdesc_flush
    .c:215] Thread:cmmod Exec Start. Set to Running Status
    [rx_iq]rx_amp_err_rd: 0x042
    [rx_iq]rx_phase_err_rd: 0xfffffe01
    [rx_iq]rx_ty2_rd: 0x095
    *********** finally result **********
    gtx_dcorMod            : 0x8
    gtx_dcorPA             : 0xa
    gtx_pre_gain           : 0x0
    gtx_i_dc_comp          : 0x1fe
    gtx_q_dc_comp          : 0x20d
    gtx_i_gain_comp        : 0x3f4
    gtx_q_gain_comp        : 0x3ff
    gtx_ifilter_corner over: 0x11
    gtx_qfilter_corner over: 0x11
    gtx_phase_comp         : 0x20f
    gtx_phase_ty2          : 0x200
    gbias_after_cal        : 0x16
    gav_tssi               : 0x22
    g_rx_dc_gain_tab 0 over: 0x80788078
    g_rx_dc_gain_tab 1 over: 0x80788078
    g_rx_dc_gain_tab 2 over: 0x84788478
    g_rx_dc_gain_tab 3 over: 0x94708c74
    g_rx_dc_gain_tab 4 over: 0x94729472
    g_rx_dc_gain_tab 5 over: 0x92709272
    g_rx_dc_gain_tab 6 over: 0x93709270
    g_rx_dc_gain_tab 7 over: 0x94719371
    grx_amp_err_wr         : 0x226
    grx_phase_err_wr       : 0x2dc
    **************************************
    ble use fit!
    temp in flash is:250
    lpf_i & q in flash is:17, 17
    xtal in flash is:21
    -----pwr_gain:12, g_idx:12, shift_b:0, shift_g:0
    -----[pwr_gain]12
    Initializing TCP/IP stack
    [01-01 18:12:15 TUYA Notice][tuya_main.c:337] have actived over 15 min, not enter mf_init
    [01-01 18:12:15 TUYA Notice][tuya_main.c:341] mf_init succ
    [01-01 18:12:15 TUYA Debug][tuya_main.c:347] gwcm_mode 3
    


    Or at least this headline:

    V:BK7231S_1.0.5

    And for example, the XR809 log looks like this:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    And this is the BL602 log:
    
    
    Starting bl602 now....
    Booting BL602 Chip...
    ██████╗ ██╗      ██████╗  █––ˆ████╗ ∈█████╗
    
    ██╔══██╗██║     ██╔════╝ ██╔═████╗╚════██╗
    
    ██████╔╝██║     ███████╗ ██║██╔██║ █████╔╝
    
    ██╔══██╗██║     ██╔═══██╗████╔╝██║██╔═══╝
    
    ██████╔╝███████╗╚██████╔╝╚██████╔╝███████╗
    
    ╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝ ╚══════╝
    
    
    
    -----------------------------------------------------------
    RISC-V Core Feature:RV32-ACFIMX
    Build Version: release_bl_iot_sdk_1.5.12-5-g6a078b47-dirty
    PHY   Version: a0_final-12-ge8d1d24
    RF    Version: 89d5eb1
    Build Date: Oct 24 2020
    Build Time: 10:50:50
    ------------------------------------------------------------
    Heap 111102@0x42024602, 3632@0x420491d0
    
    blog init set power on level 2, 2, 2.
    [IRQ] Clearing and Disable all the pending IRQ...
    [         0][INFO  : bl_sec.c:  88] Feed random number is 00000000
    [         0][INFO  : bl_sec.c:  88] Feed random number is 00000000
    ------------------TRNG TEST---------------------------------
    **********TRNG TEST rand[34d073ef]**************
    **********TRNG TEST rand[3e9c8f42]**************
    ------------------------------------------------------------
    [         0][INFO  : hal_boot2.c: 276] [HAL] [BOOT2] Active Partition[0] consumed 596 Bytes
    ======= PtTable_Config @0x4200df90=======
    magicCode 0x54504642; version 0x0000; entryCnt 7; age 0; crc32 0x12DF9A26
    idx  type device activeIndex     name   Address[0]  Address[1]  Length[0]   Length[1]   age
    [00]  00     0         0            FW  0x00010000  0x000d8000  0x000c8000  0x000b7000  0
    [01]  01     0         0           mfg  0x00180000  0x00000000  0x00010000  0x00000000  0
    [02]  02     0         0         media  0x00190000  0x00000000  0x00001000  0x00000000  0
    [03]  03     0         0           PSM  0x001e9000  0x00000000  0x00008000  0x00000000  0
    [04]  04     0         0           KEY  0x001f1000  0x00000000  0x00002000  0x00000000  0
    [05]  05     0         0          DATA  0x001f3000  0x00000000  0x00005000  0x00000000  0
    [06]  06     0         0       factory  0x001f8000  0x00000000  0x00008000  0x00000000  0
    [         0][INFO  : bl_flash.c:  96] ======= FlashCfg magiccode @0x42049c18, code 0x47464346 =======
    [         0][INFO  : bl_flash.c:  97] mid       0xEF
    [         0][INFO  : bl_flash.c:  98] clkDelay    0x1
    [         0][INFO  : bl_flash.c:  99] clkInvert    0x1
    [         0][INFO  : bl_flash.c: 100] sector size   4KBytes
    [         0][INFO  : bl_flash.c: 101] page size   256Bytes
    [         0][INFO  : bl_flash.c: 102] ---------------------------------------------------------------
    [         0][INFO  : hal_board.c: 755] [MAIN] [BOARD] [FLASH] addr from partition is 001f8000, ret is 0
    [         0][INFO  : hal_board.c: 763] [MAIN] [BOARD] [XIP] addr from partition is 231e7000, ret is 0
    [         0][INFO  : hal_board.c: 315] xtal_mode length 2
    [         0][INFO  : hal_board.c: 319] xtal_mode is MF
    [         0][INFO  : hal_board.c: 243] xtal dtb in DEC :36 36 0 60 60
    [         0][INFO  : hal_board.c: 486] channel_div_table :
    


    Does your log resemble any of these?
    Helpful post? Buy me a coffee.
  • #1053 20287323
    kbechler
    Level 10  
    There was a sticker on the other side of the module. When I removed it, this message appeared:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    For 99% it is NOT BK7231T but some F8088 from Foneric or something similar. The rest of the logs confirm this:
    [bl] goto 0x10101===============================================
    SP1-C  Jan  4 2021 19:46:51
    Foneric IoT WLAN SDK 1.3.1
    


    It's a pity, a nice socket could be....
  • #1054 20287325
    p.kaczmarek2
    Moderator Smart Home
    This is the first time I've heard of such an arrangement. Does it have an SDK available?
    Helpful post? Buy me a coffee.
  • #1055 20287339
    kbechler
    Level 10  
    Their site... is not very helpful :-\ https://www.foneric.com/fusion-sdk
    On the main page there is a button "Start your Adventure with us!" and you can email them.

    Honestly, this is the first time I see something like this too.

    PS Maybe it's worth adding information about this weirdo to https://openbekeniot.github.io/webapp/devicesList.html? Because I was misled that it is BK7231T
  • #1056 20287350
    p.kaczmarek2
    Moderator Smart Home
    I've uploaded a fix. From what I can see, the entry about MW013_V02 comes from a post by some user who described two sockets in one post, so some error could have crept in.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #1057 20287790
    Dark Man
    Level 13  
    I found on some German forum that the Foneric F8089 chip appeared in the Gosund SP1-C socket
    Someone after connecting to RXt Tx got a list of commands after the "help" command

    
    Available commands:
    > echo
    > net
    > heap
    > thread
    > reboot
    > ota
    > efpg
    > netcmd
    > etf
    > sysinfo
    > homekit
    > rp
    > wacreset
    > pdata
    > factoryreset
    > upgrade
    > rtc
    > flash
    > testmode
    > print
    > module
    > model
    > firmware
    > bct
    > help
  • #1058 20287831
    kbechler
    Level 10  
    I saw it. But no one made a custom batch for this chip, so even if you managed to throw something in, it's not much.
  • #1059 20287875
    p.kaczmarek2
    Moderator Smart Home
    Without SDK it's hard... and what do these commands show? Anyone have their results?
    Helpful post? Buy me a coffee.
  • #1060 20289946
    kbechler
    Level 10  
    p.kaczmarek2 wrote:
    It's hard without the SDK... and what do these commands show? Anyone have their results?

    Unfortunately I do not have. I didn't even try to enter them.
    But if necessary, I can solder it again and check.
    Only ... there are quite a lot of combinations ;-) so I'd be happy to take suggestions as to what exactly we want to know.
  • #1061 20297839
    boozeman
    Level 11  
    Hi,

    Long time no see :)

    Just compiled and updated my Nedis Smart plug and got changed MAC-address C8478C000000. I can not change it back to original.


    Edit. That "Restore RF config" fixed this, so by gone :)


    Cheers Timo
  • #1062 20297895
    p.kaczmarek2
    Moderator Smart Home
    Hello @boozeman . We have added many, many features during your absence. Feel free to check out our readme. Also remember that we are improved MQTT stability and are actively improving it.
    Helpful post? Buy me a coffee.
  • #1063 20305000
    Dark Man
    Level 13  
    He is preparing a teardown from a decorative LSC 970729 bulb (for which there is no cloudcutter profile) in which all electronics sit in an E27 socket.
    I managed to extract the electronics, desolder the WBL5C module, rip the 2MB batch using CH340 and BKwriter, but I can't upload anything for nothing.
    I tried:
    - normally using RX1, TX1
    - with external 3.3V power supply
    - by soldering to RX2 TX2
    - desoldering RX1
    - using different speeds
    - using NodeMCU v3 with ESP disabled
    I thought that maybe something from the TX1 pad was damaged, but by desoldering from it, the ripping of the batch did not go.

    Each time BKwriter immediately after connecting the WBL5C power supply spits out the error:
    Flash ID:0x00000000
    Time:2.827s
    Speed of Programm:115200bps
    erasing flash:0x00011000...FAILED

    I also installed everything for ripping/uploading via python, but even the ripping wouldn't start there.
    (python) PS C:\python\hid_download_py-master> python uartprogram backup.bin -d com4 -r -s 0x0 -l 0x200000
    UartDownloader....
    Read Getting Bus...
    GottenBus...
    Set baudrate successful
    linen: 200,000
    startAddr: 0
    Reading 0
    ReadSector Failed 0

    Any ideas?

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    Won batch attached
  • #1064 20305211
    p.kaczmarek2
    Moderator Smart Home
    Show where you get 3.3V, put a 100nF capacitor after the LDO regulator, make sure you reset by cutting off VDD between the module itself and the 3.3V regulator output (and if so, try to cut off together with the entire 3.3V regulator), change the USB to UART converter to another one, change to other baudrate...

    Sometimes a slightly higher baud may work and a lower one may not. E.g. 921600 might work.
    Helpful post? Buy me a coffee.
  • #1065 20309428
    Dark Man
    Level 13  
    I reset for LDO.
    I gave a 10nF capacitor (because I had no other) for the LDO.
    This capacitor and changed to baudrate 921600 helped! Thx
    I have always been taught by experience that it is better to program at lower speeds and I did not think that higher speeds might be required here :)

    Accidentally, through many attempts, the RX pad from the PCB fell off, but I managed to stick a pin in the tin connecting the chip with the PCB :P
  • #1066 20310007
    marioalmeida
    Level 10  
    Unable to change the MAC address
    I have upgrade 2 device (BK7231T) to 1.15.83 and 1.15.108, thereafter both are having same mac address as C8:47:8C:00:00:00, tried to change the mac address but, it give an error which says "MAC change error?" in the UI
  • #1067 20310055
    p.kaczmarek2
    Moderator Smart Home
    Hello @marioalmeida, it's nice to see you after so long time! OBK is now much more stable, it's good you're updating devices.

    Regarding your question, see a screenshot from our FAQ:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    BTW, Windows port with a working scripting demo will be soon released! You will be able to quickly develop and test OBK advanced scripting on Windows machine, without even having an IoT device!
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #1068 20310127
    marioalmeida
    Level 10  
    Hello p.kaczmarek2, yes after long time. After the issue of BK7231N hanging where I had to toggle the circuit breaker, I gave up on all the BK7231 T/N devices, now thought to revisit and started to upgrade to the latest firmware but ended up with duplicate mac address, I am not sure how the TLV header of RF partition was overwritten as I just upgraded from 1.12.54 to 1.15.x
    After executing "Restore RF Config (T and N, not fully tested, dont click)" button and then reboot, I was able to change the mac address

    p.kaczmarek2 wrote:
    Hello @marioalmeida, it's nice to see you after so long time! OBK is now much more stable, it's good you're updating devices.

    Regarding your question, see a screenshot from our FAQ:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #1069 20310224
    p.kaczmarek2
    Moderator Smart Home
    @marioalmeida we are sorry that you experienced that issue with early version of OBK. We had a MQTT issue that was appearing in a certain usage scenario, it should be now fixed. I am testing dozens of devices daily and they are stable:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Our team has resolved this issue already. If anything else bad happens, please report.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    PS: "startDriver SSDP" , I recommend putting that in startup. Devices will show up in Network Devices then.

    Your support is very valuable, we need users and testers in order to improve the firmware.
    Helpful post? Buy me a coffee.
  • #1070 20310282
    marioalmeida
    Level 10  
    @p.kaczmarek2 Very nice, I'll find some device to try out as most of the N modules are replaced with T
    p.kaczmarek2 wrote:

    Our team has resolved this issue already. If anything else bad happens, please report.


    What is the use case of this? autoexec, firmware upgrade?
    p.kaczmarek2 wrote:

    PS: "startDriver SSDP" , I recommend putting that in startup. Devices will show up in Network Devices then.


    In this new version I have seen 2 mqtt topics energycounter and energycounter_last_hour, is this Wh, KWh ? or something else?
  • #1071 20310327
    p.kaczmarek2
    Moderator Smart Home
    Now both T and N are stable, the only thing that is missing is a power saving mode, but we have a proof of concept working, so stay tuned.

    SSDP? It lists all devices in Windows Network devices section and when you open a device, it leads you to its web page. Very handy.

    I think it's Wh. You need to run NTP for that. This was mostly added by our contributor @valeklubomir who also did a great fixes for MQTT stability. We will add more documentation later.
    Helpful post? Buy me a coffee.
  • #1072 20310354
    marioalmeida
    Level 10  
    @p.kaczmarek2 , is it possible to add these mqtt topics to HA auto discovery?
    rssi, uptime, freeheap and mac but entity_category must be diagnostic
  • ADVERTISEMENT
  • #1073 20315742
    p.kaczmarek2
    Moderator Smart Home
    @marioalmeida if Home Assistant Discovery protocol supports that kind of values, there is no problem. I can look into it if you want, but it might be faster to ask our contributor @iprak who wrote the HA discovery support for OBK.
    Helpful post? Buy me a coffee.
  • #1074 20316414
    marioalmeida
    Level 10  
    @p.kaczmarek2 , yes that is possible, check this image which is configured with manual MQTT.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    @iprak, appreciate if you can add that as I can avoid to configure it manually.
  • #1075 20319067
    ferbulous
    Level 18  
    @p.kaczmarek2
    With my scheduled router reboot (close to 5 am daily)
    I noticed my N device took longer to reconnect while T reconnects instantly.
    Is there a timer event if wifi offline I can use to trigger restart with the script?

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #1076 20319652
    Anonymous
    Level 1  
  • #1077 20319760
    ferguson88
    Level 11  
    Thank you for your huge contribution to the development of the software and its continuous development.
    I have three power metering sockets based on W600 and BL0937 purchased three years ago.
    So far, I've used them with a replaced module for esp8266.
    Recently I found the OpenBK7231T project page and decided to go back to the W600 TW-02 V2.0 module.
    I managed to replace the firmware and connect to the wifi network.
    OTA updates and integration with Home Assistant work without problems.
    I configured the pins and the button and relay work, but there are no readings from BL0937.
    I tried to load the BL0937 driver via Command Tool but I get the error: Error:CMD:cmd startDriver NOT found (args BL0937)
    What can I do to enable BL0937 support?
    Also, remembering the last state of the butcher doesn't work.
    If I enter 1, it is on after startup, and if I enter -1, it is always off.
    Is it possible to configure it so that the relay does not turn off for a second after restarting (esp8266 does not have this effect).
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #1078 20319761
    ferbulous
    Level 18  
    JohnnyTax wrote:
    I don't know if I need to remap channels...

    If the red, green, blue colors doesn't match when you're choosing the colors (eg red is green or green is blue) then you'd need to remap the channels

    JohnnyTax wrote:
    I'm a total beginner and I don't know how to solder. Anyway, I destroyed one of my bulb to see the PCB and chip but I'm lost. The only thing I'm sure is that it's a BK7231N module and that it use C2BL

    I'd recommend using tuya-cloudcutterso you avoid can soldering and flash the firmware via ota, pretty useful when you have a dozen or more bulbs without having to teardown each one
  • #1079 20323343
    p.kaczmarek2
    Moderator Smart Home
    @ferguson88 I didn't know about LSPA on the W600 beforehand. This is useful information. BL0937 is not compiled there. I can add them to the build and try to run them, can you help with testing if needed?

    I'll try to fix the things you mentioned. I need to find where my W600 dev board is...

    I will also ask @iprak what time he has.
    Helpful post? Buy me a coffee.
  • #1080 20323505
    ferguson88
    Level 11  
    p.kaczmarek2 wrote:
    @ferguson88 I didn't know about LSPA on the W600 beforehand. This is useful information. BL0937 is not compiled there. I can add them to the build and try to run them, can you help with testing if needed?

    I'll try to fix the things you mentioned. I need to find where my W600 dev board is...

    I will also ask @iprak what time he has.


    Thank you @p.kaczmarek2 for your interest. Willing to test whatever is needed.

Topic summary

The discussion revolves around the development and implementation of custom firmware for devices using the BK7231T and BK7231N chips, particularly focusing on creating a mini HTTP server, MQTT support, and integration with Home Assistant. Users share their experiences flashing various smart devices, troubleshooting issues related to UART connections, and configuring GPIO pins for different functionalities. The conversation also touches on the challenges of maintaining WiFi connectivity, the importance of proper pin configuration, and the potential for using I2C for additional device control. Several users report successful firmware updates and the addition of new features, including support for various sensors and devices.
Summary generated by the language model.
ADVERTISEMENT