logo elektroda
logo elektroda
X
logo elektroda

MQTT Not add item with Accents in "Configure Names" Configuration

tadeu1 474 16
Best answers

Why does MQTT discovery ignore a device name when I enter Brazilian accented characters in the Configure Names field, and how can I make it work?

MQTT discovery uses the short name for internal MQTT/entity IDs, and that part currently works reliably only with ASCII/single-byte characters, so accented characters like `ã` in the short name can break discovery [#21799107][#21800308] The full name can still keep the accented text for display, but the short name should be sanitized so the generated ID becomes something like `Sal_o_de_Festas_relay_1` instead of containing accents [#21800308][#21800943] After the patch, the test build worked again, and the change was being prepared for release [#21800909][#21801304]
Generated by the language model.
ADVERTISEMENT
  • #1 21798559
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    When I add a Brazilian accent to a letter on configure names, for example Full Name: Luz - Salão de Festas
    and try to discover at MQTT the firmware not send, if I take out the accent and leave Salao de Festa, it appears on MQTT.
    At Tasmota it works for example with space and ~ç´` etc
  • ADVERTISEMENT
  • #2 21799107
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    I think it should currently work only with ASCII chars (single byte characters), are those characters ASCII?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 21799354
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    Yeah, is there
    Binário Hex Char
    11000110 C6 ã

    But if you use it, it doesn't work.
  • #4 21800237
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    So, if you have this character in name, and do HASS discovery, can you use HA MQTT "listen" tool to see what's published, so we can investigate? Or is there no message at all?

    I will try to replicate with self test.

    Added after 52 [minutes]:

    print_string_ptr may be culprit (from CJSON)
    Helpful post? Buy me a coffee.
  • #5 21800299
    insmod
    Level 31  
    Posts: 1353
    Help: 160
    Rate: 425
    I don't see that symbol in extended ascii table
  • #6 21800308
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    I added a self test but I am confused:
    Code: C / C++
    Log in, to see the code

    It seems to pass as is already.
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1934


    Or maybe it got saved as ?

    Added after 2 [minutes]:

    Yes it did, retrying.
    Screenshot of C code in an editor modifying a character array with ASCII values

    Added after 24 [minutes]:

    This passes:
    Code: C / C++
    Log in, to see the code


    Maybe it breaks because I can't have special char there?
    Code: C / C++
    Log in, to see the code


    Added after 1 [minutes]:

    SO it would mean:
    - we already can have special chars in quotes ids list for HA
    - but we can't use them (obviously) in internal entity names, so i need to prune them

    Added after 11 [minutes]:

    I probably could patch STR_ReplaceWhiteSpacesWithUnderscore to prune those characters

    Added after 16 [minutes]:

    Like this:
    MQTT Not add item with Accents in "Configure Names" Configuration
    and then rename command to "sanitize"

    Added after 10 [minutes]:

    @tadeu1 @divadiow can you check?
    https://github.com/openshwprojects/OpenBK7231T_App/pull/1934
    Set full name:
    Salão de Festas
    Set single pin with relay.
    Expected behaviour:
    - uniq_id for HA will have special chars stripped, so it will work , it will turn into Sal_o_de_Festas_relay_1
    - the ids string for HA (the one I expect to be human-readable) will have this string as is
    I am not sure whether we need to escape this char futher
    Helpful post? Buy me a coffee.
  • #7 21800481
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    >>21800308 It's on version 1.18.234?
  • ADVERTISEMENT
  • #8 21800497
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    No, you need to download "artifacts" from PR by clicking green check mark.
    Helpful post? Buy me a coffee.
  • #9 21800511
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    >>21800497 Sorry, I have never done this before. I feel dumb; I'll try to read about how to do that.
  • #10 21800538
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Here is a guide showing how to download online builds from OBK PR:
    https://www.elektroda.com/rtvforum/topic4033833.html

    This is indeed a new mechanism, so people don't know about it yet, that's one of the reasons why OBK is so flexible and easy to develop.
    Helpful post? Buy me a coffee.
  • #11 21800909
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    >>21800497



    Thumbnail with photo icon and text “Luz_-_Sal_o_de_Festa BK7231N • 9 entidades”

    Device name change form with error in the ShortName field

    Now it's working.

    Device name change panel showing Luz - Salão de Festa

    Text on dark background with “luz_salao_de_festa” and details “BK7231N • 9 entidades”
  • #12 21800943
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    So, it's okay now? Is it ready to merge? I see short name got corrected, but short name is used for MQTT, I don't think there is a way around it. Long name is for display, I think.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #13 21801040
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    I just put the character in the short name to test. No one wants to use an accent there (I hope); the full name is OK. Tks
  • #14 21801304
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    Ok so I am adding this to release. Do you have any other ideas for fixes or suggestions?
    Helpful post? Buy me a coffee.
  • #15 21801328
    tadeu1
    Level 5  
    Posts: 80
    Help: 2
    Rate: 3
    I'm new to this firmware. I just applied to 4 different units and added to the forum.

    Now I'm trying to understand about power stuff. For example, same power outlet, one with BL602 and the other with ESP-02S.

    Using a bulb the ESP is almost fixed 15 W and with the BL602 or other with open BK it changes between 13 W and 18 W. It's weird and I don't know why.

    I'll go deeper into the options; there are so many functions different from Tasmota.

    I don't know if you have plans for translation, but I can help with pt-BR.
  • #16 21801364
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14416
    Help: 650
    Rate: 12371
    First of all, if you want to measure power of Wi-Fi module, you need to turn off the LEDs in the firmware first.

    Then, make sure you use PowerSave 1 feature of OBK. It's a great feature that can prolong the life of many devices. I really recommend it. Check this topic to see what happens if you overload Tuya power supply (or sometimes it happens just on its own, those devices are cheap):
    https://www.elektroda.com/rtvforum/topic3898805.html


    Helpful post? Buy me a coffee.
  • #17 21873839
    michaeljamesromt
    Level 6  
    Posts: 19
    It sounds like the issue is related to character encoding in the MQTT implementation. Some firmware may not fully support UTF-8 or extended Latin characters, which is why accents are being stripped or ignored. Ensuring the MQTT client and broker both handle UTF-8 properly could allow names with accents to be transmitted correctly.

Topic summary

✨ The issue concerns the inability of MQTT firmware to transmit device names containing Brazilian accented characters when configured under "Configure Names." For example, a name like "Luz - Salão de Festas" does not appear in MQTT discovery, whereas removing accents ("Salao de Festa") allows proper transmission. It is noted that Tasmota firmware supports accented characters, spaces, and special symbols such as ~, ç, ´, and `. A response suggests that the current MQTT implementation may only support ASCII characters (single-byte), implying that accented characters, which are typically multi-byte, are not handled correctly.
Generated by the language model.

FAQ

TL;DR: Fix MQTT discovery failures with accented device names in OpenBeken by using the PR-1934 build; 0xC6 = 198 (“ã”), and “uniq_id will have special chars stripped.” [Elektroda, p.kaczmarek2, post #21800308]

Why it matters: This helps Home Assistant users whose MQTT discovery breaks when device names include accents, cedillas, or tildes.

Quick Facts

How do I fix MQTT discovery not sending when my device name has accents?

Flash the PR-1934 artifact build for OpenBeken. Set your long name with accents. The firmware strips specials in unique_id, while keeping the display name intact. This restores Home Assistant discovery while preserving readability. “uniq_id will have special chars stripped.” [Elektroda, p.kaczmarek2, post #21800308]

Is this fix included in OpenBeken 1.18.234?

No. It isn’t in 1.18.234. Download and flash the PR’s CI artifacts by clicking the green check on the pull request page. [Elektroda, p.kaczmarek2, post #21800497]

How do I download and flash the PR artifacts build?

  1. Open the PR page and click the green check to view “artifacts.”
  2. Download the matching firmware artifact for your device.
  3. Flash it to your device, then reboot and re-run Home Assistant discovery. [Elektroda, p.kaczmarek2, post #21800538]

Why are accents allowed in HA device IDs but not in MQTT unique_id?

The HA dev IDs array is human-readable and can include accents. The internal unique_id must be sanitized for reliability. The PR strips non-ASCII in unique_id but preserves the displayed name. [Elektroda, p.kaczmarek2, post #21800308]

Can I keep my long display name with accents like “Salão de Festas”?

Yes. The long device name remains as you type it for display and Home Assistant’s human-readable fields. The unique_id is sanitized, not the display string. [Elektroda, p.kaczmarek2, post #21800308]

What character encoding detail was tested here?

The maintainer validated that 0xC6 (decimal 198) corresponds to “ã” and ensured publishing worked with it in names after sanitization logic. [Elektroda, p.kaczmarek2, post #21800308]

How can I see what’s actually published during Home Assistant discovery?

Use Home Assistant’s MQTT “Listen” tool in Developer Tools. Subscribe to the discovery topics to inspect payloads for your device. Share captures if nothing appears. [Elektroda, p.kaczmarek2, post #21800237]

What code change made this work?

The update prunes special characters when generating unique_id (sanitization), replacing earlier whitespace-only handling. It keeps quoted IDs readable and safe for MQTT. [Elektroda, p.kaczmarek2, post #21800308]

Did a user confirm the fix works on real hardware?

Yes. A user flashed the PR artifact, re-tested with accented names, and reported, “now its working,” including screenshots of the entities. [Elektroda, tadeu1, post #21800909]

What if I still see no MQTT message at all after updating?

Check that your short device name lacks special characters. Short names form MQTT topics and cannot retain accents, so keep them ASCII-only. [Elektroda, p.kaczmarek2, post #21800943]

What is OpenBeken (OBK)?

OpenBeken is the firmware discussed here that integrates with MQTT and Home Assistant. The project provides online builds and PR artifacts for testing. [Elektroda, p.kaczmarek2, post #21800538]

Do I need to escape special characters in JSON myself?

No extra escaping is required for the human-readable IDs. Use the PR build so unique_id gets sanitized automatically while the readable name stays intact. [Elektroda, p.kaczmarek2, post #21800308]

Which fields use short vs long names in OpenBeken?

The short name is used for MQTT, so it must avoid special characters. The long name is for display and can keep accents. [Elektroda, p.kaczmarek2, post #21800943]

What unique_id format should I expect after sanitization?

Expect underscores replacing and stripping specials, for example: Sal_o_de_Festas_relay_1. The display name remains “Salão de Festas.” [Elektroda, p.kaczmarek2, post #21800308]
Generated by the language model.
ADVERTISEMENT