Summary
The HA-Veröffentlichung settings tab (/settings#ha-publish → PFLANZEN) lists every plant instance — including plants that are no longer active (harvested, senesced, died, or otherwise removed). A user shouldn't be pushing dead/removed plants to Home Assistant, and the flat list gives no way to tell active from inactive. Requested improvements:
- Treat only active plants as eligible for HA publishing (default view = active only).
- Mark inactive plants clearly when they are shown.
- Offer the user a filter to switch between active-only and all (incl. inactive).
Grounding
- The selection list is built in
src/frontend/src/pages/auth/HaPublishSettingsTab.tsx:47-48:
const plants = await listPlantInstances(0, PAGE_LIMIT);
return plants.map((p) => ({ key: p.key, label: getPlantLabel(p) })); // status dropped
It maps each plant to { key, label } only — the lifecycle status is discarded, and the only existing filter is a text search on the label (:147-150).
- The status data is already served.
PlantResponse exposes removed_on: date | None and termination_type: TerminationType | None (src/backend/app/api/v1/plant_instances/schemas.py:62-63). An active plant is one with removed_on == null and no termination_type; an inactive one has been removed/terminated.
- So this is primarily a frontend change: thread the status fields into the row, filter/mark by them, and adjust the "N von M veröffentlicht" count accordingly.
Proposed change
Frontend (HaPublishSettingsTab.tsx):
- Carry
removed_on / termination_type (or a derived isActive boolean) onto the row model instead of dropping them at :48.
- Default the plant list to active plants only.
- Add a filter control (e.g. a segmented toggle or checkbox: "Nur aktive" / "Alle anzeigen", i18n DE/EN) that reveals inactive plants on demand.
- When inactive plants are shown, mark them with a chip/badge (e.g. "Inaktiv" / "Entfernt am …" using
removed_on / the termination_type label) and visually de-emphasize the row.
- Make the "N von M veröffentlicht" counter and the bulk select-all operate over the currently visible (filtered) set, consistent with the existing search-filter behaviour.
- Mobile-first, i18n-complete.
Optional backend hardening (separate consideration): when a currently-published plant becomes inactive, the HA publish sync could stop exporting it (or retire its HA entity) so Home Assistant doesn't keep a stale sensor for a removed plant. Note this as a follow-up rather than bundling it in.
Acceptance criteria
Notes
- No new backend endpoint required for the core request —
removed_on / termination_type are already in PlantResponse.
- Aligns with the project's usability direction (don't surface irrelevant/dead entities; give the user a clear filter).
Summary
The HA-Veröffentlichung settings tab (
/settings#ha-publish→ PFLANZEN) lists every plant instance — including plants that are no longer active (harvested, senesced, died, or otherwise removed). A user shouldn't be pushing dead/removed plants to Home Assistant, and the flat list gives no way to tell active from inactive. Requested improvements:Grounding
src/frontend/src/pages/auth/HaPublishSettingsTab.tsx:47-48:{ key, label }only — the lifecycle status is discarded, and the only existing filter is a text search on the label (:147-150).PlantResponseexposesremoved_on: date | Noneandtermination_type: TerminationType | None(src/backend/app/api/v1/plant_instances/schemas.py:62-63). An active plant is one withremoved_on == nulland notermination_type; an inactive one has been removed/terminated.Proposed change
Frontend (
HaPublishSettingsTab.tsx):removed_on/termination_type(or a derivedisActiveboolean) onto the row model instead of dropping them at:48.removed_on/ thetermination_typelabel) and visually de-emphasize the row.Optional backend hardening (separate consideration): when a currently-published plant becomes inactive, the HA publish sync could stop exporting it (or retire its HA entity) so Home Assistant doesn't keep a stale sensor for a removed plant. Note this as a follow-up rather than bundling it in.
Acceptance criteria
Notes
removed_on/termination_typeare already inPlantResponse.