zigpy / zha

Zigbee Home Automation
Apache License 2.0
10 stars 4 forks source link

Group entity does not use Zigbee group name by default #40

Closed TheJulianJES closed 3 months ago

TheJulianJES commented 3 months ago

(issue created for tracking purposes)

Issue

Currently, entities created for Zigbee groups do not use the Zigbee group name by default. For a light group, they'll instead always default to "Light group" which is not expected.

Part of the text below comes from PR https://github.com/zigpy/zha/pull/37: This might be because HA expects the _attr_name attribute for a custom name, but the ZHA library never sets that. It uses _name and exposes it as the name property. An example of old/new entity registry entries follows below.

Entity registry entries

I've created a ZHA group called "ZHA Group ID 3". The entity in the registry is regenerated on the current HA ZHA integration and afterwards with the ZHA library. A custom name is not set (as seen by name = null), so the original_name is used. By default, this should be the ZHA group name, so "ZHA Group ID 3". It's also used for the entity id suffix then. With the ZHA library, this always seems to be "Light group" for now (also resulting in the less descriptive entity id). That should be fixed in a future PR.

Current HA ZHA (good)

```json { "aliases": [], "area_id": null, "categories": {}, "capabilities": { "min_color_temp_kelvin": 2000, "max_color_temp_kelvin": 6535, "min_mireds": 153, "max_mireds": 500, "effect_list": [ "colorloop" ], "supported_color_modes": [ "color_temp", "xy" ] }, "config_entry_id": "9afa7813c02240642802443599f8f31b", "device_class": null, "device_id": "930dc2f5f2c48a5fa552c20c27af7e57", "disabled_by": null, "entity_category": null, "entity_id": "light.silicon_labs_ezsp_zha_group_id_3", "hidden_by": null, "icon": null, "id": "7b76a1842a3a279b08ba7a29e1c89bdf", "has_entity_name": true, "labels": [], "name": null, "options": { "conversation": { "should_expose": true } }, "original_device_class": null, "original_icon": null, "original_name": "ZHA Group ID 3", "platform": "zha", "supported_features": 44, "translation_key": "light_group", "unique_id": "light_zha_group_0x0003", "previous_unique_id": null, "unit_of_measurement": null } ```

Generated with ZHA lib (unique id is the same, name is not)

```json { "aliases": [], "area_id": null, "categories": {}, "capabilities": { "min_color_temp_kelvin": 2000, "max_color_temp_kelvin": 6535, "min_mireds": 153, "max_mireds": 500, "effect_list": null, "supported_color_modes": [ "color_temp", "xy" ] }, "config_entry_id": "9afa7813c02240642802443599f8f31b", "device_class": null, "device_id": "930dc2f5f2c48a5fa552c20c27af7e57", "disabled_by": null, "entity_category": null, "entity_id": "light.silicon_labs_ezsp_light_group", "hidden_by": null, "icon": null, "id": "d4fa6c91250a492a5f574371f43634ce", "has_entity_name": true, "labels": [], "name": null, "options": { "conversation": { "should_expose": true } }, "original_device_class": null, "original_icon": null, "original_name": "Light group", "platform": "zha", "supported_features": 44, "translation_key": "light_group", "unique_id": "light_zha_group_0x0003", "previous_unique_id": null, "unit_of_measurement": null } ```