Elektroda.com
Elektroda.com
X

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

p.kaczmarek2 115059 1236
This content has been translated flag-pl » flag-en View the original version here.
  • #721
    jmcc
    Level 5  
    p.kaczmarek2 wrote:
    I honestly have no idea if it's already in Tasmota


    I just found the following on https://tasmota.github.io/docs/MQTT/#fulltopic

    'Ask the device for status~

    cmnd/tasmota_switch/Power ← // an empty message/payload sends a status query
    ↳ stat/tasmota_switch/RESULT → {"POWER":"OFF"}
    ↳ stat/tasmota_switch/POWER → OFF'

    Not sure if it helps or even if its implemented in Home Assistant though.

    Thanks,

    J
  • #722
    p.kaczmarek2
    Moderator Smart Home
    We will have it implemented as well, we already have a basic Tasmota command stubs.

    Broadcast every minute is ready, can you check?
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    see how it looks in HA:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    it's not enabled by default, I am not sure if it's bug-free but let's start with this for now. It also broadcasts IP (but I might disable it and only broadcast IP on startup, IP broadcast was requested by BL602 user few weeks ago)

    Please check it well and report back here if there are any issues. Due to the scale of the project and the lack of free time, I am not able to test everything with each change.

    PS: it broadcasts raw channel values, OK for relays, but for LEDs it won't broadcast custom variables like "dimmer" or "color temperature"
  • #723
    jmcc
    Level 5  
    Great, I'm compiling it at the moment. I just have to flash the bin file using the OTA programing right?

    I'm away for a couple of days, might be best if I do the test when I get back though :). I'll let you know how it goes.

    Thanks,

    J
  • #724
    p.kaczmarek2
    Moderator Smart Home
    Wait, why are you compiling?
    Binaries (RBL) are automatically released on my repository.
  • #725
    jmcc
    Level 5  
    p.kaczmarek2 wrote:
    Wait, why are you compiling?
    Binaries (RBL) are automatically released on my repository.


    Ah, I did not know that! I compiled all when I initially flashed the device and assumed thats what I'd have to do again. Have you a link to the RBL file for future updates? I can't find it in any of the stuff I downloaded. I downloaded the OpenBK7231T_App stuff from Github (I saw where you had made the update in the source). I also hunted through the OpenBK7321N SDK stuff though I did not see you had touched that for a couple of days.
    The output folder from the compile I just did has an RBL file though which I presume is part of the compile output.

    Thanks,

    J
  • #726
    p.kaczmarek2
    Moderator Smart Home
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    download RBL for your chipset and use the "drag and drop" in extra app panel (javascript)
  • #727
    jmcc
    Level 5  
    p.kaczmarek2 wrote:

    download RBL for your chipset and use the "drag and drop" in extra app panel (javascript)


    Ha! I never even looked at that side of the screen. I'll not do anything until I get back home.

    Thanks for your assistance, I'll let you know how it goes.

    J
  • #728
    p.kaczmarek2
    Moderator Smart Home
    I am finalizing Tasmota Groups stuff.

    Tomorrow few more things will be added, for example, a scriptable command to publish Tasmota Groups state change (the Tasmota Group states are updated automatically, but now it also will be scriptable).

    Examples:
    Code: c
    Log in, to see the code

    (syntax of DGR_SendPower testSocket 1 1 is the following: DGR_SendPower [groupName] [channelFlags] [channelsCount])

    that way you can do interactions between multiple groups

    this command is basically like Tasmota "DevGroupSend" but it allows you also to control other groups

    of course there will be also DGR_SendDimmer, etc

    PS: if you don't know what Tasmota groups are, see : https://tasmota.github.io/docs/Device-Groups/
  • #729
    jmcc
    Level 5  
    jmcc wrote:
    p.kaczmarek2 wrote:

    Thanks for your assistance, I'll let you know how it goes.

    J


    I got brave and remote flashed the switch with your mods. They work really well. Looks like my problem is solved.

    Thanks,

    J.
  • #731
    jmcc
    Level 5  
    p.kaczmarek2 wrote:
    Thank you for testing.

    Is there anything more I could add for you to my OpenBeken?


    I may well find some new features I'd like when I unserstand this stuff better. Its great though to have these devices disconnected from the cloud!

    Thanks,

    J
  • #732
    Tow96
    Level 4  
    I found this MOES 3 gang switch, It has two boards, the main one with the logic and the daughter with the power and relays.

    There are 3 ic's in the main board a WB2S a small IC I don't know what it does. The big one is a microcontroller where al inputs and outputs are connected to. this IC communicates with the WB2S using the TX and RX pins. Unfortunately, the number in the IC's has been removed.

    It seems that the bigger IC holds the logic for the board. As even though I haven't assigned any pins, the buttons still activate the relays.

    [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
  • #733
    p.kaczmarek2
    Moderator Smart Home
    It's a TuyaMCU device. TuyaMCU is already supported, but first you need to find out dpIDs for the configuration. Are you able to connect it to 3.3V power supply (or to 5V power supply, if you connect it to the input of 3.3V LDO on the board), and use USB to UART converter to capture the packets?

    Or maybe it was an ESP device and TuyaMCU dpIDs are already known?

    Well, maybe you could get away with just programming WB2S module and then pressing the buttons and watching the OpenBK console which dpID coresponds to which button..

    https://www.elektroda.com/rtvforum/topic3898502.html

    Of course, there will be a small problem with programming/reading the firmware, because the RX/TX lines for programming are also used to communicate with TuyaMCU....


    EDIT:
    Quote:

    As even though I haven't assigned any pins, the buttons still activate the relays.

    Or maybe you already have it flashed? If so, activate TuyaMCU and watch the console log in OpenBeken, this should show what it's receiving , that way you can also determine dpIDs
  • #734
    Tow96
    Level 4  
    Quote:
    Or maybe you already have it flashed? If so, activate TuyaMCU and watch the console log in OpenBeken, this should show what it's receiving , that way you can also determine dpIDs


    I started TuyaMCU and pressing a button triggers two dpI

    Quote:
    -------- ON -----------------------------------------------------
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 07 00 08 07 02 00 04 00 00 00 00 1B
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 7, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 07 00 05 01 01 00 01 01 0F
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 1, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte: 

    -------- OFF -----------------------------------------------------

    Info:TuyaMCU:TUYAMCU received: 55 AA 00 07 00 08 07 02 00 04 00 00 00 00 1B
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: processing command 7 (State) with 15 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 7, dataType 2-DP_TYPE_VALUE and 4 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 4 int: 0
    Info:TuyaMCU:TUYAMCU received: 55 AA 00 07 00 05 01 01 00 01 00 0E
    Info:TuyaMCU:TuyaMCU_ProcessIncoming: processing command 7 (State) with 12 bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: processing dpId 1, dataType 1-DP_TYPE_BOOL and 1 data bytes
    Info:TuyaMCU:TuyaMCU_ParseStateMessage: raw data 1 byte:


    It seems that dpId 1, 2, 3, control the relays and the button LED's. No Idea what 4 byte value the dpId 7, 8, 9 control

    Also it seems that there is no dpId for the WiFi LED, probably will need to check the pcb again

    EDIT:
    The WiFi LED is definetely connected to pin 11 of IC. shouldn't it be controlable via a dpId? the Hearbeat command does nothing
  • #735
    p.kaczmarek2
    Moderator Smart Home
    How did you flash that WB2S? Do you have a firmware backup, for tuya-cloudcutter guys or something? Did you desolder whole module?

    Since you already have TuyaMCU packets receiving, maybe try configuring it and sending something? Link channel 1 to dpid 1, channel 2 dppid 2, etc.. just to see if it works.

    You can also try doing some guesswork, maybe dpid 4 is a wifi LED? Wouldn't hurt trying

    I don't know why it sends two signals at once. Have you tried doing a double click or long press hold to see if the signal changes?
  • #736
    Tow96
    Level 4  
    Quote:
    How did you flash that WB2S? Do you have a firmware backup, for tuya-cloudcutter guys or something? Did you desolder whole module?

    I was unable to flash it using bk_writer, it uses a BK7231T so maybe is an issue with my PC. So I flashed it using python. While trying to flash I desoldered the VCC pin from the TuyaMCU so the RX and TX bus was free.

    However, I was able to pull the backup with bk_writer and the TuyaMCU still wired. Don't know if that affected the bin produced (my guess is probably yes) or if it is possible to flash the WB2S module without desoldering (probably not). I have a spare switch that I haven't flashed. So when I write a full documentation tomorrow I'll use it to verify both things.

    Quote:
    Since you already have TuyaMCU packets receiving, maybe try configuring it and sending something? Link channel 1 to dpid 1, channel 2 dppid 2, etc.. just to see if it works.

    Hooked it up to Home Assistant, works perfectly. dpId4 and dpId10 also exist which seems to be for a fourth switch, the relay board has space for a fourth relay, but is unused.

    Tried other dpId's I didn't got a response.

    And finally figured out what the secondary dpId's do:
    dpId1-4 set the state of the relay (I linked these to MQTT)
    dpId7-10 toggle the relays after a n amount of seconds (Maybe useful for somebody, but not for me, so I didn't link them)

    Should I post the documentation in this thread or should I create a new one?
  • #737
    p.kaczmarek2
    Moderator Smart Home
    Great job, it turned out way easier than expected.

    Please post all information here, in teardowns section:
    https://www.elektroda.com/rtvforum/forum507.html
    device photos + where to buy + device config, screenshots, etc. Thanks!

    I will link later from the github to your topic.
  • #738
    leecher1337
    Level 6  
    I'm currently trying to get a Curtain Switch Etersky WF-CS01 to work.
    This used to be an ESP32 device that worked with Tasmota, but now it uses Beken.
    These are the images and Templates from the previous versions that used to be ESP:

    https://templates.blakadder.com/WF-CS01_EU.html
    https://templates.blakadder.com/etersky_WF-CS01.html

    Now I'm trying to find out the pinout and if this can be made working with OpenBeken, I guess something like Tasmota Shutter Support would be needed.
    The only pins I found out so far are:

    PWM1 10 Button1 (Middle button)
    PWM4 6 Relay2
    PWM0 7 Relay1

    I tried nearly every pin as Button 2 to check if it reacts to the key press of the upper or lower button, but to no avail.
    So I'm a bit clueless now how this whole shutter device works. Any hints on what I could try to find out buttons and LEDs and to get this Curtain Switch working?
    Measuring the PINs to Buttons wouldn't be of much use, as the buttons end in this 8A04T1M06BN1 chip, no clue, how to talk to it.


    [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 [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

    Thanks
  • #739
    p.kaczmarek2
    Moderator Smart Home
    Can you check where RXD1 and TXD1 and maybe RXD2 and TXD2 goes?

    Getting one such device for testing would be helpful....



    PS: I am working on CSE7766 support
  • #741
    p.kaczmarek2
    Moderator Smart Home
    Very good job, thank you.

    I'll handle doing polish translation of your documentation for our non-english-speaking users and I will also add link to the github.

    Basic CSE7766 supports seems to be functional, as it is using a simple UART protocol, but there are still some things to resolve.
    https://templates.blakadder.com/deta_6920HA.html
    I am doing it remotely for this socket: DETA Double GPO + USB Power Monitoring Wall Outlet (6920HA)


    Futhermore, yesterday I received a device with new chip, that still has SDK (and even dev boards on aliexpress) available:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    W800-C400 chip, I'll check if it's easily flashable
  • #742
    AcuarioCat
    Level 5  
    Hi, a couple of things:

    1. Did you know you can get development modules from Tuya that make the development process much easier. One (TYDE5-CBU) is like an UNO and has double RS232 on the USB connector so it's easy to set up for debugging and flashing. Another module is like a Nano. They are cheap (I paid $22 for 3 x nano and the CBU and 4.5Eu import duty, shipping included).

    2. Question: Do you know how to change the SSDP (UPnP, Zeroconfig etc names) that the device broadcasts? The default is Tuya Smart and I can't find how to change it. -

    Correction - it seems it doesn't do SSDP at all - pity. Searching for the device using the WiFi scan app it just appears (as all Tuya devices) as Tuya Smart - would be great to be able to determine the device by its name..
  • #743
    eakeyson
    Level 5  
    I am trying to get Merkury smart bulbs from Walmart to work with OpenBK7231T/ Home Assistant. They have a WB-2L wifi module in them and I have successfully uploaded the new firmware to the module. LEDs are controlled by an obscure I2C controller (BP Semi BP5758) for which there is little information. What is the status of I2C support in OpenBK7231T and is there any chance that this chip is supported either generically or specifically? FWIW, the latest version of Tasmota 12.0 specifically supports this chip. Just wondering where to go next. Thanks. [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
  • #744
    p.kaczmarek2
    Moderator Smart Home
    @eakeyson I2C is working, so you just would have to add a specific driver for this chip. I would do this myself if I had that bulb at hand. I think I also have another, similiar I2C bulb waiting for me to write a driver.

    @AcuarioCat where can I buy a such a development board, for a relatively affordable price?

    Next platform is starting to get supported - W800-C400 WinnerMicro WiFi & Bluetooth MCU!
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • #746
    p.kaczmarek2
    Moderator Smart Home
    And they are sent from China? What are the shipping options? Do they accept Paypal?

    W800-C400 is getting integrated into HAL right now
  • #747
    leecher1337
    Level 6  
    @p.kaczmarek2
    Only additional wiring I found so far regarding the controller
    that gets the touch input:

    The Microcontroller is a OB38A04T1
    Datasheet: http://www.lookmcu.com/pdf/620169.pdf

    Connections to it that I could find so far:

    RXD1 -> P0.4/TK0
    PWM2 -> P0.3/TK1

    I guess, without having knowledge about the code that runs on the
    OB38A04T1, there won't be a way to find out how to check the
    touch keys?

    I made a dump of the original firmware of the device, if this is helpfu for reversingl:
    https://github.com/tuya-cloudcutter/tuya-cloudcutter/files/8603335/dump2.zip
  • #748
    p.kaczmarek2
    Moderator Smart Home
    @leecher1337 why not just connect external UART to USB converter and capture the the communication data? That way we will know if it's a TuyaMCU or something

    or just enable TuyaMCU in OpenBK and see if it receives anything, for a start...

    I am finalizing W800 support.
    MQTT is working, buttons are working, GPIOs are working, PWMs are working
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [img-1]
  • #749
    AcuarioCat
    Level 5  
    @p.kaczmarek2 As far as I'm aware yes they come direct from China.
    They arrived fairly quickly to Spain (about 1 1/2 weeks) and I paid 4,50Eu import duty - shipping was included in the price I didn't pay extra.
    I paid with a credit card, no idea if they accept paypal.
  • #750
    p.kaczmarek2
    Moderator Smart Home
    I will look into that... I'm not sure if I'll order one.

    W800 port is now fully functional, even with OTA!
    [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