HASS.Agent icon indicating copy to clipboard operation
HASS.Agent copied to clipboard

Bug: MQTT entity name starts with the device name in your config - HA 2023.8

Open Anto79-ops opened this issue 1 year ago • 14 comments

Hi,

There was a change about MQTT naming for HA Core 2023.8 about not having device name in entity name. It seems HASS agent uses device name in the entity name, for example:

2023-08-01 07:48:57.836 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT entity name starts with the device name in your config {'availability_topic': 'homeassistant/sensor/ANTO/availability', 'icon': 'mdi:webcam', 'unique_id': '1004c0a3-9f4c-4cf3-95ba-2a91843c225f', 'device': {'identifiers': ['hass.agent-ANTO'], 'manufacturer': 'LAB02 Research', 'model': 'Microsoft Windows NT 10.0.19045.0', 'name': 'ANTO', 'sw_version': '2022.14.0', 'connections': []}, 'name': 'ANTO_HP_webcamactive', 'state_topic': 'homeassistant/binary_sensor/ANTO/ANTO_webcamactive/state', 'payload_off': 'OFF', 'payload_on': 'ON', 'payload_available': 'online', 'force_update': False, 'availability_mode': 'latest', 'enabled_by_default': True, 'payload_not_available': 'offline', 'encoding': 'utf-8', 'qos': 0}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes '_webcamactive'

All the mqtt entites generated by HASS agent generate this log.

Anto79-ops avatar Aug 01 '23 19:08 Anto79-ops

Ive read the post from HA regrading this but im not really getting it fully. Saw your post ImSkully so im asking here.

If i understand correclty, is Hass.Agent not going to work after 2024.2.0 if Hass.Agent isnt updated to comply with this before that?

ABEIDO avatar Aug 02 '23 20:08 ABEIDO

it sounds like it wont break HASS agent, but rather duplicate the device name according to Frenck

It already removed the device name from the friendly name on my system, but it has not changed the entity itself.

Anto79-ops avatar Aug 02 '23 20:08 Anto79-ops

same messages here:

