logo elektroda
logo elektroda
X
logo elektroda

MQTT Discovery Issues with Openbeaken-Flashed 2 Gang Relay on Hass Config Page

soubhikkhan 1566 9
Best answers LABEL_AI_GENERATED

Why is my OpenBeken-flashed 2-gang relay not being discovered automatically in Home Assistant MQTT discovery, even though MQTT control works?

Home Assistant is rejecting the MQTT discovery message because the generated discovery topic contains spaces in the device name, making it an illegal discovery topic [#20713383] Check the HA logs for a warning like `homeassistant/switch/Wall Switch 2 gang_relay_0/config`, then remove the spaces from the device’s “Full Name” and run discovery again [#20713383][#20713461] After renaming it without spaces, the device appears in Home Assistant [#20713461] The firmware author noted that Home Assistant does not like spaces in discovery names and planned a fix to replace them with underscores automatically [#20713417][#20713499] Starting with OBK version 1.17.238, a safety check was added so HA discovery works even if spaces were entered in the names [#20723563]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
  • MQTT discovery not appearing in Home Assistant

    #1 20712561
    soubhikkhan
    Level 3  
    Posts: 13

    I have flashed the device with openbeacon. The device is working and I'm able to listen and set the MQTT topics from Hass MQTT config page. The relays are responding well! But the device is not getting discovered. What am I missing? Configuration interface for Wall Switch 2 gang with MQTT settings. MQTT configuration form for a wall switch with two sections. User interface for Wall Switch 2 gang with toggle options.
  • ADVERTISEMENT
  • #2 20712614
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    Hello, do you click "Start home assistant discovery"?
    Helpful post? Buy me a coffee.
  • #3 20713373
    soubhikkhan
    Level 3  
    Posts: 13
    Yes, I did! It shows, MQTT discovery queued.
  • ADVERTISEMENT
  • #4 20713380
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    What do you have in HA logs?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • Spaces in device name caused illegal MQTT discovery topic

    #5 20713383
    soubhikkhan
    Level 3  
    Posts: 13

    Ah, thanks for pointing that out! I don't know why it's taking space between characters!

    Received message on illegal discovery topic 'homeassistant/switch/Wall Switch 2 gang_relay_0/config'. The topic contains not allowed characters. For more information, see https://www.home-assistant.io/integrations/mqtt/#discovery-topic
    9:19:31 AM – (WARNING) MQTT - message first occurred at August 28, 2023, at 5:16:52 PM and shows up 6 times

    Added after 1 [minutes]:

    Even in the obk, it shows like this!
    mqtt:
    switch:
    - unique_id: "Wall Switch 2 gang_relay_0"
    name: 0
    state_topic: "obk_wall_switch/0/get"
    command_topic: "obk_wall_switch/0/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: true
    availability:
    - topic: "obk_wall_switch/connected"
    - unique_id: "Wall Switch 2 gang_relay_1"
    name: 1
    state_topic: "obk_wall_switch/1/get"
    command_topic: "obk_wall_switch/1/set"
    qos: 1
    payload_on: 1
    payload_off: 0
    retain: true
    availability:
    - topic: "obk_wall_switch/connected"

    Added after 2 [minutes]:

    I think I found out.. in the device naming, I used spaces
    Settings interface with options to change the device name Wall Switch 2 gang.
  • Helpful post
    #6 20713417
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    Hmm so Home Assistant doesn't like spaces? It's good to know.

    I can submit a fix for the core firmware so it does not allow spaces in the names. It could replace them automatically with underscores.
    Helpful post? Buy me a coffee.
  • #7 20713461
    soubhikkhan
    Level 3  
    Posts: 13

    Yes, I removed the spaces from "Full Name" and clicked on the discover again. Now the device popped up on HA!
    I should have checked the log earlier, hehe!
    Thanks for the help though!
  • ADVERTISEMENT
  • Helpful post
    #8 20713499
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    Thank you, I was not aware about the whitespaces issue. I will submit a fix tomorrow to the main repository tree.
    Helpful post? Buy me a coffee.
  • #9 20723563
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14771
    Help: 659
    Rate: 12914
    Starting with 1.17.238 version of OBK, a safety check has been added to make HA discovery work even if you tried to put spaces in the names.
    Helpful post? Buy me a coffee.
  • #10 20729909
    soubhikkhan
    Level 3  
    Posts: 13
    Sounds Great! Thank you

Topic summary

LABEL_AI_GENERATED
The discussion revolves around issues with MQTT discovery for an Openbeacon-flashed 2 gang relay device in Home Assistant (HA). The user successfully set up MQTT topics, but the device was not discovered due to illegal characters (spaces) in the discovery topic. After reviewing HA logs, it was identified that the spaces in the unique ID caused the problem. The user removed the spaces and successfully triggered the discovery process. A suggestion was made to implement a firmware fix to automatically replace spaces with underscores in future versions. The latest firmware version (1.17.238) includes a safety check to handle such issues.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT