Skip to content

Devices not exported by MQTT #1102

@dral3x

Description

@dral3x

Is there an existing issue for this?

The issue occurs in the following browsers. Select at least 2.

  • Firefox
  • Chrome
  • Edge
  • Safari (unsupported) - PRs welcome
  • N/A - This is an issue with the backend

Current Behavior

When the device name is all numbers (like 192168120), the MQTT plugin is not able to export it, but also no other device is exported.

Here's the error I see in the logs:

Traceback (most recent call last):
  File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 552, in <module>
    sys.exit(main())
             ^^^^^^
  File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 72, in main
    mqtt_start(db)
  File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 456, in mqtt_start
    devDisplayName = re.sub('[^a-zA-Z0-9-_\\s]', '', normalize_string(device["devName"]))            
                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/server/helper.py", line 498, in normalize_string
    normalized_text = unicodedata.normalize('NFD', text)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: normalize() argument 2 must be str, not int

19:05:31 [Plugins] ⚠ ERROR - enable LOG_LEVEL=debug and check logs
19:05:31 [Plugins] No output received from the plugin "MQTT"

Expected Behavior

That should be treated as a string, not as a number. Therefore it should be exported without any problem.

Steps To Reproduce

Name a device with all numbers
Enable MQTT plugin
At some point, some devices will not be exported anymore, when they are "after" the one you just changed.

app.conf

Mine is too long, and I cannot add it here.

docker-compose.yml

services:
  netalertx:
    container_name: NetAlertX
    hostname: NetAlertX
    privileged: true
    image: ghcr.io/jokob-sk/netalertx:latest
    environment:
      - TZ=Europe/Rome
      - PORT=20211
    restart: unless-stopped
    volumes:
      - /mnt/config/netalertx/db:/app/db
      - /mnt/config/netalertx/config:/app/config
    network_mode: host

What installation are you running?

Production (netalertx)

app.log

19:05:29 [Plugin utils] 💬 INFO - Object not found {"Plugin": "MQTT", "Watched_Value3": "aa3b1c083e08852f8029c5941a24a060"}
19:05:29 [MQTT] New sensor entry (name|mac|hash) : (Proxmox on TerraNas|6c:bf:b5:02:d8:5f|aa3b1c083e08852f8029c5941a24a060
19:05:29 [MQTT] Sending MQTT topic: homeassistant/device_tracker/mac_6c_bf_b5_02_d8_5f/config
19:05:29 [MQTT] Sending MQTT message: {"state_topic": "system-sensors/device_tracker/mac_6c_bf_b5_02_d8_5f/state", "json_attributes_topic": "system-sensors/device_tracker/mac_6c_bf_b5_02_d8_5f/attributes", "name": "is_home", "payload_home": "home", "payload_not_home": "away", "unique_id": "mac_6c_bf_b5_02_d8_5f_device_tracker_is_home", "icon": "mdi:home", "device": {"identifiers": ["mac_6c_bf_b5_02_d8_5f_sensor", "mac_6c_bf_b5_02_d8_5f_device_tracker_is_home"], "manufacturer": "NetAlertX", "model": "Proxmox on TerraNas", "name": "Proxmox on TerraNas"}}
19:05:31 [MQTT] Sending MQTT topic: system-sensors/device_tracker/mac_6c_bf_b5_02_d8_5f/state
19:05:31 [MQTT] Sending MQTT message: home
19:05:31 [MQTT] Sending MQTT topic: system-sensors/device_tracker/mac_6c_bf_b5_02_d8_5f/attributes
19:05:31 [MQTT] Sending MQTT message: {"last_ip": "192.168.1.20", "is_new": "0", "alert_down": "1", "vendor": "Noon Technology Co Ltd", "mac_address": "6c:bf:b5:02:d8:5f", "model": "Proxmox on TerraNas", "last_connection": "2025-06-22T10:58:12+00:50", "first_connection": "2025-06-12T12:45:47+02:00", "sync_node": "", "group": "", "location": "", "network_parent_mac": "00:1a:e5:45:f9:44", "network_parent_name": "Switch 8 porte"}
Traceback (most recent call last):
File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 552, in
sys.exit(main())
^^^^^^
File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 72, in main
mqtt_start(db)
File "/app/front/plugins/_publisher_mqtt/mqtt.py", line 456, in mqtt_start
devDisplayName = re.sub('[^a-zA-Z0-9-_\\s]', '', normalize_string(device["devName"]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/server/helper.py", line 498, in normalize_string
normalized_text = unicodedata.normalize('NFD', text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: normalize() argument 2 must be str, not int

19:05:31 [Plugins] ⚠ ERROR - enable LOG_LEVEL=debug and check logs
19:05:31 [Plugins] No output received from the plugin "MQTT"
19:05:31 [MAIN] processScan: False
19:05:31 [Plugins] Check if any plugins need to be executed on run type: before_name_updates

Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Docker 🐋Docker relatedbug 🐛Something isn't workingnext release/in dev image 🚀This is coming in the next release or was already released if the issue is Closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions