Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home assistant MQTT discovery: include device name #620

Closed
8 of 9 tasks
leo-b opened this issue Jan 28, 2025 · 1 comment · Fixed by #621
Closed
8 of 9 tasks

home assistant MQTT discovery: include device name #620

leo-b opened this issue Jan 28, 2025 · 1 comment · Fixed by #621

Comments

@leo-b
Copy link

leo-b commented Jan 28, 2025

PROBLEM DESCRIPTION

Homeassistant MQTT auto discovery complains about a missing name in device info:

2025-01-28 17:08:27.088 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 query_lockstate
2025-01-28 17:08:27.089 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_query_lockstate', 'enabled_by_default': False, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'payload_press': '1', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': 'Query lock state', 'command_topic': 'nuki-garten/lock/query/lockstate', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False, 'availability_mode': 'latest'}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.098 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 query_config
2025-01-28 17:08:27.098 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_query_config', 'enabled_by_default': False, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'payload_press': '1', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': 'Query config', 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/query/config', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.101 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 query_commandresult
2025-01-28 17:08:27.101 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_query_commandresult', 'enabled_by_default': False, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'payload_press': '1', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': 'Query lock state command result', 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/query/lockstateCommandResult', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.164 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 unlatch
2025-01-28 17:08:27.165 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_unlatch', 'enabled_by_default': False, 'payload_press': 'unlatch', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': 'Open', 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/action', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.165 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 lockngo
2025-01-28 17:08:27.165 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_lockngo', 'enabled_by_default': False, 'payload_press': 'lockNgo', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': "Lock 'n' Go", 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/action', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.166 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 lockngounlatch
2025-01-28 17:08:27.166 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_lockngounlatch', 'enabled_by_default': False, 'payload_press': 'lockNgoUnlatch', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': "Lock 'n' Go with unlatch", 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/action', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration
2025-01-28 17:08:27.178 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: button 179357f5 query_battery
2025-01-28 17:08:27.179 INFO (MainThread) [homeassistant.components.mqtt.entity] MQTT device information always needs to include a name, got {'unique_id': '179357f5_query_battery', 'enabled_by_default': False, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'payload_press': '1', 'device': {'identifiers': ['nuki_179357f5'], 'connections': []}, 'name': 'Query battery', 'availability_mode': 'all', 'command_topic': 'nuki-garten/lock/query/battery', 'availability': [{'topic': 'nuki-garten/maintenance/mqttConnectionState', 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'nuki-garten/lock/availability', 'payload_available': 'online', 'payload_not_available': 'offline'}], 'qos': 0, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'payload_available': 'online', 'retain': False}, if device information is shared between multiple entities, the device name must be included in each entity's device configuration

Here is an example of a corresponding MQTT config topic:

{
  "dev": {
    "ids": [
      "nuki_179357f5"
    ]
  },
  "~": "nuki-garten/lock",
  "name": "Query lock state",
  "unique_id": "179357f5_query_lockstate",
  "ent_cat": "diagnostic",
  "cmd_t": "~/query/lockstate",
  "avty": [
    {
      "t": "nuki-garten/maintenance/mqttConnectionState"
    }
  ],
  "en": false,
  "pl_prs": "1"
}

Maybe the dev object needs the name attribute provided?

I am using Homeassistant 2024.11.3.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

System Information

------------ NUKI HUB ------------
Device: ESP32
Version: 9.08
Build: 12974430884.10.1
Build type: Release
Build date: 2025-01-26
Updater version: 9.08
Updater build: 12974430884.10.1
Updater build date: 2025-01-23
Uptime (min): 72
Config version: 908
Last restart reason FW: RequestedViaWebServer
Last restart reason ESP: ESP_RST_SW: Software reset via esp_restart.
Free internal heap: 66368
Total internal heap: 246356
PSRAM Available: No
Network task stack high watermark: 8360
Nuki task stack high watermark: 5020

------------ GENERAL SETTINGS ------------
Network task stack size: 12288
Nuki task stack size: 8192
Check for updates: No
Latest version: 9.08
Allow update from MQTT: No
Update Nuki Hub and Nuki devices time using NTP: No
Web configurator username: Not set
Web configurator password: Not set
Web configurator bypass for proxy IP: Not set
Web configurator authentication: Basic
Session validity (in seconds): 3600
Session validity remember (in hours): 720
Duo Push MFA enabled: No
Web configurator enabled: Yes
HTTP SSL: Disabled
Advanced menu enabled: No
Publish free heap over MQTT: No
Nuki connect debug logging enabled: No
Nuki communication debug logging enabled: No
Nuki readable data debug logging enabled: No
Nuki hex data debug logging enabled: No
Nuki command debug logging enabled: No
MQTT log enabled: Yes
Webserial enabled: No
Bootloop protection enabled: Yes

------------ NETWORK ------------
Network device: Built-in Wi-Fi
Network connected: Yes
IP Address: 10.0.1.92
SSID: ms14-iot
BSSID of AP: B2:B9:8A:60:14:91
ESP32 MAC address: C8:F0:9E:4E:7B:2C

