logo elektroda
logo elektroda
X
logo elektroda

[Solved] LVL BK7231T light into Homeassistant

zebrahosting 1011 17
ADVERTISEMENT
  • #1 20834988
    zebrahosting
    Level 3  

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

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

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

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

    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.
  • #10 20837258
    p.kaczmarek2
    Moderator Smart Home
    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  

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

    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
    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.
  • ADVERTISEMENT
  • #15 20838492
    zebrahosting
    Level 3  

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

    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  
    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.
Summary generated by the language model.
ADVERTISEMENT