logo elektroda
logo elektroda
X
logo elektroda

[Solved] LVL BK7231T light into Homeassistant

zebrahosting 1611 17
Best answers

How can I get an OpenBK7231T Tuya LVL ceiling light with PWM-controlled channels to show up correctly in Home Assistant again?

Use Home Assistant MQTT discovery instead of the empty text field, and do not leave the device in the debug/raw PWM mode. Flag 3 (“show raw PWM controls”) is for development only; it disables normal LED mode and breaks MQTT/HA discovery, so turn it off [#20835151][#20838559] If the two sliders are working in the web UI but brightness and color temperature behave wrong, swap the two PWM channel indexes and enable the “alternate CW mode” flag [#20838044][#20838559] In alternate CW mode, the first PWM is warm/cool and the second is brightness, and one PWM may need to be changed to PWM_n if a channel is inverted [#20838044][#20838559] After disabling flag 3 and using the correct channel order/alternate CW mode, the device reported working again and HA config reappeared [#20838600]
Generated by the language model.
ADVERTISEMENT
  • #1 20834988
    zebrahosting
    Level 3  
    Posts: 12

    I have multiple Tuya LVL ceiling lights. I flashed one with Cloudcutter, then installed the OpenBK7231T firmware and got the web interface.
    With the testing of the pins, I found pin 6 and 7 (channel 56/57) to respond to the relays testing. Changed them to PWM and can control brightness and color temp, perfect.
    But the issue I have is connecting to Home Assistant:
    When it was set in test mode with the REL settings for the pins, I was able to create a YAML file. After I changed them to PWM, the HA code window remains empty.

    With REL setting I get:
    mqtt:
    switch:
    - unique_id: "Light_Guestroom_2_relay_56"
    name: 56
    state_topic: "Light-G2/56/get"
    command_topic: "Light-G2/56/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: true
    availability:
    - topic: "Light-G2/connected"
    - unique_id: "Light_Guestroom_2_relay_57"
    name: 57
    state_topic: "Light-G2/57/get"
    command_topic: "Light-G2/57/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: true
    availability:
    - topic: "Light-G2/connected"

    Any suggestion to make this work again?
    BTW in Tasmota I can also import the device but it does not go well into HA.

    Bastiaan
  • ADVERTISEMENT
  • Helpful post
    #2 20835151
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Hello, the text field is deprecated, it can be empty, you just need to use HA discovery that way:


    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20835438
    zebrahosting
    Level 3  
    Posts: 12

    Yes, I watched all videos but I have to explain again:

    When the device channels are set to relays, MQTT works and HA also picks them up.
    But when I put the pins/channels to PWM so I see the sliders in the web interface (and everything just works), I cannot get the right info to MQTT, nor does HA pick this up.
    I have MQTT Explorer open to check, but the dim values are not coming in.
  • ADVERTISEMENT
  • #4 20835673
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Are you sure? It worked for me many times, and it worked when I tested it right now, albeit in simulator:
    LED lighting circuit simulation with buttons for brightness and temperature adjustment.
    Screenshot of the WinTest_00000000 software interface showing buttons and sliders for light management.
    In HA:
    Screenshot of a light control interface with brightness set to 64%.
    App interface showing WT00000000 light set to 89%
    Discovery happens:
    Screenshot of system logs showing messages related to MQTT communication and device configuration.
    What HA got:
    Code: YAML
    Log in, to see the code

    Dev cfg:
    LED configuration table for a device in developer mode.
    Helpful post? Buy me a coffee.
  • #5 20836517
    zebrahosting
    Level 3  
    Posts: 12

    It's probably a mistake on my side, but this is the first time I'm using this firmware, but I will have to do many more when I get it properly working.
    For security, I set up a new MQTT broker. This keeps it simple to monitor.
    I have only set two pins because they reacted on the real testing. I see you use button options, and when I test those, the light does not work, but I see dimmer commands in the broker.

    Sharing my settings:
    Screenshot of Light Guestroom 2 software settings with sliders, connection information, and buttons for configuration. MQTT device configuration with IP address and software version. User interface displaying device PWM channel settings. A screenshot showing network device information for Light-G2, displaying connection status, free memory, IP address, RSSI, number of sockets, network SSID, and uptime. Pin configuration for BK7231N/BK7231T device with PWM values.

    ==============
    Just to add to this:
    I am testing the LVL softlights, WiFi / Tuya, and no buttons. I have installed the new firmware over the air, and it all works.
    Illustration of a round LVL ceiling light with WiFi features, compatible with Amazon Alexa and Google Assistant.
  • #6 20836805
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Can you please try to set the channels of PWMs to 0 and 1, like on my side?

    Added after 1 [minutes]:

    PS: I am using a button GPIO role because I have a physical buttons on the device. Or at least, simulated physical buttons... your lamp doesn't seem to have physical buttons, so no problem with that.
    Helpful post? Buy me a coffee.
  • #7 20837114
    zebrahosting
    Level 3  
    Posts: 12

    Getting closer :-)
    Setting 0 and 1 did not affect the controls in the webpage but in MQTT I now see the led_dimmer and led_temperature but the values don't seem to come through, they don't match changes from the web interface.
    However, I am able to send SET commands. Those work for the dimmer but sending a value to the led_temperature changes the brightness (on channel 0)
  • #8 20837180
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Those controls on the web page... by any chance, do you have set "Show raw PWM controls" in flags? It's not set by default, so that would be strange, but still, it's worth to check this out.
    Helpful post? Buy me a coffee.
  • #9 20837191
    zebrahosting
    Level 3  
    Posts: 12

    Yes, I had it set and removed it. Now the sliders give a different image, but the temperature slider now controls the dimmer. For security, my flag settings:
    Screenshot of flag settings for a lighting control system in a guest room with various control options.
  • ADVERTISEMENT
  • #10 20837258
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Did you enable it yourself? Or did you apply some template?

    Is the device functional now, or is something more missing?
    Helpful post? Buy me a coffee.
  • #11 20838036
    zebrahosting
    Level 3  
    Posts: 12

    When things did not work, I have been playing with the flags (my bad). It would be nice to have a 'back to default' button.
    The state now, after changing the flag you mentioned:

    The web interface shows both sliders, with the bottom one having color temperature attributes. Unfortunately, it no longer works as a color temperature setting, but it seems to affect brightness too.
    In MQTT, I see the details coming through, which is great. Brightness ranges from 1-100 and color temperature ranges from 500-154 (but affecting brightness as mentioned above).
    I have switched some flags off, but there must be a mistake somewhere.

    In the HA window, it now displays the HA config again. So, in short, we're nearly there, I would say. Just the color temperature slider is not controlling the right way, everything else seems on track.

    With Flag 3 enabled, the controls work as expected, but everything else does not. It's best to keep it disabled, but then the color temperature slide does not work.

    Console for managing settings of device Light Guestroom 2 with a list of flags and their descriptions. Network interface with LED brightness and color temperature controls. Screenshot of a web interface displaying settings for interfaces P0-P12. Web interface with brightness and LED color temperature sliders.
  • #12 20838044
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    I think I know what may be wrong... it's the thing we've spoke about on our video:




    I suspect your device is using alternative CW control, which means one PWM is literally the brightness and second is literally the color temperature, as opposed to situation where one slider is cool color and second is warm.

    You need to enable the "alternate CW mode" in the device flags.

    Futhermore, you may need later to change one of the PWMs to PWM_n (inverted), depending on your device.

    Can you also attach here Tuya config as shown on this video:
    https://www.youtube.com/watch?v=WunlqIMAdgw&ab_channel=Elektrodacom
    Helpful post? Buy me a coffee.
  • #13 20838058
    zebrahosting
    Level 3  
    Posts: 12

    Yes, I tried the alternate already and it does not make a difference. The strange thing is that with the flag 3 enabled, the colortemp is controlled normally (and yes, with the two sliders working independently). There must be a way to get this right, that's clear. Just missing the magic last touch.

    When done, I will try to make a full report and files for the next person trying to flash this. But remember, I had no need for teardowns, all done over WiFi, so is the Tuya info still there in some partition?
  • #14 20838303
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Yes, the partition is still there. That' s the best thing about OBK, it's designed to keep that data there in place. Just follow the video and it will work.



    It seems that we need to start with the basics. Enable back "show raw pwm controls" so you get two PWM sliders and check - what does affect each of the sliders?
    a) is one slider then a brightness, and second is temperature?
    b) or is one slider cool white and second is warm white?

    If that's option a), then maybe you need to swap channel indexes?

    Look, for flag 8:
    Screenshot of control panel with LED debugging flags.
    You need two PWMs, but their order matters. Maybe you have them swapped? Maybe you need to swap channels? Replace 0 with 1 and 1 with 0?
    Helpful post? Buy me a coffee.
  • #15 20838492
    zebrahosting
    Level 3  
    Posts: 12

    Thought I have been pretty clear but let me try again:

    Web interface:
    With Flag 3 enabled, I get two sliders. The top one is brightness, the lower one is colortemp. Both work as expected. If I switch Flag 3 off, I get more fancy sliders but the colortemp slider does not change the color but affects the brightness.

    MQTT:
    If I set Flag 3 on, I don't get any MQTT values sent through. Not for led_dimmer, not for led_color. If I switch it off, it works again. Flag 3 is killing my MQTT and also has an effect on the HA setup (not showing anymore)
  • #16 20838559
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    zebrahosting wrote:

    MQTT:
    If I set Flag 3 on, I dont get any mqtt values send through. Not for led_dimmer not for led_color. If I switch it off, it works again. Flag 3 is killing my MQTT and also has an effect on the HA setup (not showing anymore)

    Flag 3 is "show raw PWM controllers", it's supposed to disable LED mode. It is for development test only, not for production.

    zebrahosting wrote:

    With Flag 3 enabled I get two sliders. Top one is brightness, lower one is colortemp. Both work as expected.

    This is raw PWMs mode, only used for testing.

    zebrahosting wrote:

    If i switch Flag 3 off, I get more fancy sliders but the colortemp slider does not change the color but affects the brightness.

    This is now as expected, because, as I said earlier:
    p.kaczmarek2 wrote:

    If that's option a), then maybe you need to swap channel indexes?

    Look, for flag 8:
    Screenshot of control panel with LED debugging flags.
    You need two PWMs, but their order matters. Maybe you have them swapped? Maybe you need to swap channels? Replace 0 with 1 and 1 with 0?


    Your device is using alternate CW mode. In alternate CW mode, first PWM is warm/cool, second is brightness.

    You are saying that you have first slider which is brightness, and second is warm/cool.

    That means you need to:
    1. first swap channels, so warm/cool is first, and brightness is second
    2. then disable debug flag 3 called "show raw PWMs"
    3. then enable alternate CW mode (flag 8)
    4. Then, if something is inverted, like warm is inverted with warm, you may need to change one of PWM roles to PWM_n ...
    Helpful post? Buy me a coffee.
  • #17 20838600
    zebrahosting
    Level 3  
    Posts: 12

    OK checked and working now. I never saw anywhere that flag 3 was for dev but thanks for hanging on and helping out. Next I will download the firmware when I have time and make a description. Nice to see it working and respect for all the work done.
  • #18 20838602
    zebrahosting
    Level 3  
    Posts: 12
    With great support and patience, the right module setting / flags made it work. Just 15 more to flash