------------ NETWORK SETTINGS ------------
Nuki Hub hostname: nuki-garten
DHCP enabled: No
Static IP address: 10.0.1.92
Static IP subnet: 255.255.255.0
Static IP gateway: 10.0.1.1
Static IP DNS server: 10.0.1.1
RSSI Publish interval (s): 10000
Find WiFi AP with strongest signal: Yes
Restart ESP32 on network disconnect enabled: No
Disable Network if not connected within 60s: No
MQTT Timeout until restart (s): 120

------------ MQTT ------------
MQTT connected: Yes
MQTT broker address: 10.0.1.1
MQTT broker port: 1883
MQTT username: ***
MQTT password: ***
MQTT base topic: nuki-garten
MQTT SSL: Disabled

------------ BLUETOOTH ------------
Bluetooth connection mode: New
Bluetooth TX power (dB): 9
Bluetooth command nr of retries: 3
Bluetooth command retry delay (ms): 200
Seconds until reboot when no BLE beacons received: 120

------------ QUERY / PUBLISH SETTINGS ------------
Lock/Opener state query interval (s): 1800
Publish Nuki device authorization log: No
Max authorization log entries to retrieve: 5
Battery state query interval (s): 1800
Most non-JSON MQTT topics disabled: Yes
Publish Nuki device config: Yes
Config query interval (s): 3600
Publish Keypad info: No
Keypad query interval (s): 1800
Enable Keypad control: Yes
Publish Keypad topic per entry: No
Publish Keypad codes: No
Allow checking Keypad codes: No
Max keypad entries to retrieve: 10
Publish timecontrol info: No
Keypad query interval (s): 1800
Enable timecontrol control: No
Publish timecontrol topic per entry: No
Max timecontrol entries to retrieve: 10
Enable authorization control: No
Publish authorization topic per entry: No
Max authorization entries to retrieve: 10

------------ HOME ASSISTANT ------------
Home Assistant auto discovery enabled: Yes
Home Assistant auto discovery topic: homeassistant/
Nuki Hub configuration URL for HA: http://10.0.1.92
Nuki Hub ID: 48908111638728

------------ NUKI LOCK ------------
Lock enabled: Yes
Lock Ultra enabled: No
Paired: Yes
Nuki Hub device ID: 4224542623
Nuki device ID: ***
Firmware version: 2.15.3
Hardware version: 11.2
Valid PIN set: Yes
Has door sensor: No
Has keypad: No
Timecontrol highest entries count: 0
Authorizations highest entries count: 0
Register as: Bridge

------------ HYBRID MODE ------------
Hybrid mode enabled: No
Force Lock ID: No
Force Lock Keypad: No
Force Lock Doorsensor: No

------------ NUKI LOCK ACL ------------
Lock: Allowed
Unlock: Allowed
Unlatch: Allowed
Lock N Go: Allowed
Lock N Go Unlatch: Allowed
Full Lock: Allowed
Fob Action 1: Allowed
Fob Action 2: Allowed
Fob Action 3: Allowed

------------ NUKI LOCK CONFIG ACL ------------
Name: Allowed
Latitude: Allowed
Longitude: Allowed
Auto Unlatch: Allowed
Pairing enabled: Allowed
Button enabled: Allowed
LED flash enabled: Allowed
LED brightness: Allowed
Timezone offset: Allowed
DST mode: Allowed
Fob Action 1: Allowed
Fob Action 2: Allowed
Fob Action 3: Allowed
Single Lock: Allowed
Advertising Mode: Allowed
Timezone ID: Allowed
Unlocked Position Offset Degrees: Allowed
Locked Position Offset Degrees: Allowed
Single Locked Position Offset Degrees: Allowed
Unlocked To Locked Transition Offset Degrees: Allowed
Lock n Go timeout: Allowed
Single button press action: Allowed
Double button press action: Allowed
Detached cylinder: Allowed
Battery type: Allowed
Automatic battery type detection: Allowed
Unlatch duration: Allowed
Auto lock timeout: Allowed
Auto unlock disabled: Allowed
Nightmode enabled: Allowed
Nightmode start time: Allowed
Nightmode end time: Allowed
Nightmode auto lock enabled: Allowed
Nightmode auto unlock disabled: Allowed
Nightmode immediate lock on start: Allowed
Auto lock enabled: Allowed
Immediate auto lock enabled: Allowed
Auto update enabled: Allowed
Reboot Nuki: Allowed
Motor speed: Allowed
Enable slow speed during nightmode: Allowed

------------ NUKI OPENER ------------
Opener enabled: No

------------ GPIO ------------

Retain Input GPIO MQTT state: No

TO REPRODUCE

Restart nuki hub to trigger HA MQTT auto discovery.

EXPECTED BEHAVIOUR

No home assistant errors.

@iranl
Copy link
Collaborator

iranl commented Jan 28, 2025

According to https://developers.home-assistant.io/blog/2023/07/21/change-naming-mqtt-entities/ it is correct that HA guidelines prescribe the use of both identifiers as well as name for sharing of device configuration.

Not sending the name has zero impact on functionality and as such it's a pretty useless requirement / INFO message (HA choosing not to make it into more than an INFO message also gives an idea of the abscence of impact).

We'll add the name to all entities to prevent the message though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants