Skip to content

"MQTT entity name starts with the device name in your config" when using SHT usermod (HA specific) #3506

Open
@cryptk

Description

@cryptk

What happened?

When using the SHT usermod to publish temperature and humidity readings to MQTT for Home Assistant, a warning is logged because the entity name for the temperature/humidity sensors includes the device name.

This is related to the change in HA documented in this developer blog post: https://developers.home-assistant.io/blog/2023/07/21/change-naming-mqtt-entities

To Reproduce Bug

enable the SHT usermod
enable MQTT publishing
integrate into Home Assistant and observe the warning

Expected Behavior

MQTT entities should not include the device name in the entity name

Install Method

Self-Compiled

What version of WLED?

WLED 0.14.0 (build 2310130)

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

MQTT entity name starts with the device name in your config {'name': 'House Lights Temperature', 'state_topic': 'wled/house-lights/temperature', 'device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>, 'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>, 'unique_id': 'e831cdf9a62c-temperature', 'unit_of_measurement': '°C', 'device': {'identifiers': ['e831cdf9a62c'], 'name': 'House Lights', 'sw_version': '0.14.0', 'model': 'ESP32-D0WDQ5', 'manufacturer': 'espressif', 'connections': []}, 'qos': 0, 'encoding': 'utf-8', 'enabled_by_default': True, 'availability_mode': 'latest', 'payload_not_available': 'offline', 'payload_available': 'online', 'force_update': False}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Temperature'

Anything else?

It looks like the issue comes from https://github.com/Aircoookie/WLED/blob/main/usermods/sht/usermod_sht.h#L171 for Temperature and https://github.com/Aircoookie/WLED/blob/main/usermods/sht/usermod_sht.h#L187 for Humidity.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    connectivityIssue regarding protocols, WiFi connection or availability of interfacesenhancementhelp wantedusermodusermod related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions