Skip to content

feat: configurable sensor display order#31

Merged
KadenThomp36 merged 1 commit into
mainfrom
feat/reorder-sensors
May 13, 2026
Merged

feat: configurable sensor display order#31
KadenThomp36 merged 1 commit into
mainfrom
feat/reorder-sensors

Conversation

@KadenThomp36
Copy link
Copy Markdown
Owner

Closes #19.

Summary

Adds an `order` config option so users can reorder which sensors appear first on the card.

Implementation

Uses flexbox `style.order` on each graph container rather than rebuilding the DOM — `.graphs` is already `display: flex` so this is a single-property set per metric and visually reflows them.

order:
  - temperature
  - humidity
  - co2
  - pm10
  - pm25

UX choices

  • Unmentioned metrics are preserved, appended in default order. Users never lose a sensor by forgetting it in `order` — important for an opt-in customization where forgetting one entry shouldn't silently hide a sensor.
  • Invalid metric names are dropped (no error), valid ones still applied.
  • Non-array input falls back to defaults (no error).

Test plan

  • `node test.js` — 221 passed, 0 failed (12 new: default order, full user override, partial override with unmentioned metrics, invalid metric names dropped, non-array input fallback, empty array fallback)
  • Manual smoke test in HA: configure the example from the issue (`T, H, CO2, PM10, PM2.5`) → verify the card visually reorders

Notes for maintainer

  • No `CARD_VERSION` bump — rolls into rc2
  • Independent of all other open PRs — no expected conflicts

@KadenThomp36 KadenThomp36 merged commit 9c8802c into main May 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to change order of sensors

1 participant