Topic summary

✨ The discussion revolves around integrating Tuya LVL ceiling lights with Home Assistant after flashing them with OpenBK7231T firmware. The user successfully controlled brightness and color temperature using PWM settings but faced issues with MQTT not sending the correct data to Home Assistant. Various troubleshooting steps were suggested, including adjusting device flags, swapping PWM channels, and enabling alternate CW mode. Ultimately, the user resolved the issues by correctly configuring the flags and channels, allowing for proper MQTT communication and functionality within Home Assistant.
Generated by the language model.

FAQ

TL;DR: Color temperature spans 154–500 mireds and brightness scale is 100; "It worked for me many times." Use HA MQTT Discovery and ensure OBK publishes led_dimmer and led_temperature. [Elektroda, p.kaczmarek2, post #20835673]

Why it matters: This helps Home Assistant users flash Tuya LVL BK7231T CCT lights to OpenBK and fix PWM mapping and MQTT discovery issues fast.

Quick Facts

How do I get an OpenBK7231T-flashed LVL/Tuya CCT ceiling light into Home Assistant?

Use Home Assistant MQTT Discovery instead of manual YAML. Ensure the device is in LED mode, not raw PWM. Once OpenBK publishes its discovery payload, HA auto-creates a Light entity with brightness and color temperature controls. The code/YAML text box can stay empty in newer builds. [Elektroda, p.kaczmarek2, post #20835151]

Why is the HA YAML/code window empty after I switch from REL to PWM in OpenBK?

Because the text field is deprecated. It can be empty and that is normal. Use MQTT Discovery to populate entities instead. HA listens for OpenBK’s discovery messages and configures the light automatically. You do not need to copy YAML from the device page anymore. [Elektroda, p.kaczmarek2, post #20835151]

Which PWM channels should I assign for a CCT (CW/WW) driver on BK7231T?

Assign your two LED outputs to PWM channel indexes 0 and 1. This matches how OpenBK’s CCT driver expects channels. If controls act reversed, you can swap the channel order later. Keep LED mode enabled so HA Discovery works. [Elektroda, p.kaczmarek2, post #20836805]

My color temperature slider changes brightness instead of color. How do I fix it?

Your mapping likely needs Alternate CW mode and channel order corrected.
  1. Swap PWM channel order so warm/cool is first and brightness second.
  2. Disable Flag 3 (raw PWM), which must be off for LED mode.
  3. Enable Alternate CW (Flag 8); if whites invert, set one role to PWM_n. This aligns HA’s CT slider with your hardware. [Elektroda, p.kaczmarek2, post #20838559]

MQTT stops publishing led_dimmer/led_temperature when I enable Flag 3. What’s happening?

That’s expected. With Flag 3 on, the device exposes raw PWM sliders and disables LED mode. HA Discovery and the standard LED topics are suppressed, so MQTT values stop appearing and HA entities disappear. Turn Flag 3 off to restore normal LED telemetry. [Elektroda, zebrahosting, post #20838492]

What is Flag 3 actually for?

Flag 3 shows "raw PWM controllers" for testing only and disables LED mode and discovery. It is not for production use. As the maintainer explains: “Flag 3 is for development test only, not for production.” Turn it off for normal HA integration. [Elektroda, p.kaczmarek2, post #20838559]

What MQTT topics and value ranges should I expect for dimmer and color temp?

Expect led_dimmer and led_temperature topics with get/cmd pairs. Typical ranges are bri_scl=100 for brightness and 154–500 mireds for color temperature. Availability publishes to ~/connected. HA consumes this discovery schema to create the Light entity. Verify topics match your device name and base topic. [Elektroda, p.kaczmarek2, post #20835673]

Do I need physical buttons defined for this to work with HA discovery?

No. Physical Button roles are optional and used only if your device has buttons. Lights without buttons integrate fine via MQTT Discovery. You can control everything from HA and the OpenBK web UI. [Elektroda, p.kaczmarek2, post #20836805]

How do I retrieve the original Tuya datapoints after OTA flashing?

OpenBK keeps the Tuya partition intact after OTA. You can read the stored Tuya configuration later to understand DP mappings. Follow the Tuya-config viewing procedure to extract DP IDs without opening the device. This helps confirm channel logic and automation. [Elektroda, p.kaczmarek2, post #20838303]

Tasmota import doesn’t show correctly in HA. Should I switch to OpenBK MQTT discovery?

In this thread, importing via Tasmota didn’t integrate well with HA. The successful path shown here uses OpenBK’s MQTT Discovery with correct PWM mapping and flags. Switch to Discovery-first troubleshooting before attempting manual YAML. [Elektroda, zebrahosting, post #20834988]

What does a correct HA discovery payload look like for an OBK CCT light?

It includes fields like avty_t "~/connected", bri_scl 100, min_mirs 154, max_mirs 500, and topics for led_dimmer and led_temperature with matching cmd/stat pairs. Unique ID and device info (ids, name, sw, mf, mdl) are present as well. [Elektroda, p.kaczmarek2, post #20835673]

Should I invert any PWM (PWM_n), and when?

If warm/cool or brightness behave inverted after enabling Alternate CW, change one PWM role to PWM_n. This flips the output polarity without rewiring. Test both channels to confirm correct white balance and dimmer behavior in HA. [Elektroda, p.kaczmarek2, post #20838044]

What availability topic and QoS does OpenBK use by default for lights?

The HA discovery payload advertises an availability topic of ~/connected and a QoS of 1. Use this to monitor device online state in HA. You can also see state via led_enableAll get/stat topics. [Elektroda, p.kaczmarek2, post #20835673]

How can I verify that OBK is publishing the expected MQTT messages?

Use an MQTT client to watch led_dimmer/get and led_temperature/get while moving sliders in the OBK UI. Confirm command topics cmnd//led_dimmer and cmnd//led_temperature accept values. Check the discovery payload to validate ranges (bri_scl 100; 154–500 mireds). [Elektroda, p.kaczmarek2, post #20835673]

Is there a one-click way to restore OpenBK defaults if I changed many flags?

There isn’t a single “back to default” button noted in this thread. The practical fix was to disable Flag 3, set proper PWM order, and use Alternate CW mode. That restored correct CT and MQTT/HA behavior. [Elektroda, zebrahosting, post #20838036]

Quick 3-step: how do I make HA discovery publish again for my light?

  1. Turn off Flag 3 (raw PWM) to re-enable LED mode.
  2. Enable Alternate CW (Flag 8) and ensure CT is first, brightness second.
  3. If whites invert, set one channel role to PWM_n, then restart discovery. This restores HA entities and correct sliders. [Elektroda, p.kaczmarek2, post #20838559]
Generated by the language model.
ADVERTISEMENT