MQTT entity name starts with the device name in your config {'availability_topic': 'homeassistant/sensor/XXXXXXXX/availability', 'icon': 'mdi:battery-high', 'unique_id': 'XXXXXXXX_battery_charge_remaining', 'device': {'identifiers': ['hass.agent-XXXXXXXX'], 'manufacturer': 'LAB02 Research', 'model': 'Microsoft Windows NT 10.0.19045.0', 'name': 'XXXXXXXX', 'sw_version': '2022.14.0', 'connections': []}, 'name': 'XXXXXXXX_battery Charge Remaining', 'state_topic': 'homeassistant/sensor/XXXXXXXX/XXXXXXXX_battery/XXXXXXXX_battery_charge_remaining/state', 'force_update': False, 'encoding': 'utf-8', 'qos': 0, 'payload_available': 'online', 'payload_not_available': 'offline', 'enabled_by_default': True, 'availability_mode': 'latest'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes '_battery Charge Remaining'

micium avatar Aug 02 '23 22:08 micium

This should not be a breaking change when it does come into effect in 2024.2 so the deprecation warning is safe to ignore for HASS.Agent users.

It would be good to perhaps have the option to change the broadcasted entity name for sensors in the same way entity IDs can be provided.

ImSkully avatar Aug 02 '23 22:08 ImSkully

Excuse me, for me this is a breaking change ... or what am i doing wrong ??

What can I do ? Thanks.

ha-mqtt-warning-1 ha-device-mqtt-hm800

heilingbrunner avatar Aug 05 '23 15:08 heilingbrunner

@heilingbrunner Your issue is unrelated to this warning.

ImSkully avatar Aug 05 '23 17:08 ImSkully

@heilingbrunner looks like these are AhoyDTU warnings, refer to the issue over there: https://github.com/lumapu/ahoy/issues/1066

gitolicious avatar Aug 06 '23 11:08 gitolicious

The easiest way to fix this is to do it yourself. You need to manually rename all of your sensor names to remove the device name from the sensor name:

Screenshot

image

So it should look like this:

Screenshot

image

Restart Home Assistant and the warning caused by HASS.Agent entities should disappear. Or another way is to ignore it and wait until someone creates a PR, and it will be merged.

vladyspavlov avatar Aug 06 '23 21:08 vladyspavlov

I also tried to rename all the sensors and commands but it failed in an unexpected way.

If you have multiple computers set with the same names for the sensors and commands, you get a unique_id error in the Home Assistant logs and the duplicates are not listed and never show up. I ended up having to rename everything with the device name again and live with the repair warning.

zanix avatar Aug 07 '23 03:08 zanix

Renaming the names will/can break the entity ids - sensor.<XYZ> within HA as with the current discovery payload, HA is creating entity IDs base on the name. You can leave it for now as it's only a deprecation warning. A PR is in the works to address this.

amadeo-alex avatar Aug 07 '23 09:08 amadeo-alex

the entity id names don't change, it's the friendly names that are changing. and changing the names worked perfectly for me. Now I just need to get my dafang cameras and espresence updated.

broyuken avatar Aug 08 '23 15:08 broyuken

I also tried to rename all the sensors and commands but it failed in an unexpected way.

If you have multiple computers set with the same names for the sensors and commands, you get a unique_id error in the Home Assistant logs and the duplicates are not listed and never show up. I ended up having to rename everything with the device name again and live with the repair warning.

Same here, the disk sensor failed and only one pf the machines with hass agent showed disk c. Also decided to go back and rename with devicename.

ABEIDO avatar Aug 08 '23 18:08 ABEIDO

I renamed my buttons and sensors in HASS Agent removing the device name from them and problem solved.

image

image

image

Alternative if you have more than 1 instance of the Agent deployed would be to change the sensor names somewhat so that they do not contain the device name yet still be unique across the Agent instances.

danielbrunt57 avatar Oct 13 '23 03:10 danielbrunt57

I moved the device name to the end of command name and sensor names. Seems to be OK so far.

Bodge-IT avatar Nov 15 '23 13:11 Bodge-IT

Fixed in 2.0.1 and up.

Anto79-ops avatar Mar 08 '24 04:03 Anto79-ops

For anyone following this and was confused as I was (subscribed to the issue but not activly following the project), there's a fork under the new hass-agent org that's had some ongoing development since this repo/org appears to be dormant.

ravngr avatar Mar 08 '24 05:03 ravngr

Fixed in 2.0.1 and up.

Which "2.0.1"?

Latest release according to https://github.com/LAB02-Research/HASS.Agent/releases still is this:

grafik

It's a joke or do I miss some GitHub mechanisms here?

I ran into the very same issue after updating HA almost ONE YEAR after this issue arrised for the first time (HA 2023.8) - and there still is no fix in a stable HASS agent release? Are you kidding?

grafik

As I have more than one client running HASS agent, just removing the device name in hass agent sensor config is not a solution.

Maybe switching to the maintained fork as mentioned in https://github.com/LAB02-Research/HASS.Agent/issues/337#issuecomment-1985050154 is a proper future-proof "solution"...

bcutter avatar Jul 22 '24 17:07 bcutter

Fixed in 2.0.1 and up.

Which "2.0.1"?

Latest release according to https://github.com/LAB02-Research/HASS.Agent/releases still is this:

grafik

It's a joke or do I miss some GitHub mechanisms here?

I ran into the very same issue after updating HA almost ONE YEAR after this issue arrised for the first time (HA 2023.8) - and there still is no fix in a stable HASS agent release? Are you kidding?

grafik

As I have more than one client running HASS agent, just removing the device name in hass agent sensor config is not a solution.

Maybe switching to the maintained fork as mentioned in #337 (comment) is a proper future-proof "solution"...

They are referring to the fork https://github.com/hass-agent/hass.agent

zanix avatar Jul 22 '24 19:07 zanix

I know and I have now switched all my clients to that forked version. Event it's "only" the client component (HA integrations like HASS.Agent can stay untouched according to https://www.hass-agent.io/latest/getting-started/installation/#migration-from-pre-200) it was a lot of work to remove the duplicates of these sensors:

  • batterie_charge_remaining
  • batterie_charge_remaining_percentage
  • batterie_charge_status
  • batterie_full_charge_lifetime
  • batterie_powerline_status
  • speicher_total_disk_count

...which are not all existing sensors, so in MQTT plenty of topics still exist with the old devicename_sensorname setup and only those listed above got a new topic name deviceUniqueID_sensorname.

Wondering what about all the remaining ones?

Not sure what the forked version did on this. I can only see when editing existing sensors which have a device name in its name, it gives an information - that's it. grafik

I'll check if HA will continue to complain - I think so...

bcutter avatar Jul 22 '24 20:07 bcutter

I don't see why one would post such non-contributing rubbish to a factual report. I'd recommend the mods to mute your post as it contributes absolutely nothing. Have a great day.

bcutter avatar Jul 22 '24 23:07 bcutter

Have you not been listening?

There are no mods.

This repository is dead.

This issue is also closed.

The picture above is inaccurate, you are actually flogging a dead horse.

748

tomlut avatar Jul 22 '24 23:07 tomlut

Yes I got that. Seems to be an invitation for some folks (like @pabloaugusto) to behave like in the wild west. I'm out of here.

bcutter avatar Jul 22 '24 23:07 bcutter

bd0748ad-7c88-4805-b9a4-9d401577e488_text

tomlut avatar Jul 22 '24 23:07 tomlut