Removing a group member device leaves a stale group entity behind
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- python
- Área
- embedded-iot
Línea de trabajo
Start at Gateway.device_removed(), which pops the device from self._devices and schedules Device.on_remove() but never touches its groups. Compare it with the group_member_removed path, which already calls Group.clear_caches() and re-runs discover_group_entities(), and check that Group.members (a cached_property) is recomputed. Done means that after removing a group member device, Group.members reports the remaining count, the group entity is removed once fewer than two members remain, and the removed device's entity subscription is dropped.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Removing a member device from the network — as opposed to removing its endpoint from the group — leaves the group's entity fully stale: the group entity survives, Group.members keeps reporting the removed device, and the group holds a subscription to an entity that has already been torn down.
Why it happens
Gateway.device_removed() pops the device from self._devices and schedules Device.on_remove(), but it never touches the groups that device belonged to — it does not call Group.clear_caches() and it does not re-run discover_group_entities(). Nothing else does either: zigpy's ControllerApplication._remove_device() only does self.devices.pop(device.ieee, None) and does not remove the device's endpoints from its groups, so no group_member_removed event is emitted.
Group.members is a cached_property that filters on member_ieee in self._gateway.devices, so it would return the right answer if it were recomputed — but without clear_caches() it keeps the pre-removal value.
Reproduction
Create a two-light group, then remove one of the member devices:
gateway.devices: 2 # coordinator + the remaining light
group.members: 2 # stale cached_property, should be 1
group_entities: ['light_zha_group_0x0002'] # should be gone (only one member left)
entity_unsubs: ['light_zha_group_0x0002',
'01:2d:6f:00:0a:90:69:e8-1',
'02:2d:6f:00:0a:90:69:e8-1'] # 02:… is the removed device's entity
The group entity stays registered and functional, backed by a single member, and the subscription to the removed device's light entity keeps the torn-down entity object alive.
Relation to #849
#849 fixes the teardown paths that do emit events — a group dropping below two members, a single platform losing eligibility, and group removal. This one is a different entry point (Gateway.device_removed) and is deliberately out of scope there. A fix probably means, for each group the removed device belonged to, calling clear_caches() and re-running discover_group_entities() — which is exactly what group_member_removed already does.
- Lenguaje dominante
- Python
- Estrellas
- 96
- Forks
- 84
- Merge medio
- 3 d 1 h
- PR fusionados (30 d)
- 13
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de zigpy/zha
-
Analog output numbers and analog input sensors show eleven BACnet engineering units as a different unitPosiblemente ocupada @zigpy-review-bot la tomó hace 3 días. Abiertobot: code audit
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
device specific quirks
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
zigpy/zha#907 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
entities
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
zigpy/zha#855 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
quirks
Dificultad 3/5 Medio día Aptitud para principiantes 58/100
zigpy/zha#1072 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Issues similares
-
separate_packages splits imports from the same explicitly configured packagePosiblemente ocupada @rahul05ranjan la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
TigreGotico/text2spoken#626 ·
Los mantenedores suelen responder en 1 día
-
oncoref MappingProxyType in proteome.layers breaks deepcopy in reference_coverage._inventoryPosiblemente ocupada @iskandr la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
pipecat-ai/pipecat#7014 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
NL-BioImaging/biomero#136 ·
Los mantenedores suelen responder en 1 día