LAB02-Research / HASS.Agent

Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.
https://hassagent.lab02-research.org
MIT License
1.56k stars 68 forks source link

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

Closed Anto79-ops closed 6 months ago

Anto79-ops commented 1 year ago

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.

ABEIDO commented 1 year ago

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?

Anto79-ops commented 1 year ago

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.

micium commented 1 year ago

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'

ImSkully commented 1 year ago

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.

heilingbrunner commented 1 year ago

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
ImSkully commented 1 year ago

@heilingbrunner Your issue is unrelated to this warning.

gitolicious commented 1 year ago

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

vladyspavlov commented 1 year ago

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](https://github.com/LAB02-Research/HASS.Agent/assets/16994749/cd1af44d-4ddb-4409-860a-039910ed625e)

So it should look like this:

Screenshot ![image](https://github.com/LAB02-Research/HASS.Agent/assets/16994749/f1b1d9ff-e3d2-4ffd-a6eb-e75447df51f2)

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.

zanix commented 1 year ago

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.

amadeo-alex commented 1 year ago

Renaming the names will/can break the entity ids - sensor. 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.

broyuken commented 1 year ago

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.

ABEIDO commented 1 year ago

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.

danielbrunt57 commented 11 months ago

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.

Bodge-IT commented 10 months ago

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

Anto79-ops commented 6 months ago

Fixed in 2.0.1 and up.

ravngr commented 6 months ago

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.

bcutter commented 2 months ago

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"...

zanix commented 2 months ago

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

bcutter commented 2 months ago

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:

...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 commented 2 months ago

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.

tomlut commented 2 months ago

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

bcutter commented 2 months ago

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.

tomlut commented 2 months ago

bd0748ad-7c88-4805-b9a4-9d401577e488_text