zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Aqara Door Contact Sensor naming in Homeassistant is not correct

Open peteh opened this issue 1 year ago • 4 comments

What happened?

Somehow the naming of Aqara Door Contact sensors in Homeassistant is a bit messed up.

image

With the new naming scheme changes in Homeassistant Entities are now named [device name] [sensor].

I have a contact sensor on my Washing machine. Therefore I named the sensor in z2m to "Washing Machine Door". Unfortunately the sensor entity that shows if it's closed or not is named "Door" instead of being the main entity of the device and taking its name.

Thus Homeassistant names the sensor entity to "Washing Machine Door Door".

With the new naming scheme the name of the contact sensor entity should be set to None/null so that Homeassistant will name it to [device name] removing the duplicate "Door".

Not sure how to better express that, I hope it's clear what the issue is.

Z2M Version: 1.35.1 commit: 9eaaa0f

What did you expect to happen?

When I name the device to "Washing Machine Door", the entity that shows open/closed should also be named to "Washing Machine Door" and not to "Washing Machine Door Door"

How to reproduce it (minimal and precise)

Pair an Aquara door sensor and name it to "Something Door".

Zigbee2MQTT version

1.35.1

Adapter firmware version

20220219

Adapter

zStack3x0

Setup

Z2M and HA in docker on a mini pc

Debug log

No response

peteh avatar Jan 28 '24 18:01 peteh

If this is not the right place, can someone point me to where I should report this to please?

peteh avatar Feb 07 '24 21:02 peteh

Issue for me too. I have contact sensors on the windows, I name it 'Bedroom Window', in Home Assistant it gets named "Bedroom Window Door"

PaulHam211 avatar Feb 25 '24 16:02 PaulHam211

Same issue here.

csszokolai avatar Apr 06 '24 19:04 csszokolai

Same!

jimb0b avatar Jun 25 '24 19:06 jimb0b

I agree the way this is designed makes naming things difficult / impossible. Only partial solution I've come up with is to manually rename every door's (or window) main entity (not device) to something like "Bedroom Door" so it shows up as "Bedroom Door" instead of "Bedroom Door Door".

Edit: After looking at the MQTT discovery JSON, I suspect this naming problem is more likely in Home Assistant than in Z2M, but I admit I don't know much about how the two interact.

greendog99 avatar Jul 11 '24 17:07 greendog99

I doubt it's in HA, it's more likely in z2m.

The main entity should report null as name but it probably responds with "Door". If it would respond with null, it would get the name of the device. If it responds with "Door" it gets the name of the device + Door.

So it should be fixable in z2m when it names the entities. However, this code is a bit messy for this device type and I haven't found the obvious fix yet.

peteh avatar Jul 13 '24 09:07 peteh

I tried again to debug it but I could not find out where the additional "Door" comes from. In https://github.com/Koenkk/zigbee-herdsman-converters lumi.sensor_magnet.aq2 looks fine to me.

The issue still persists in z2m 1.40

peteh avatar Sep 02 '24 18:09 peteh

Is there a solution to this?

Image

scorpio1441 avatar Jan 24 '25 00:01 scorpio1441

Not yet. I tried to look through the code but I didn't understand it enough to figure out where the issue comes from.

Problem still persists.

peteh avatar Jan 24 '25 12:01 peteh

Same here, i've been slowly migrating from ZHA to Z2M and notice this.

ZHA Z2M
Image Image

I also saw it mentioned https://community.home-assistant.io/t/labels-front-door-door/615410 .

The entity id was ok binary_sensor.kitchen_hallway_door_contact.

I wonder if it has anything to do with the default device class, somehow resulting in this duplication in the name https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/extension/homeassistant.ts#L69 but this would apply to all contact sensors and is perfectly valid door: on means open, off means closed.

encryptix avatar Mar 16 '25 16:03 encryptix

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar May 16 '25 00:05 github-actions[bot]

not stale! There is still no fix

peteh avatar May 16 '25 13:05 peteh

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Jul 16 '25 00:07 github-actions[bot]

Unstale because still broken

peteh avatar Jul 16 '25 05:07 peteh

Same issue for me.

Is it possible to remove the contact suffix in entity name?

I'm migrating from deCONZ to z2m and have a lot of entities used in automation that i would not edit.

bucari avatar Aug 20 '25 10:08 bucari

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Oct 20 '25 00:10 github-actions[bot]

Still broken

peteh avatar Oct 20 '25 06:10 peteh