cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
111 stars 18 forks source link

Discovered entities with a name that starts with the device name #114

Open tankdeer opened 1 year ago

tankdeer commented 1 year ago

Release 2023.8.0 of Home Assistant introduced some changes to how MQTT entities work. Documented here:

https://developers.home-assistant.io/blog/2023-057-21-change-naming-mqtt-entities/

And now shows with this warning/fix in Home Assistant:

Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped of the entity name as a work-a-round. Please inform the maintainer of the software application that supplies the affected entities to fix this issue.

Here's an example of the warning logged in the log file:


2023-08-02 15:33:30.970 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'availability_topic': 'octoPrint/mqtt', 'payload_available': 'connected', 'payload_not_available': 'disconnected', 'name': 'Ender 3 Print Status', 'unique_id': 'f3ced1a508db4ed5bd4f3d59757faf2c_PRINTING_S', 'state_topic': 'octoPrint/hass/printing', 'json_attributes_topic': 'octoPrint/hass/printing', 'json_attributes_template': Template<template=({{value_json.state|tojson}}) renders=0>, 'value_template': Template<template=({{value_json.state.text}}) renders=0>, 'device': {'identifiers': ['f3ced1a508db4ed5bd4f3d59757faf2c'], 'name': 'Ender 3', 'manufacturer': 'CREALITY', 'model': 'OctoPrint', 'sw_version': 'HomeAssistant Discovery for OctoPrint 3.6.3', 'connections': []}, 'qos': 0, 'enabled_by_default': True, 'availability_mode': 'latest', 'force_update': False, 'encoding': 'utf-8'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Print Status'
halfluck commented 1 year ago

+1 i got this warning this morning

ntguest commented 1 year ago

the same

jossiee commented 1 year ago

Looks like a fix is already there #113 wait for next release

ejpenney commented 1 year ago

I'm no longer seeing this warning for Octoprint after upgrading the plugin to 3.7.0.

ssirkakriss commented 1 year ago

Updated to 3,7,0 and still have a few warnings.

2023-08-10 12:49:27.156 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'availability_topic': 'octoPrint/mqtt', 'payload_available': 'connected', 'payload_not_available': 'disconnected', 'name': '3D printer 1 Emergency Stop', 'unique_id': '388e8fa97e9a4e41aedb7051e48e2bb9_STOP', 'command_topic': 'octoPrint/hassControl/stop', 'state_topic': 'octoPrint/hassControl/stop', 'payload_off': 'False', 'payload_on': 'True', 'value_template': Template<template=({{False}}) renders=0>, 'device': {'identifiers': ['388e8fa97e9a4e41aedb7051e48e2bb9'], 'name': '3D printer 1', 'manufacturer': 'creality', 'model': 'Ender3', 'sw_version': 'HomeAssistant Discovery for OctoPrint 3.4.0', 'connections': []}, 'icon': 'mdi:alert-octagon', 'encoding': 'utf-8', 'qos': 0, 'retain': False, 'enabled_by_default': True, 'optimistic': False, 'availability_mode': 'latest'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Emergency Stop'
2023-08-10 12:49:27.163 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'availability_topic': 'octoPrint/hass/is_printing', 'payload_available': 'True', 'payload_not_available': 'False', 'name': '3D printer 1 Cancel Print', 'unique_id': '388e8fa97e9a4e41aedb7051e48e2bb9_CANCEL', 'command_topic': 'octoPrint/hassControl/cancel', 'state_topic': 'octoPrint/hassControl/cancel', 'payload_off': 'False', 'payload_on': 'True', 'value_template': Template<template=({{False}}) renders=0>, 'device': {'identifiers': ['388e8fa97e9a4e41aedb7051e48e2bb9'], 'name': '3D printer 1', 'manufacturer': 'creality', 'model': 'Ender3', 'sw_version': 'HomeAssistant Discovery for OctoPrint 3.4.0', 'connections': []}, 'icon': 'mdi:cancel', 'encoding': 'utf-8', 'qos': 0, 'retain': False, 'enabled_by_default': True, 'optimistic': False, 'availability_mode': 'latest'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Cancel Print'
2023-08-10 12:49:27.168 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'availability_topic': 'octoPrint/mqtt', 'payload_available': 'connected', 'payload_not_available': 'disconnected', 'name': '3D printer 1 Shutdown System', 'unique_id': '388e8fa97e9a4e41aedb7051e48e2bb9_SHUTDOWN', 'command_topic': 'octoPrint/hassControl/shutdown', 'state_topic': 'octoPrint/hassControl/shutdown', 'payload_off': 'False', 'payload_on': 'True', 'value_template': Template<template=({{False}}) renders=0>, 'device': {'identifiers': ['388e8fa97e9a4e41aedb7051e48e2bb9'], 'name': '3D printer 1', 'manufacturer': 'creality', 'model': 'Ender3', 'sw_version': 'HomeAssistant Discovery for OctoPrint 3.4.0', 'connections': []}, 'icon': 'mdi:power', 'encoding': 'utf-8', 'qos': 0, 'retain': False, 'enabled_by_default': True, 'optimistic': False, 'availability_mode': 'latest'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Shutdown System'

This is wile the printer is idle and upon HASS startup.

̶I̶'̶m̶ ̶t̶h̶i̶n̶k̶i̶n̶g̶ ̶t̶h̶e̶r̶e̶ ̶a̶r̶e̶ ̶s̶o̶m̶e̶ ̶r̶e̶t̶a̶i̶n̶e̶d̶ ̶m̶e̶s̶s̶a̶g̶e̶s̶ ̶t̶h̶a̶t̶ ̶n̶e̶e̶d̶ ̶t̶o̶ ̶b̶e̶ ̶c̶l̶e̶a̶r̶e̶d̶.̶ ̶H̶o̶w̶e̶v̶e̶r̶ ̶I̶'̶m̶ ̶n̶o̶t̶ ̶s̶u̶r̶e̶.̶ ̶I̶'̶m̶ ̶I̶ ̶o̶n̶ ̶t̶h̶e̶ ̶r̶i̶g̶h̶t̶ ̶t̶r̶a̶c̶k̶ ̶?̶

EDIT: It's the weekend and I had some time to figure my errors out.

Searching with MQTT explorer for "3.4.0" as I see that the three messages have 'HomeAssistant Discovery for OctoPrint 3.4.0' in common. then clearing the old retained messages did the trick.

All good now.

Many thanks.