logo elektroda
logo elektroda
X
logo elektroda

BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

leifmjcb 915 16
ADVERTISEMENT
  • #1 20369529
    leifmjcb
    Level 3  
    Hi all, Happy new year!

    As my new years resolution, I've decided to stop pulling my hair out over these BL602 MagicHome LED controllers and come here for some help.

    I've flashed 6 of these now originally with 1.15.149 and today with 1.15.273.

    The config, operation, wifi & MQTT all seem to be working fine. I have no errors in logs.

    However I cant for the life of me get discovery to work. The only way I can connect via HA is by manually adding via YAML conf. But when I do this only an entity appears, no device.

    I am still learning HA and MQTT but I'm only having this problem with BL602, I've got many ESP and BK7231T devices working fine and with discovery.

    Here's my conf for this device:
    mqtt:
    light:
    - unique_id: "LED-UpstairsBedroom-BedLights_light"
    name: "LED_usbe_bed"
    rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
    rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
    rgb_state_topic: "LED_usbe_bed/led_basecolor_rgb/get"
    rgb_command_topic: "cmnd/LED_usbe_bed/led_basecolor_rgb"
    command_topic: "cmnd/LED_usbe_bed/led_enableAll"
    state_topic: "LED_usbe_bed/led_enableAll/get"
    availability_topic: "LED_usbe_bed/connected"
    payload_on: "1"
    payload_off: "0"
    brightness_command_topic: "cmnd/LED_usbe_bed/led_dimmer"
    brightness_state_topic: "LED_usbe_bed/led_dimmer/get"
    brightness_scale: 100

    Apologies is this is a newbie question. But any help would be much appreciated.

    Screenshots attached

    Thanks!

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
  • ADVERTISEMENT
  • #2 20369972
    p.kaczmarek2
    Moderator Smart Home
    Hello, sorry for late reply, I saw your post but didn't have time to test it yet.
    I have tested it on my dev board:
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    According to the UART log from the board, the discovery happens:
    
    Info:MAIN:g_startPingWatchDogAfter 0, g_bPingWatchDogStarted 1 
                   
    Info:DHTDHT start, pin is 4
                                                       
    Info:DHTDHT timeout waiting for pulse.
                                            
    Info:MAIN:Time 1048, idle 0/s, free 101240, MQTT 1(1), bWifi 1, secondsWithNoPig
     -1, socks 2/21
                                                                   
    Info:MAIN:g_startPingWatchDogAfter 0, g_bPingWatchDogStarted 1 
                   
    Info:MQTT:Queued topic=homeassistant/switch/OpenBL602_05C31FFD_relay_0/config, 1
     items in queue
                                                                   
    Info:MQTT:Publishing val (304 bytes) to homeassistant/switch/OpenBL602_05C31FFD_
    relay_0/config retain=1
                                                           
    Info:MAIN:Time 1049, idle 0/s, free 101240, MQTT 1(1), bWifi 1, secondsWithNoPin
    g -1, socks 2/21
                                                                  
    Info:MAIN:_startPingWatchDogAfter 0, g_bPingWatchDogStarted 1 
                    
    Info:MAIN:Forced channel publish! Publishing val 0 to 0
                           
    Info:MQTT:Publishing val 0 to bl602brd/0/get retain=0
           
    

    And HA gets reply:
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    
    {
        "dev": {
            "ids": [
                "OpenBL602_05C31FFD"
            ],
            "name": "bl602brd",
            "sw": "BL602_Test",
            "mf": "BLAITEK",
            "mdl": "BL602",
            "cu": "http://192.168.0.111/index"
        },
        "name": "bl602brd 0",
        "~": "bl602brd",
        "avty_t": "~/connected",
        "pl_on": "1",
        "pl_off": "0",
        "uniq_id": "OpenBL602_05C31FFD_relay_0",
        "qos": 1,
        "stat_t": "~/0/get",
        "cmd_t": "~/0/set"
    }
    

    But... huh, it doesn't appear on the list! You are correct! That's very strange. I will forward it to @iprak , maybe he can tell us more about it.

    Very strange, thank you for reporting!

    Ok, your second issue is related to Home Assistant and not to OpenBeken, so I am not sure if I can provide you support for that, but I will try to figure it out anyway.
    but I have most likely older HA version than you..
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    It appears on HA...
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    I have bl602 board easily accessible on automation list:
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    Are you saying that it's missing for you?
    Helpful post? Buy me a coffee.
  • #3 20370231
    iprak
    Level 6  
    leifmjcb wrote:

    However I can't for the life of me get discovery to work. The only way I can connect via HA is by manually adding via YAML conf. But when I do this only an entity appears, no device.


    What message do you see when you invoke discovery?
    Manually added MQTT items will not generate a Device, that only happens via Discovery or Integration.
  • #4 20370248
    p.kaczmarek2
    Moderator Smart Home
    @iprak you can look at my post, my HA receives a discovery MQTT message but still doesn't add a device, somehow... I am confused, is the HA discovery message JSON I quoted in my previous post correct?

    I will retry again tomorrow...
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 20370273
    iprak
    Level 6  
    Your json looks okay to me. This is what I just received upon invoking discovery. I would check HomeAssistant log itself for more details.

    Code: JSON
    Log in, to see the code
  • #6 20370391
    p.kaczmarek2
    Moderator Smart Home
    @leifmjcb since you're saying you don't get entity ID for your device, what do you have here?
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    I have it on my entities list, but again, I am using older HA....
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    It was added by hand, in Yaml code.

    I also tested again Discovery now and... I was wrong.
    Discovery WORKS on BL602.
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    Discovery on BL602 works for me now, the yesterdays test must have been some kind of mistake on my side or a fluke
    Helpful post? Buy me a coffee.
  • #7 20370954
    iprak
    Level 6  
    Another quick and good way to check the overall status would be from the Integrations page.

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    Here one can also cross-check the MQTT payload which HomeAssistant received.
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    Sometimes HomeAssistant might have received the value but discarded it due to parsing errors. That unfortunately can only be determined by going to HomeAssistant logs (Settings > System > Logs > Load Full Logs) or opening up the logs file in the editor.
  • ADVERTISEMENT
  • #8 20371020
    leifmjcb
    Level 3  
    @p.kaczmarek2 @iprak Thanks very much for your replies.

    Honestly I thought it was going to be a simple mistake I've made that would have been highlighted 😅

    Your feedback is appreciated, I'll dig into this tonight and report back my findings!

    The entity ID does appear when adding to my conf file. But no device is discovered.

    Via the openbeken Web logs, it says it has connected, and broadcast HA discovery. Mosquito Logs confirm the connection.

    But tonight I will repeat some of your tests on my system again and see what I find!

    Thanks,

    Leif
  • #9 20371059
    p.kaczmarek2
    Moderator Smart Home
    Well, on my side HA discovery on BL602 works (that yesterday must have been a fluke or I overlooked something, it was late and night) so I don't know what to say more... does your HA MQTT integration receives the correct full MQTT discovery packet just like mine?

    @iprak I am porting MQTT to WIndows simulator, soon we will be able to pair our windows machine with HA - just for testing.
    Helpful post? Buy me a coffee.
  • #10 20371079
    iprak
    Level 6  
    leifmjcb wrote:
    The entity ID does appear when adding to my conf file. But no device is discovered.


    Are you adding the MQTT entry directly to Home Assistant configuration.yaml ?
  • #11 20371954
    leifmjcb
    Level 3  
    p.kaczmarek2 wrote:
    @leifmjcb since you're saying you don't get entity ID for your device, what do you have here?


    @p.kaczmarek2 If i manually add to the YAML yes, i get a correct entity ID, however no connected device for that entity and the entity will not operate.

    With your information & tests i've been able to compare my findings. Please note that my original device (LED-UpstairsBedroom-BedLights_light) can't be powered on at the moment as i've had to move some things around in the bedroom. However it still has the same issues as my other BL602 devices so i will be using another for this example on FW: 1.15.149.

    So after restarting the BL602 I can see it connects to my MQTT broker
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    Then I start HA Discovery
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    At the bottom of the SS below I can see it returns an error.
    Publish err: ERR_MEM aka -1

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    Listening to the topic only my BK7231T devices are shown
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    Checking for devices and entities but none are shown
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    If I manually add the conf to YAML
    mqtt:
      light:
      - unique_id: "LED-DownstairsLivingRoom-A_light"
        name: "LED_dslr_a"
        rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
        rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
        rgb_state_topic: "LED_dslr_a/led_basecolor_rgb/get"
        rgb_command_topic: "cmnd/LED_dslr_a/led_basecolor_rgb"
        command_topic: "cmnd/LED_dslr_a/led_enableAll"
        state_topic: "LED_dslr_a/led_enableAll/get"
        availability_topic: "LED_dslr_a/connected"
        payload_on: "1"
        payload_off: "0"
        brightness_command_topic: "cmnd/LED_dslr_a/led_dimmer"
        brightness_scale: 100


    An entity appears but no device, however the entity is offline and unusable
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    I hope this sheds a little more light and information for you and @iprak on the matter, thanks again for your assistance.

    Added after 3 [minutes]:

    Well i'll be damned, I've actually just seen this appear on my dashboard now and it works! However it doesn't have an associated device unlike my BK7231T Devices. Is this expected?
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
  • #12 20372055
    iprak
    Level 6  
    1. A manually defined entity will not have a device. A device is only generated for discovery.
    2. The entity can appear offline if Home Assistant has not received any connect message.
  • ADVERTISEMENT
  • #13 20372089
    p.kaczmarek2
    Moderator Smart Home
    
    Publish err: ERR_MEM aka -1
    

    This might mean that we need to increase MQTT buffers for BL602 platform, but it also may mean that there is a threading issue (like the one in the past with N, but in that case, @valeklubomir and @btsimonh did GREAT WORK solving it and now BK7231 is super-stable, see picture below):
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    Emphasis in case you missed:
    Quote:

    Build on Nov 25 2022 10:36:26 version 1.15.77
    Online for 42 days, 8 hours, 42 minutes and 28 seconds
    Helpful post? Buy me a coffee.
  • #14 20372130
    leifmjcb
    Level 3  
    iprak wrote:
    1. A manually defined entity will not have a device. A device is only generated for discovery.
    2. The entity can appear offline if HomeAssistant has not received any connect message.


    @iprak thanks, so am I right in saying discovery has failed, but commands can be broadcast still hence why it works?
  • #15 20372136
    iprak
    Level 6  
    leifmjcb wrote:
    I right in saying discovery has failed, but commands can be broadcast still hence why it works?


    Yes. Since you were able to see the discovery message broadcast so you would want to check Home Assistant error log. You might have to adjust Home Assistant logging to see more details, maybe change mqtt logging to warning or debug (https://www.home-assistant.io/integrations/logger/).
  • #16 20372140
    leifmjcb
    Level 3  
    p.kaczmarek2 wrote:
    
    Publish err: ERR_MEM aka -1
    

    This might mean that we need to increase MQTT buffers for BL602 platform, but it also may mean that there is a threading issue (like the one in the past with N, but in that case, @valeklubomir and @btsimonh did GREAT WORK solving it and now BK7231 is super-stable, see picture below):
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    Emphasis in case you missed:
    Quote:

    Build on Nov 25 2022 10:36:26 version 1.15.77
    Online for 42 days, 8 hours, 42 minutes and 28 seconds


    @p.kaczmarek2 I see so I am experiencing something different than others? I wonder why.

    Especially since this problem is repeated on 6 devices and through different firmware.

    Yeah I'm really impressed with the BK7213 and I'm very appreciative of all the work everyone has put into this project 🍻

    Added after 34 [minutes]:

    iprak wrote:
    leifmjcb wrote:
    I right in saying discovery has failed, but commands can be broadcast still hence why it works?


    Yes. Since you were able to see the discovery message broadcast so you would want to check HomeAssistant error log. You might have to adjust HomeAssistant logging to see more details, maybe change mqtt logging to warning or debug (https://www.home-assistant.io/integrations/logger/).


    Thanks, I'll look into that, I'm yet to set up proper logging.

    Added after 7 [minutes]:

    @p.kaczmarek2 Just as an FYI.

    I noticed the HA conf on the BL602 configuration page returns an error (at least in my version of HA)
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

    I found the correction was just adding quotation marks to the payload values:
        payload_on: "1"
        payload_off: "0"
  • #17 20372191
    iprak
    Level 6  
    p.kaczmarek2 wrote:

    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration
    Emphasis in case you missed:
    Quote:

    Build on Nov 25 2022 10:36:26 version 1.15.77
    Online for 42 days, 8 hours, 42 minutes and 28 seconds


    45 days here but it is just a switch.
    BL602 MagicHome LED Controllers: Discovery Issues and Manual YAML Configuration

Topic summary

The discussion revolves around issues with the BL602 MagicHome LED controllers, specifically regarding MQTT discovery in Home Assistant (HA). The user has successfully flashed multiple devices with different firmware versions but struggles to achieve automatic discovery, resulting in only entities appearing without associated devices. Responses highlight that manually added MQTT items do not generate devices, and discovery messages must be correctly formatted for HA to recognize them. Some users confirm that discovery works for them, suggesting potential configuration or logging issues on the user's side. The conversation also touches on MQTT buffer settings and the importance of checking Home Assistant logs for errors related to discovery and device connectivity.
Summary generated by the language model.
ADVERTISEMENT