logo elektroda
logo elektroda
X
logo elektroda

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

p.kaczmarek2 178083 1242
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #841 20130475
    p.kaczmarek2
    Moderator Smart Home
    There is currently no way to set it via command, but no problem, I can add it, if you want.

    Out of curiousity, why do you need to configure it via cmd?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #842 20130493
    marioalmeida
    Level 10  
    @p.kaczmarek2
    Its difficult for other users to change the state from different UI, my family is familiar with HA interface
    Currently I have manage to do it this way

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

    rest_command in configuration.yaml
    Code: YAML
    Log in, to see the code

    automation.yaml
    Code: YAML
    Log in, to see the code


    Added after 59 [minutes]:

    In file src/cmnds/cmd_eventHandlers.c, line number 15 it says this
    // addEventHandler OnChannelChanged 5 ???

    Based on that, I tried to set
    addEventHandler OnChannelChanged 1 setChannel 2 0

    but it says
    Info:EVENT:CMD_AddEventHandler: OnChannelChanged is not a valid event
  • #843 20130671
    p.kaczmarek2
    Moderator Smart Home
    I will need to create documentation for that (unless someone here wants to help?), but:
    
    setPinRole 10 Btn
    setPinChannel 10 0
    setPinRole 11 Btn
    setPinChannel 11 0
    setPinRole 26 PWM
    setPinChannel 26 1
    addEventHandler OnClick 10 setChannel 1 100
    addEventHandler OnHold 10 addChannel 1 10
    addEventHandler OnClick 11 setChannel 1 0
    addEventHandler OnHold 11 addChannel 1 -10
    
    //
    // On change listeners
    // Full example of on change listeners:
    // addChangeHandler Channel0 < 50 echo value is low
    // addChangeHandler Current > 100 setChannel 0 0
    // addChangeHandler Power > 40 setChannel 1 0
    //
    //
    // LCD demo:
    // backlog startDriver I2C; addI2CDevice_LCD_PCF8574 I2C1 0x23 0 0 0
    // addChangeHandler Channel1 != 0 backlog lcd_clearAndGoto I2C1 0x23 1 1; lcd_print I2C1 0x23 Enabled
    // addChangeHandler Channel1 == 0 backlog lcd_clearAndGoto I2C1 0x23 1 1; lcd_print I2C1 0x23 Disabled
    
    
    AddEventHandler OnClick 0 addChannel 1 -10 0 100 AddEventHandler OnClick 1 addChannel 1 10 0 100
    

    So I would say:
    
    addChangeHandler Channel0 == 0 echo "First channel is now ZERO"
    addChangeHandler Channel0 == 1 echo "First channel is now ONE"
    


    log of setting command in console:
    
    Debug:CMD:cmd [addChangeHandler Channel0 == 0 echo "First channel is now ZERO"]
    Info:EVENT:CMD_AddChangeHandler: added Channel0 with cmd echo "First channel is now ZERO"
    
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [addChangeHandler Channel0 == 1 echo "First channel is now ONE"]
    Info:EVENT:CMD_AddChangeHandler: added Channel0 with cmd echo "First channel is now ONE"
    

    Result while changing:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    NOTE: actually the "echo" command is not implemented yet, but still, you can see that command line receives it so let's say it work

    I will also add a responsiveness improvement soon
    Helpful post? Buy me a coffee.
  • #844 20130729
    marioalmeida
    Level 10  
    Thanks @p.kaczmarek2 , and this is how I have set countdown from HA.

    autoexec.bat
    
    // Relay is connected to pin 6
    setPinRole 6 Rel
    
    // Set external switch pin
    setPinRole 8 TglChanOnTgl
    
    // Set led pin
    setPinRole 9 LED
    
    // Set button pin
    setPinRole 26 Btn
    
    // Assign pin 6, 8, 9 and 26 to channel 1
    setPinChannel 6 1
    setPinChannel 8 1
    setPinChannel 9 1
    setPinChannel 26 1
    
    // Set countdown channel
    setChannelType 2 TextField
    
    // Set countdown channel(2) to 0 when channel 1 state is 0 or 1
    addChangeHandler Channel1 == 0 setChannel 2 0
    addChangeHandler Channel1 == 1 setChannel 2 0
    


    HA Configuration
    configuration.yaml
    Code: YAML
    Log in, to see the code


    Automation
    Code: YAML
    Log in, to see the code
  • ADVERTISEMENT
  • #845 20130742
    p.kaczmarek2
    Moderator Smart Home
    That's a very nice setup, you can consider posting this as a separate article with a brief explanation of how it works, so I can add a link to that from a Github.

    Is this a final version?

    I've been working on a small scripting backend for OpenBeken for a few weeks already (but only mostly on weekends), so soon it will be possible to write small programs to exec on our devices, with IF blocks, GOTOs, delays, etc.
    Helpful post? Buy me a coffee.
  • #846 20131171
    marioalmeida
    Level 10  
    p.kaczmarek2 wrote:
    That's a very nice setup, you can consider posting this as a separate article with a brief explanation of how it works, so I can add a link to that from a Github.

    Yes, I'll do a teardown post for this device

    p.kaczmarek2 wrote:
    Is this a final version?

    No, I'll post it along with the teardown.
    Is there a way to set a channel value from another channel?
    Is it possible to get feedback of addRepeatingEvent remaining seconds sent via MQTT?

    p.kaczmarek2 wrote:
    I've been working on a small scripting backend for OpenBeken for a few weeks already (but only mostly on weekends), so soon it will be possible to write small programs to exec on our devices, with IF blocks, GOTOs, delays, etc.

    Definitely would like see this
  • #847 20131373
    p.kaczmarek2
    Moderator Smart Home
    marioalmeida wrote:

    Yes, I'll do a teardown post for this device

    I'm eager to see it

    marioalmeida wrote:

    Is there a way to set a channel value from another channel?

    Right now no, but I can add this tomorrow in a very simple way.
    Would a syntax "$Channel0" for Channel0 value be ok?
    So:
    
    setChannel 2 $Channel0
    

    that would set channel 2 to current value from channel 0.

    marioalmeida wrote:

    Is it possible to get feedback of addRepeatingEvent remaining seconds sent via MQTT?

    What exactly would you like to receive and how? Please be more specific and I will look into it



    marioalmeida wrote:

    Definitely would like see this

    I am designing my own syntax and interpreter because I have a very specific idea for that and because I like C syntax. Here are screenshots from scripting unit tests that I already have working.
    Generic script execution testing:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    Abstract syntax tree testing:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    The scripts will be able to contain commands like "delaySeconds(15);" etc,
    Helpful post? Buy me a coffee.
  • #848 20131428
    marioalmeida
    Level 10  
    p.kaczmarek2 wrote:

    Would a syntax "$Channel0" for Channel0 value be ok?
    So:
    
    setChannel 2 $Channel0
    

    that would set channel 2 to current value from channel 0.

    Will that also be possible for addRepeatingEvent
    addRepeatingEvent $Channel0 1 setChannel 1 0
    This way I can use MQTT to set the countdown instead of HTTP API

    p.kaczmarek2 wrote:
    What exactly would you like to receive and how? Please be more specific and I will look into it

    Basically I need to know what is the remaining time left. In my case I am using it as countdown. So If I set to 1200 sec, I need to know how may seconds are left as they are decremented.
  • #849 20132282
    rupertst
    Level 7  
    Hi,
    How about Domoticz support? Do You plan including some settings of MQTT configuration like in Tasmota?
    Something like that:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    or maybe some autodiscovery support? It is also supported by Domoticz (at least it is written so, I did not tested)
  • #851 20136199
    p.kaczmarek2
    Moderator Smart Home
    @rupertst would you be able to test that Domoticz syntax? One user already asked for it so I have it on my list.

    marioalmeida wrote:

    Will that also be possible for addRepeatingEvent
    addRepeatingEvent $Channel0 1 setChannel 1 0
    This way I can use MQTT to set the countdown instead of HTTP API

    I am not sure if your idea is logically correct, but since today commit, every call to:
    Code: C / C++
    Log in, to see the code

    supports following three syntaxes:
    - simple decimal number - 1234 etc
    - hex number - 0xFF
    - constant value - $CH0 for channel 0, $CH1 for channel 1, etc. It will return current channel value as integer
    Right now I am not sure if it's a final solution, but I don't see how it could break things. Still, report to me if there is any issue with that.

    NOTE: the syntax is evaluated at the time when you enter the command in the commandline!

    It would be much harder for it to be evalulated at runtime.

    If you need to get a channel value at runtime, wait for the "scripting" update that is coming soon.

    Demonstration:
    Quote:

    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [SetChannel 13 2022]
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [GetChannel 13]
    Info:CMD:CMD_GetChannel: channel 13 is 2022
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [SetChannel 12 $CH13]
    Debug:API:POST to api/cmnd
    Debug:CMD:cmd [GetChannel 12]
    Info:CMD:CMD_GetChannel: channel 12 is 2022
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #852 20138288
    Tych0
    Level 6  
    Some of my lights have to start with a default brightness and color when powered on. I use a startup command for that. This works just fine.
    But when the light ia on and I change the brightness and/or color in HA. Turn off the light (cut power). And turn it on again. The light starts with the brightness and color as I configured it in the strap command. But... HA still shows the brightness and color that I changed in the GUI before I turned it off.
    I noticed the temp and dimmer messages in the MQTT state topic are not updated when the light is completely booted. Do I need to change something, misconfigured anything? Or is this a feature request?
  • #853 20138478
    p.kaczmarek2
    Moderator Smart Home
    @Tych0 maybe you are referring to LED state change MQTT feedback?
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    if not, specify how do you drive your lights and show the HA yaml config.
    Helpful post? Buy me a coffee.
  • #854 20138898
    rcayadi
    Level 6  
    Hi All,

    I'm new to try flash smart breaker from brand BARDI (indonesia brand) https://bardi.co.id/products/on-off-breaker-sb-10a-nem/ they using WB2S , the flash is going OK and im using
    P24 - Rel
    P6 - Btn
    P7 - LED (but this led is on when OFF and led off wen ON) how to solve this?

    and then the wifi connection is offline immediately ? first i thought that about limited user in my router but it going off after i try off some wifi it's still happen. This flash device not offline immediately before i configure module. How to solved this
  • ADVERTISEMENT
  • #855 20138945
    p.kaczmarek2
    Moderator Smart Home
    rcayadi wrote:

    P7 - LED (but this led is on when OFF and led off wen ON) how to solve this?

    Use LED_n option, which is an inverted LED. Same goes for REL (if you want), there is a REL_N option.

    rcayadi wrote:

    and then the wifi connection is offline immediately ? first i thought that about limited user in my router but it going off after i try off some wifi it's still happen.

    I am not sure what you mean. Is the device still pingable? Is the device responding to the Button, but offline? Or maybe is the device 100% dead?

    I will double check this with my WB2S modules when I come back to home today.
    Helpful post? Buy me a coffee.
  • #856 20139348
    rcayadi
    Level 6  
    p.kaczmarek2 wrote:

    Use LED_n option, which is an inverted LED. Same goes for REL (if you want), there is a REL_N option.


    Thx now its working correctly
    P6 - Btn
    P7 - Led_n
    P24 - Rel

    p.kaczmarek2 wrote:

    I am not sure what you mean. Is the device still pingable? Is the device responding to the Button, but offline? Or maybe is the device 100% dead?


    Device is pingable if i power off then on the device then it will not pingable randomly about a 10sec to xx sec .

    The strange is if i could reach the device via browser http://openbekendeviceIP/index and it trigger the device to on/off it not down anymore and stable working . now i try to figure out what happen so the device is not pingable . any log i can look?

    Build on Aug 6 2022 17:35:36 version 1.0.0
    Online for 21 minutes and 1 seconds
    Device MAC: XXXXXXX
    Short name: obk66C08C6A, Chipset BK7231T
  • #857 20139467
    p.kaczmarek2
    Moderator Smart Home
    Can you try latest version (update OTA, by WiFi to latest build for your platform - do not chose wrong platform!)?
    Helpful post? Buy me a coffee.
  • #858 20139642
    Tych0
    Level 6  
    p.kaczmarek2 wrote:
    if not, specify how do you drive your lights and show the HA yaml config.

    I've set flag 0 but that doesn't fix the issue. I assume, and makes sense, that the startup command is executed before the module has connected to the WiFi and MQTT and therefore does not send the new state message.
    YAML light configuration example I use for a CW light:
      - platform: mqtt
        name: "obk06B22AC7"
        unique_id: "obk06B22AC7"
        command_topic: "cmnd/obk06B22AC7/led_enableAll"
        state_topic: "obk06B22AC7/led_enableAll/get"
        availability_topic: "obk06B22AC7/connected"
        payload_on: 1
        payload_off: 0
        brightness_command_topic: "cmnd/obk06B22AC7/led_dimmer"
        brightness_scale: 100
        brightness_state_topic: "obk06B22AC7/led_dimmer/get"
        brightness_value_template: "{{value}}"
        color_temp_command_topic: "cmnd/obk06B22AC7/led_temperature"
        color_temp_state_topic: "obk06B22AC7/led_temperature/get"
        optimistic: true
        retain: false

    My 2 cents... when we are using a startup command to change the channel values. A state message should be send when the device is connected to WiFi and MQTT.
  • #859 20139753
    p.kaczmarek2
    Moderator Smart Home
    I know what's wrong. The "publish all self state" mechanism on MQTT connect does not include LED driver.

    I will fix that tomorrow, will you be able to test that?
    Helpful post? Buy me a coffee.
  • #860 20139822
    skylineh44
    Level 4  
    Hi -I thought I'd share my config of an Australian plug/socket with power management The make and model are:

    Brilliant Smart
    20925 Series II

    The chip is BK7231T and the board is a WB2S-V1
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    When I copied the Home assistant MQTT set-up the device showed up fine but the switch was inversed so I changed the relay to be rel_n. It is inverted in the browser but correct in HA. Any idea's why. *** Edit - I changed the Relay bck to Rel and inverted the HA MQTT switch!

    Also, I'm a bit confused as to how the power management (BL0937) is working. The menu page shows 2 drivers? Why not just 1?
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    Also, while the power measurement is correct the display of the current is not (it just looks like a count). Below is a snap from my MQTT explorer.

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

    ** Edit - I don't seem to be able to calibrate the BL0937, I'm getting "command not found"?

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

    Same for VoltageSet and PowerSet and CurrentSet.

    Added after 5 [hours] 17 [minutes]:

    ...for those reading the above, I've also managed to resolve my issue in calibration. I used the 192.168.xxx.xxx/app not the embeded web interface. (Although you have to go back to the units interface to update the "Change startup command text" with the new calibration values.

    I was going through a bunch of devices to localize them by changing the board for an ESP one when i came across this work, I'll have to keep an eye open to see if this develops (hopefully it does)!

    Anyway, all working now and thanks to all who have contributed to this. All hail those who are good at programming! :please: .
  • #861 20140308
    p.kaczmarek2
    Moderator Smart Home
    @Tych0 I am working on the feature you requested, but right now I can't get it working perfectly.
    Here is the update that will send current LED color/state/dimmer/temp when MQTT connects:
    https://github.com/openshwprojects/OpenBK7231T_App/releases/tag/1.12.25
    I have a RGBCW bulb with a setting of RED color in startup command, but it seems that my Home Assistant overwrites the change (bulb is red after restart but after connecting to HA it's white again).
    Here is my full log:
    Quote:



    Info:MAIN:Module reboot in 1...

    Debug:CMD:Adding command SetPinRole
    Debug:CMD:Adding command SetPinChannel
    Debug:CMD:Adding command GetChannel
    Debug:CMD:Adding command GetReadings
    Debug:CMD:Adding command ShortName
    Debug:CMD:Adding command AddEventHandler
    Debug:CMD:Adding command AddChangeHandler
    Debug:CMD:Adding command listEvents
    Debug:CMD:Adding command restart
    Debug:CMD:Adding command clearConfig
    Debug:CMD:cmd [backlog led_basecolor_rgb FF0000; led_enableAll 1;]
    Debug:CMD:backlog [led_basecolor_rgb FF0000; led_enableAll 1;]
    Debug:CMD:cmd [led_basecolor_rgb FF0000]
    Debug:CMD: BASECOLOR got FF0000
    Info:GEN:CHANNEL_Set channel 1 has changed to 100 (flags 2)


    Info:GEN:No change in channel 2 (still set to 0) - ignoring


    Info:GEN:No change in channel 3 (still set to 0) - ignoring


    Info:GEN:No change in channel 4 (still set to 0) - ignoring


    Info:GEN:No change in channel 5 (still set to 0) - ignoring


    Debug:CMD:cmd [led_enableAll 1]
    Info:CMD: enableAll (led_enableAll) received with args 1
    Info:GEN:No change in channel 1 (still set to 100) - ignoring


    Info:GEN:No change in channel 2 (still set to 0) - ignoring


    Info:GEN:No change in channel 3 (still set to 0) - ignoring


    Info:GEN:No change in channel 4 (still set to 0) - ignoring


    Info:GEN:No change in channel 5 (still set to 0) - ignoring


    Debug:CMD:backlog executed 2
    Debug:CMD:cmd [exec autoexec.bat]
    Debug:CMD:exec autoexec.bat
    Error:CMD:lfs is absent
    Info:GEN:PIN_SetupPins pins have been set up.

    Debug:MAIN:started timer

    Info:MAIN:Time 1, free 94728, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 2, free 94728, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 3, free 94728, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 4, free 94728, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 5, free 94728, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Debug:MAIN:Registered for wifi changes

    Info:MAIN:Time 6, free 90744, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 7, free 90744, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 8, free 90744, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:wl_status 3

    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING

    Info:MAIN:Time 9, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 10, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=38:1f:8d:38:57:0e

    Info:MQTT:mqtt_userName homeassistant
    mqtt_pass Ripee5iaRaiph4Zoo8phee4Ahf5Gooquaeg3ohdaj9ahcah1eiKoosh8AhT9ooja
    mqtt_clientID obk8D38570E
    mqtt_host 192.168.0.121:1883

    Info:MQTT:Connect error in mqtt_client_connect - code: -4

    Info:MAIN:Time 11, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 12, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 13, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 14, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 15, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 16, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 17, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 18, free 90568, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:wl_status 9

    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_AUTH_FAILED

    Info:MAIN:Time 19, free 89288, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 20, free 89288, MQTT 0, bWifi 0, secondsWithNoPing 0, socks 2/38

    Info:GEN:dhcp=0 ip=0.0.0.0 gate=0.0.0.0 mask=0.0.0.0 mac=38:1f:8d:38:57:0e

    Info:MAIN:wl_status 3

    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTING

    Info:MAIN:wl_status 10

    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED

    Info:MAIN:wl_status 11

    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED

    Info:MAIN:Time 21, free 89920, MQTT 0, bWifi 1, secondsWithNoPing 0, socks 2/38

    Info:MQTT:mqtt_userName homeassistant
    mqtt_pass Ripee5iaRaiph4Zoo8phee4Ahf5Gooquaeg3ohdaj9ahcah1eiKoosh8AhT9ooja
    mqtt_clientID obk8D38570E
    mqtt_host 192.168.0.121:1883

    Info:MAIN:Time 22, free 89960, MQTT 0, bWifi 1, secondsWithNoPing 0, socks 2/38

    Info:MQTT:mqtt_connection_cb: Successfully connected

    Info:MQTT:mqtt_subscribed to obk8D38570E/+/set

    Info:MQTT:mqtt_subscribed to cmnd/obk8D38570E/+

    Info:MQTT:mqtt_publish requies 31, has 1024
    Info:MQTT:MQTT client "obk8D38570E" request cb: err 0

    Info:MQTT:MQTT client "obk8D38570E" request cb: err 0

    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic cmnd/obk8D38570E/led_enableAll

    Info:MQTT:MQTT in topic cmnd/obk8D38570E/led_enableAll
    Info:CMD: enableAll (led_enableAll) received with args 1
    Info:GEN:No change in channel 1 (still set to 100) - ignoring


    Info:GEN:No change in channel 2 (still set to 0) - ignoring


    Info:GEN:No change in channel 3 (still set to 0) - ignoring


    Info:GEN:No change in channel 4 (still set to 0) - ignoring


    Info:GEN:No change in channel 5 (still set to 0) - ignoring


    Info:MQTT:Publishing led_enableAll = 1

    Info:MQTT:mqtt_publish requies 34, has 1024
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic cmnd/obk8D38570E/led_dimmer

    Info:MQTT:MQTT in topic cmnd/obk8D38570E/led_dimmer
    Info:CMD: dimmer (led_dimmer) received with args 78
    Info:GEN:CHANNEL_Set channel 1 has changed to 78 (flags 2)


    Info:GEN:No change in channel 2 (still set to 0) - ignoring


    Info:GEN:No change in channel 3 (still set to 0) - ignoring


    Info:GEN:No change in channel 4 (still set to 0) - ignoring


    Info:GEN:No change in channel 5 (still set to 0) - ignoring


    Info:MQTT:Publishing led_dimmer = 78

    Info:MQTT:mqtt_publish requies 32, has 1024
    Info:MQTT:Publishing led_basecolor_rgb = FF0000

    Info:MQTT:mqtt_publish requies 43, has 1024
    Info:MQTT:Publishing led_finalcolor_rgb = C60000

    Info:MQTT:mqtt_publish requies 44, has 1024
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic cmnd/obk8D38570E/led_basecolor_rgb

    Info:MQTT:MQTT in topic cmnd/obk8D38570E/led_basecolor_rgb
    Debug:CMD: BASECOLOR got ffffff
    Info:GEN:No change in channel 1 (still set to 78) - ignoring


    Info:GEN:CHANNEL_Set channel 2 has changed to 78 (flags 2)


    Info:GEN:CHANNEL_Set channel 3 has changed to 78 (flags 2)


    Info:GEN:No change in channel 4 (still set to 0) - ignoring


    Info:GEN:No change in channel 5 (still set to 0) - ignoring


    Info:MQTT:Publishing led_basecolor_rgb = FFFFFF

    Info:MQTT:mqtt_publish requies 43, has 1024
    Info:MQTT:Publishing led_dimmer = 78

    Info:MQTT:mqtt_publish requies 32, has 1024
    Info:MQTT:Publishing led_finalcolor_rgb = C6C6C6

    Info:MQTT:mqtt_publish requies 44, has 1024
    Info:MAIN:Time 23, free 89960, MQTT 1, bWifi 1, secondsWithNoPing 0, socks 2/38

    Info:MAIN:Time 24, free 89960, MQTT 1, bWifi 1, secondsWithNoPing 0, socks 2/38

    Info:MQTT:Publishing host = obk8D38570E

    Info:MQTT:mqtt_publish requies 31, has 1024
    Info:MQTT:[g_bPublishAllStatesNow] item -12 result 0

    Info:MAIN:Time 25, free 89960, MQTT 1, bWifi 1, secondsWithNoPing 0, socks 2/38

    Look, my device does publish self color, red:
    Quote:

    Info:MQTT:mqtt_publish requies 32, has 1024
    Info:MQTT:Publishing led_basecolor_rgb = FF0000

    Info:MQTT:mqtt_publish requies 43, has 1024
    Info:MQTT:Publishing led_finalcolor_rgb = C60000

    but HA still overwrites it:
    Quote:

    Info:MQTT:mqtt_publish requies 44, has 1024
    Info:MQTT:MQTT client in mqtt_incoming_publish_cb topic cmnd/obk8D38570E/led_basecolor_rgb
    Info:MQTT:MQTT in topic cmnd/obk8D38570E/led_basecolor_rgb
    Debug:CMD: BASECOLOR got ffffff

    Can you check your device, do you also experience same issue?

    @skylineh44 I think the "VoltageSet" etc commands are missing because you have not initialized the driver.
    Why do you have 2 drivers running and the interface twice? Have you started both BL0942 and BL0937 together? You should use only one.

    I will change the current WWW panel code to display the list of drivers that are running...
    Helpful post? Buy me a coffee.
  • #862 20140429
    skylineh44
    Level 4  
    Whilst trying to get the unit configured i did explore some preset examples (which had the different power monitoring chip). This would go someway to explain the multiple drivers. However, I tried to get back to a datum by using the 'Empty' template but maybe it doesn't eradicate all previous settings for the pins/drivers, or maybe I failed to do this correctly.

    As for the VoltageSet command. I have preceeded this command with the "startDriver BL0937" cmd which works fine, but then non of the 3 power calibration commands is understood. As I mentioned in my edit, it works fine the in /app

    Added after 17 [minutes]:

    Here's another device to add to the list. An Arlec powerboard P/N PB4KSHA Series 2. A simple 4 way powerboard with one push button and 1 relay.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant [img-2] [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

    And here is the configuration:

    [img-0]

    Again I de-soldered the WB2S module, it takes only a few minutes with a soldering iron and some copper braid! :D

    No fancy power monitoring in this product (Only $22 in Bunnings). Internal wiring and some of the components are a bit dodgy. Not a quality piece of hardware, but what can i expect at this price. I would not use on a heavy load, never mind the claimed 10A.
  • #863 20141234
    Tych0
    Level 6  
    p.kaczmarek2 wrote:
    Can you check your device, do you also experience same issue?

    I've noticed the same behaviour on a RGB light. And if I remember correctly, solved it by clearing the cmnd topic for that specific device. I don't use the retain flag on cmnd messages. But still the device seem to pick them up...

    The 1.12.25 release does seem to work just fine on a CW only light I just checked. Very nice, thank you!

    I also noticed, when I change temp and/or color in HA, a led_basecolor_rgb message (get = FFFFFF) is published in the state topic of my CW light. I don't expect that at all...
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    I'll do some tests on a RGBCW device tomorrow.
  • #864 20141294
    p.kaczmarek2
    Moderator Smart Home
    skylineh44 wrote:
    This would go someway to explain the multiple drivers.

    Thanks to your testing I decided to add a display of active drivers in order to help users with configuration:
    https://github.com/openshwprojects/OpenBK7231...mmit/97f873f374de4c81c63bfb17a510f898e5a7c7a7
    Is there anything else I could add?


    Tych0 wrote:

    I've noticed the same behaviour on a RGB light. And if I remember correctly, solved it by clearing the cmnd topic for that specific device. I don't use the retain flag on cmnd messages. But still the device seem to pick them up...

    I am not sure what you mean by "clearing the cmnd topic". The reporting back of color when it changes was requested by some user some time ago. There is also led_finalcolor_rgb


    Tych0 wrote:

    I also noticed, when I change temp and/or color in HA, a led_basecolor_rgb message (get = FFFFFF) is published in the state topic of my CW light. I don't expect that at all...

    I am aware about it from the start, that's because I had no CW lights for testing and the API is common for all light types. It should be very easy to fix, just add a condition if PWMcount == 2 then don't send RGB. It's just that I don't have all possible light types (RGB, single-color, RGBCW, CW or maybe RGBW....) at hand so it's hard for me to check all possible cases

    I think we can sort it out tomorrow, but we both will need to test the updated version

    EDIT: how is your CW light configured? Do you have 3 dummy channels for RGB (or dummy PWMs?) and 4-5 are CW, or just 2 channels (2 PWMs)?

    EDIT2: Do you have "broadcast led parameters together" flag set?
    Helpful post? Buy me a coffee.
  • #865 20141342
    rcayadi
    Level 6  
    The condition now is stable and work correctly in HA also.

    Now i want to try update
    p.kaczmarek2 wrote:
    Can you try latest version (update OTA, by WiFi to latest build for your platform - do not chose wrong platform!)?


    is i can using this https://github.com/openshwprojects/OpenBK7231T_App/releases or must compile it by myself in my laptop as before
  • #866 20141343
    skylineh44
    Level 4  
    p.kaczmarek2 wrote:
    Is there anything else I could add?


    I updated to the latest version via OTA. And the driver is now listed - thanks.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    The 3 calibration commands are still "unknown"

    Another minor issue in the/ app is that when I issue the VoltageSet command it responds with "CurrentSet". It does this for all 3 of the commands. Here is a cut/paste of the 2 lines in the log:

    Debug:CMD:cmd [VoltageSet 243]

    Info:EnergyMeter:CurrentSet: you gave 243.000000, set ref to 0.140706

    One issue that would make finding the correct pinouts easier is some sort of test templates. Maybe they can be put in the "Quick Config" section and pinned to the top of the dropdown. Similar to what Tasmota has here:

    https://tasmota.github.io/docs/Configuration-...edure-for-New-Devices/#creating-your-template

    Templates for finding the relays, LED's, Buttons/GPIO's would be useful and time saving!
  • #867 20141540
    p.kaczmarek2
    Moderator Smart Home
    skylineh44 wrote:

    Debug:CMD:cmd [VoltageSet 243]

    Info:EnergyMeter:CurrentSet: you gave 243.000000, set ref to 0.140706

    Ouh, I'm sorry, it's my copy/paste error. Should be fixed in:
    https://github.com/openshwprojects/OpenBK7231...mmit/9acd5bb256d59196d5941c29a05371c0523eb7a7
    thanks for reporting.

    I am still not sure what you mean by missing commands.
    Here are the BL0937 supported ones:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    skylineh44 wrote:

    Templates for finding the relays, LED's, Buttons/GPIO's would be useful and time saving!

    We're working on it

    rcayadi wrote:

    is i can using this https://github.com/openshwprojects/OpenBK7231T_App/releases or must compile it by myself in my laptop as before

    Right now I am doing release with almost every change. Just remember - if you don't really need to update, don't update, because there in some rare cases might be new bugs.
    Helpful post? Buy me a coffee.
  • #868 20141890
    skylineh44
    Level 4  
    p.kaczmarek2 wrote:
    skylineh44 wrote:

    Debug:CMD:cmd [VoltageSet 243]

    I am still not sure what you mean by missing commands.
    Here are the BL0937 supported ones:
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant


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

    This is what I am referring to, I thought putting the command here would work?
  • #869 20144086
    Tych0
    Level 6  
    p.kaczmarek2 wrote:
    I am not sure what you mean by "clearing the cmnd topic".

    I experienced the same issue. But when I disabled MQTT (by changing the MQTT server address on the device to a non-existing IP) the issue disappeared. So, I assumed it had to be an MQTT 'thing'. After removing the cmnd topic (using MQTT Explorer) for that specific device, everything was playing nice.

    p.kaczmarek2 wrote:
    I think we can sort it out tomorrow, but we both will need to test the updated version

    I did test the version you made available yesterday, 1.2.25 I think, and could not re-produce the issue. The device nicely send the state messages and HA got aware of it and updated the status. Thx for that.

    p.kaczmarek2 wrote:
    EDIT: how is your CW light configured? Do you have 3 dummy channels for RGB (or dummy PWMs?) and 4-5 are CW, or just 2 channels (2 PWMs)?

    2 channels. Only 4 and 5 for CW.

    p.kaczmarek2 wrote:
    EDIT2: Do you have "broadcast led parameters together" flag set?

    Yes I did. But for my CW light it should not send 'YourDevName/led_basecolor_rgb/get'. So the suggested fix could fix that ;)
  • #870 20146052
    p.kaczmarek2
    Moderator Smart Home
    I have added a small new feature to LED driver - support for CW lights where one PWM control brightness and second PWM controls light temperature (cold and warm together)
    https://github.com/openshwprojects/OpenBK7231...mmit/55c308813cb1a5a49a859bf3abe90c89ffb90836
    Do anyone here have such light? It's a different approach then the lights using one PWM for warm and second for cold white.
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant
    [BK7231T] My HTTP server, configurator, MQTT support from Home Assistant

    @Tych0 it should be fixed now, but to be honest, I have no idea how you managed to get CW light working in earlier version without setting dummy PWMs for RGB, the correct solution has been added just today and still it's not a final one as I don't have such light to test....

    I really need to get more test devices.
    Helpful post? Buy me a coffee.

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