Elektroda.com
Elektroda.com
X

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

p.kaczmarek2 87678 1198
This content has been translated flag-pl » flag-en View the original version here.
  • ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    I haven't used devgrouptie, but now I'd worry that OpenBeken sends a packet with numRelays = 4 and binary (4 bits) mask for relays to all lamps and devgrouptie acts like each group is a separate group of relays with numRelays = 1 and binary (1 bit) mask.


    Just making sure we're on the same page here
    I wanted to add 1 button and exclude the other 3 buttons to the device group on the openbk switch, not sure if this is supported yet

    My current setup:
    3gang bedroom switch (relay 1-ceiling lights, relay 2-fan , relay 3- night lamp)
    The relay (pin 14) for the night lamp is set to output high so the tasmota bulbs stays online all the time. pin 15 is set as fake relay 3, otherwise pressing button 3 would toggle relay 1.

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

    I enabled setoption88 and devgrouptie'd the 3rd button to devgroup1name1: nightlamp, otherwise it would trigger all relays
    Quote:
    (SetOption88 1). When option 88 is enabled, the DevGroupTie sets which relay each device group is tied to. Each device group can only be tied to a single relay


    05:54:58.380 CMD: devgroupname
    05:54:58.387 MQT: stat/master_bedroom_3g/RESULT = {"DevGroupName1":"nightlamp","DevGroupName2":"","DevGroupName3":"","DevGroupName4":""}
    05:55:02.547 CMD: devgrouptie
    05:55:02.554 MQT: stat/master_bedroom_3g/RESULT = {"DevGroupTie1":3,"DevGroupTie2":2,"DevGroupTie3":3,"DevGroupTie4":4}


    Here's the template for gu10 bulbs (same with other 3 bulbs)
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    p.kaczmarek2 wrote:
    And to phrase question differently: do you always have "1" on each bulb selected, or does bulb 1 has 1, bulb 2 has 2, bulb 3 has 3?

    I'm not sure how to check on this
  • p.kaczmarek2
    Moderator Smart Home
    ferbulous wrote:

    Here's the template for gu10 bulbs (same with other 3 bulbs)
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    p.kaczmarek2 wrote:
    And to phrase question differently: do you always have "1" on each bulb selected, or does bulb 1 has 1, bulb 2 has 2, bulb 3 has 3?

    I'm not sure how to check on this

    Thanks, I think now I understand. I thought that you control each bulb with each relay, but I was wrong.
    Ok, can you show Tasmota configuration for remaining devices? Fan and nightlamp?

    Btw, the RGBCW Youtube tutorial for OpenBeken is now released, so far version with english subtitles and pl audio, the fully translated version is coming soon:




    Dodano po 7 [minuty]:

    so it basically means that only relay 3 applies "nightlamp" group and other are not in DGR groups?

    ferbulous wrote:

    Just making sure we're on the same page here
    I wanted to add 1 button and exclude the other 3 buttons to the device group on the openbk switch, not sure if this is supported

    05:54:58.380 CMD: devgroupname
    05:54:58.387 MQT: stat/master_bedroom_3g/RESULT = {"DevGroupName1":"nightlamp","DevGroupName2":"","DevGroupName3":"","DevGroupName4":""}
    05:55:02.547 CMD: devgrouptie
    05:55:02.554 MQT: stat/master_bedroom_3g/RESULT = {"DevGroupTie1":3,"DevGroupTie2":2,"DevGroupTie3":3,"DevGroupTie4":4}


    It seems that I now fully understand....
    You want to tie relay 3 to device groups "DevGroupName1" called "nightlamp", so changing relay 3 sends the POWER on/off to all 4 bulbs in that group?

    basically I need to add a "DevGroupTie" support for you, I can do that, but you'd need to test.

    Second option:
    1. disable all automatic device groups on beken (disable all "send"/"receive" flags, clear the group name in settings in WWW panel, etc)
    2. do:
    
    addChangeHandler Channel3 != 0 DGR_SendPower "nightlamp" 1 1
    addChangeHandler Channel3 == 0 DGR_SendPower "nightlamp" 0 1
    

    adjust "Channel3" to the Channel number you have tied to button/relay
    This might work, but it obviously won't receive feedback and won't sync back like DGR
  • ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    You want to tie relay 3 to device groups "DevGroupName1" called "nightlamp", so changing relay 3 sends the POWER on/off to all 4 bulbs in that group?


    Correct, a devgrouptie feature for openbk

    p.kaczmarek2 wrote:
    addChangeHandler Channel3 != 0 DGR_SendPower "nightlamp" 1 1
    addChangeHandler Channel3 == 0 DGR_SendPower "nightlamp" 0 1


    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [addChangeHandler Channel3 != 0 DGR_SendPower "nightlamp" 1 1]
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [addChangeHandler Channel3 == 0 DGR_SendPower "nightlamp" 0 1]
    Info:EVENT:CMD_AddChangeHandler: added Channel3 with cmd DGR_SendPower "nightlamp" 0 1


    Disabled device group(removed name) and added the command above,
    But changing the relay/toggle push button from openbkt doesn't change the nightlamp device relays

    I also added the command for another N device (1 gang) but also nothing changes to the group
    p.kaczmarek2 wrote:
    addChangeHandler Channel1 != 0 DGR_SendPower "nightlamp" 1 1
    addChangeHandler Channel1 == 0 DGR_SendPower "nightlamp" 0 1


    On further testing
    Device group enabled - Only get status relay, but I can't change it and the device is unresponsive after a few minutes. I'll try hooking up to tx2 to get the log output when that happens again.
    Device group disabled - Working nicely, I can get relay status and change it from homeassistant and device stays online.



  • p.kaczmarek2
    Moderator Smart Home
    ferbulous wrote:

    Correct, a devgrouptie feature for openbk

    Now everything is clear. I will add this to my TODO list, maybe try to do this in following days if lucky, but right now I am adding DDP for lighting.


    ferbulous wrote:

    I also added the command for another N device (1 gang) but also nothing changes to the group

    Is the problem with DGR_Send or with change callback?
    Try:
    
    DGR_SendPower "nightlamp" 0 1
    DGR_SendPower "nightlamp" 1 1
    

    in console.
    Also, just to make sure, you do that with DGR driver enabled? If not, do "startDriver DGR" first, obviously...
    Those commands are not registered unless driver is started (automatically or not)
  • ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    Now everything is clear. I will add this to my TODO list, maybe try to do this in following days if lucky, but right now I am adding DDP for lighting.

    Thanks for that! Much appreciated

    p.kaczmarek2 wrote:
    Also, just to make sure, you do that with DGR driver enabled? If not, do "startDriver DGR" first, obviously...
    Those commands are not registered unless driver is started (automatically or not)

    It looks like it's already activated in the logs

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

    Not related to device group, but since the openbkt tutorial involves an E14 led teardown
    Do you have any advice how I should proceed to teardown this GU10 bulb safely?
    The cables inside is too short to pull out the pcb, I believe the chip inside is a BL602

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • marioalmeida
    Level 10  
    marioalmeida wrote:
    I'll try to swap the problematic module to some other plug, do you recommend to try with "FullFW.bin" firmware once again or do you have any other 2MB firmware with you?


    @p.kaczmarek2 Some update.
    I re-flashed the FullFW.bin once again on two of the plugs BK7231N, this time looks good, the device is up and running for 4+hrs, usually it would freeze within first 30minutes. I still have random network disconnect but this time it will join back to the network in few seconds.

    Code: text
    Log in, to see the code
  • p.kaczmarek2
    Moderator Smart Home
    ferbulous wrote:

    Not related to device group, but since the openbkt tutorial involves an E14 led teardown
    Do you have any advice how I should proceed to teardown this GU10 bulb safely?
    The cables inside is too short to pull out the pcb, I believe the chip inside is a BL602

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

    I don't have that kind of socket at home, but I already did a teardown of such bulb about twice for research purposes.
    As far as I remember, it should be possible to take out the "legs" of the bulb, they are attached on long goldpins.
    https://www.elektroda.pl/rtvforum/topic3896404.html
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    It's tricky to do that, I have already failed once and the gold pin broke off instead of coming out of the "leg"

    I will try to add more debugging tools soon to investigate the rare N platform issue
  • ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    It's tricky to do that, I have already failed once and the gold pin broke off instead of coming out of the "leg"


    What was your method to successfully remove them?
    Do I pull right away or a twist and pull? Once removed, can you assemble them again or some adhesive requires for the bottom pins?
  • p.kaczmarek2
    Moderator Smart Home
    As you can see, the goldpins are in square shape, so no twisting, just pulling.
    I think you should be to put them back on together later.
    Still, it worked only for one of my bulbs. In the case of second one, the gold pin broke:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • ferbulous
    Level 15  
    p.kaczmarek2 wrote:
    Still, it worked only for one of my bulbs. In the case of second one, the gold pin broke:


    Thanks, i noticed that gold pin in the center, which tool did you use for this?
    My pliers just can't get a grip on the legs
  • the_ccm
    Level 1  
    Hello, I'm really new on this subject and just flashed a Tuya device ATMS1601

    there's a push button on P7, so I did in config :
    btn 2 1 => on channel 2 and will toggle channel 1 right ?

    EDIT : didn't look well on the PCB, it was P6, so now when I push button relay is changing state.

    there's is a relay on P24, so I did :
    rel 1

    I setup MQTT, and I can change the relay state by issuing :
    mosquitto_pub -t obk8D4419BF/1/set -m 1
    or
    mosquitto_pub -t obk8D4419BF/1/set -m 0
    => this is working

    so here are my questions :

    1) I would like to read the relay state, but the device does not send any MQTT message ?
    I did :
    mosquitto_pub -t obk8D4419BF/1/get -m 0

    but no response ?


    thanks in advance,
  • ferbulous
    Level 15  
    I use a different plier this time, as i was pulling the leg i noticed cracks on the bottom base.

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

    Seems like the bottom protuded metal that connects to the leg pins are dragging the base as i was pulling it. Making this job a lot more difficult than it should

    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • marioalmeida
    Level 10  
    the_ccm wrote:
    mosquitto_pub -t obk8D4419BF/1/get -m 0


    For get command, you need to subscribe instead of publish
  • brianandrus
    Level 5  
    I recently found they updated the circuit board inside the FEIT wifi dimmer switch to one that looks easier to get at and uses the BK7231TQN32 chip.

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

    Unfortunately, I am running into issues getting it to flash. I have been able to connect to RX2/TX2 and see the logs, and I can reset by grounding CEN. However, Beken Writer fails every time I try to read/write to it.

    I'm guessing I am overlooking something simple. Are there any steps beyond connecting the HW-597 and flashing? I'm starting to wonder if the pinouts on the board are not quite true to their labels.
  • omelchuk890
    Level 10  
    brianandrus wrote:
    Unfortunately, I am running into issues getting it to flash. I have been able to connect to RX2/TX2 and see the logs, and I can reset by grounding CEN. However, Beken Writer fails every time I try to read/write to it.

    https://www.elektroda.com/rtvforum/topic3875654.html
    Quote:
    From the bottom, we have prepared pads for programming signals, including:
    - UART1 port (programming via bootloader)
    - UART2 port (debug log output with information about what the device is doing)
    - SPI pins (programming if bootloader fails)
    - CEN pin (system reset)
  • Rob_bo
    Level 6  
    Hello,
    Can someone more experienced tell me how to send the same dinput to HA with OpenBK7231T, without setting a relay for them?
    My idea is that from a single relay on CB3S, apart from the configured dinput / relay (1), use 2 free pins (26 and 6), connect them to the switch and use them to control other "smart bulbs", but when setting only dinput on the next channels 2 and 3 (no relay for them), no HA script is generated for them.
    Of course, you can set the relaye to some of the pins, but somehow it seems not nice to me ;)
    Is there any other configuration to get the same dinput values in HA as a binary sensor, e.g.?
  • p.kaczmarek2
    Moderator Smart Home
    @marioalmeida repeating events has been extented. Currently supported commands:
    
    addRepeatingEvent [DelaySeconds] [Repeats] [Command With Spaces Allowed]
    addRepeatingEvent 5 -1 Power0 Toggle
    

    
    addRepeatingEventID [DelaySeconds] [Repeats] [UserIDInteger] [Command With Spaces Allowed]
    addRepeatingEventID 2 -1 123 Power0 Toggle
    

    
    cancelRepeatingEvent [UserIDInteger]
    


    marioalmeida wrote:
    the_ccm wrote:
    mosquitto_pub -t obk8D4419BF/1/get -m 0


    For get command, you need to subscribe instead of publish

    This is correct. You seem to be using MQTT incorrectly.

    ferbulous wrote:

    Thanks, i noticed that gold pin in the center, which tool did you use for this?

    Just a pliers, I might try to find some old GU10 bulbs and if they have the same construction I'll try to make a video or something

    Rob_bo wrote:

    Is there any other configuration to get the same dinput values in HA as a binary sensor, e.g.?

    you need only one pin - set it as dInput (digital input), on, for example, channel 0, and device will broadcast MQTT value every time it changes in "obk0696FB33/0/get" format.

    You can also script some things, for example:
    
    addChangeHandler Channel1 != 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20On
    

    You can also use Tasmota Device Groups.


    PS: The N platform crash is being fixed right now. Stability will improve soon.
  • Rob_bo
    Level 6  
    p.kaczmarek2 wrote:
    one pin is enough - set it as dInput (digital input), eg to channel 0, and the device will send the value MQTT every time it changes to the format "obk0696FB33 / 0 / get". Or you can write a few things, for example: Code: addChangeHandler Channel1! = 0 SendGet http://192.168.0.112/cm?cmnd=Power0%20On
    You can also use Tasmota device groups.


    Thanks for the hint!
    I understand that I do the configuration of the appropriate MQTT sensor in HA then manually - adding it to the generated script would be a great help.
    I will take the opportunity to ask if the device with OpenBK7231T can transmit the strength / quality of the WiFi signal?
  • p.kaczmarek2
    Moderator Smart Home
    Yaml is very easy to set up yourself. If you want to create it yourself, set Relay to a pin for the generation time and then remove it.

    There is a HAL_GetWifiStrength function in my HAL and MQTT publishes the result under the name "rssi" only it does it periodically as you enable the OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE flag. What do you need it for?
  • Rob_bo
    Level 6  
    p.kaczmarek2 wrote:
    Yaml is very easy to set up yourself. If you want to create it yourself, set Relay to a pin for the generation time and then remove it.

    Of course it is not difficult, so I just mentioned that if switches are generated, the sensors could also be used for convenience. But, of course, this is no obstacle, the device works without any problems:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    p.kaczmarek2 wrote:
    There is a HAL_GetWifiStrength function in my HAL and MQTT publishes the result under the name "rssi" only it does it periodically as you enable the OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE flag. What do you need it for?

    I knew you would ask :)
    I have 6 light bulbs in the garden, the farthest one with a really bad range, falling e.g. to -90 dB during rain. And on the other side of the house, in front of the entrance, a module (PIR / light level / 2 switches). That's why I'm still interfering with routers, I turned on rssi in my devices with ESPHome and it got easier, in Bekkens it would also be useful - thanks for the hint and, above all, for the implementation :)
    EDIT:
    I tested it on a switch, it worked and it stopped :(
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    The physical button-switch works, sometimes it appears on the router for a moment and disappears, silence in MQTT. A switch in a tin. . . after resetting the power supply, it found the network, we will see if the situation repeats.
  • p.kaczmarek2
    Moderator Smart Home
    And OpenBK7231T or OpenBK7231N?
    In OpenBK7231N we updated LWIP to improve stability about 2 days ago (after 1.12.75?), In OpenBK7231T it has not been updated yet.
    And is it pinging?

    Also the question is whether it is the fault of the software or just the router does not cope.

    Or maybe a hardware problem?
    https://www.elektroda.pl/rtvforum/topic3898805.html
    I had such a case once, after the repair it stopped sizzling and resets ...
  • Rob_bo
    Level 6  
    p.kaczmarek2 wrote:
    And OpenBK7231T or OpenBK7231N?
    In OpenBK7231N we updated LWIP to improve stability about 2 days ago (after 1.12.75?), In OpenBK7231T it has not been updated yet.
    And is it pinging?

    OpenBK7231N, 1.12.81. I reset so I will not check if it is pinging, if the situation repeats I will check.
    p.kaczmarek2 wrote:
    Also the question is whether it is the fault of the software or just the router does not cope.

    Or maybe a hardware problem?
    https://www.elektroda.pl/rtvforum/topic3898805.html
    I had such a case once, after the repair it stopped sizzling and resets ...


    I would rather choose soft due to the fact that it crashed for the first time after changing to 1.12.81 and setting OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE, after a few hours.
    At 1.12.6x and without a flag, it ran steadily, never crashed.
    I will test if it hangs, I will remove OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE and let me know what effect.
  • p.kaczmarek2
    Moderator Smart Home
    We have another fix for N but it's not in release yet, I'll call the build in a moment:
    https://github.com/openshwprojects/OpenBK7231N/pull/4
    Just N should increase the stability from the last days, because then the LWIP was improved.

    Check:
    https://github.com/openshwprojects/OpenBK7231T_App/releases/tag/1.12.83
    and let me know, because if necessary, I have to inform the contributor whether there is still a problem or not ...
  • Rob_bo
    Level 6  
    p.kaczmarek2 wrote:


    Check:
    https://github.com/openshwprojects/OpenBK7231T_App/releases/tag/1.12.83
    and let me know, because if necessary, I have to inform the contributor whether there is still a problem or not ...

    OpenBK7231N_1.12.84, OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE on, falls off non-stop, but gets up correctly.
    Next to it, two SmartDGM bulbs and its own module with ESPHome, all the time online, i.e. not Router.
    In the afternoon I will check without OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE, and if it doesn't help, I will confirm that 1.12.6x was stable.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
  • p.kaczmarek2
    Moderator Smart Home
    Thanks for testing. I handed over to the person dealing with the LWIP update. Do you have anything else in your configuration that might be important?

    The next version should be available within a few days and we keep testing.


    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Can you provide full logs from device, broker, router?
  • Rob_bo
    Level 6  
    p.kaczmarek2 wrote:
    Thanks for testing. I handed over to the person dealing with the LWIP update. Do you have anything else in your configuration that might be important?

    The next version should be available within a few days and we keep testing.


    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Can you provide full logs from device, broker, router?


    After turning off OBK_FLAG_MQTT_BROADCASTSELFSTATEPERMINUTE, the device on OpenBK7231N_1.12.84 works stably since yesterday, so we know where to look :)
    On the weekend I'll try to turn the flag back on and catch some logs
  • rupertst
    Level 6  
    Hi,
    I have problem with Domoticz and OpenBK7231T (latest version). I'm using it on WiFi lamp. The web app works fine on flag 3 enabled. There are two channels P9 and P8, one is brightness and second one is light temperature. You implemented homeassistent autodiscovery and it works with Domoticz plugin, but I think there is a bug. Domoticz find three switches: general ON/OFF and two PWM's. It sees the changes properly, but when I try to change them in Domoticz they become state "0". Here are the logs of my lamp after Domoticz command:

    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic cmnd/obk060D1E8D/led_dimmer
    Info:MQTT:MQTT in topic cmnd/obk060D1E8D/led_dimmer
    Info:CMD: dimmer (led_dimmer) received with args {"brightness":38,"state":"ON"}
    Info:MQTT:Publishing val 0 to obk060D1E8D/led_dimmer/get retain=0


    It receives brightness "38", but sets to "0"

    Domoticz publish something like this:
    cmnd/obk060D1E8D/led_dimmer = {"brightness":38,"state":"ON"}


    Maybe json format is improper, but You can not change it in Domoticz.
    Any ideas? Is it a bug?
    Thanks
  • ferbulous
    Level 15  
    @p.kaczmarek2 Thanks for the latest update and the new ha discovery

    Just some question on device on/off status after HA Restart
    Is this sufficient or do i need to enable other setting in general since it’s still unknown after restart?
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    Device group is not working for me. However the device is stable so far and no issues with it becoming unresponsive even after adding device group (tested on N device)

    I think you did mention i could add some command line to send on/off command to other tasmota device eg openbk relay 2 on, then send on command to tasmota device.
    Is there example for that?
  • svobodaelektroda
    Level 2  
    p.kaczmarek2 wrote:
    Before we proceed, can you try:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    channge P9 role to nothing and P8 to BL0937 CF1?

    Right now I suspect that you have chosen wrong pin for CF1 role and older version works for you because it always uses default pins.


    how to figure out which PIN should be set to which value?
    thank you
    Ondrej
  • p.kaczmarek2
    Moderator Smart Home
    @ferbulous this should answer your questions, right now it's polish but I will make translation soon:
    https://www.elektroda.pl/rtvforum/viewtopic.php?p=20230110#20230110 this is Tasmota Device Groups + OBK tutorial part 1

    @svobodaelektroda well, the best way is to look at the PCB and at the datasheets and follow the traces

    @rupertst are you using a custom fork of OpenBeken? I don't recognize this jSON.