Skip to content

Solar System card: rotate, zoom, any date — planets, dwarf planets, asteroids, moons - #5

Merged
Lexorius merged 4 commits into
mainfrom
feat/solar-system-3d-card
Nov 28, 2026
Merged

Lexorius merged 4 commits into
mainfrom
feat/solar-system-3d-card

Conversation

@Lexorius

Copy link
Copy Markdown
Owner

Summary

Adds a Solar System dashboard card that ships with the integration: rotate and zoom, pick any date from 3000 BC to 3000 AD, switch planets, dwarf planets, asteroids and moons on and off. Pre-release 2.8.0-beta.1 — not yet seen inside a real dashboard, please test before it becomes 2.8.0.

type: custom:alternative-time-solar-system-card

What it does

  • Rotate and zoom: drag, mouse wheel, pinch or buttons; double-click centres on an object or opens a planet's moon system.
  • Any date: day, month and year fields (Julian calendar before 15 October 1582), a time-lapse, and Now.
  • Selectable objects: 8 planets, 9 dwarf planets and candidates, 13 asteroids, 21 moons. Moon systems of Earth, Mars, Jupiter, Saturn (with rings), Uranus, Neptune and Pluto are to scale.
  • Same HACS package: the integration serves frontend/ and registers the card as an extra frontend module. No second repository, no manual resource. Without web server or frontend the step is skipped and the sensors still load.
  • No recorder traffic: computed in the browser; no entity, no state.
  • Sources in the card: a fold-out lists where the numbers come from; clicking an object shows its accuracy.

Where the numbers come from

Objects Source Checked for Largest error
Planets NASA JPL, Approximate Positions of the Planets (Standish, Williams), table 2a/2b, used unchanged 3000 BC – 3000 AD 0.33°
Earth's Moon Meeus, Astronomical Algorithms, ch. 47 2000 BC – 2100 AD 0.06°
Pluto fitted to NASA JPL Horizons 0 – 3000 AD 0.2°
Other dwarf planets, asteroids fitted to NASA JPL Horizons 1600 – 2200 for most under 1° for most; Bennu 5.6°
Other moons circular orbits fitted to NASA JPL Horizons 1900 – 2100 under 2° for most; Triton's plane up to 19°

Outside its checked years an object is drawn hollow with a dashed orbit, because the position is then an extrapolation (Horizons has no asteroid positions before 1600). scripts/build_solar_system_data.py regenerates the data; the planet table is parsed from the JPL page, not retyped.

Tests

  • tests_js/ — the card's maths against 478 positions from JPL Horizons. New CI job (Node 22); the same file runs in a browser via tests_js/index.html.
  • tests_ha/ — in a real Home Assistant core (2026.2.3 locally) the card is registered exactly once and served as JavaScript: 14 passed.
  • tests/ — 181 passed, including packaging checks (every imported file is shipped, the sources are named).
  • Driven by hand on tests_js/demo.html: click, double-click, drag, wheel, date entry with error message, time-lapse, light and dark theme, English and German.

Not verified

  • The card inside a real Home Assistant dashboard (only on the demo page).
  • Pinch zoom with real touch input.
  • The Node runner itself: there is no Node on the dev machine, so this PR's CI is its first run.
  • Languages other than English and German fall back to English.

🤖 Generated with Claude Code

Thomas Kloppholz and others added 4 commits November 28, 2026 01:55
…teroids, moons

A dashboard card that ships with the integration (frontend/, plain custom
element and canvas, no dependencies, no build step). The integration serves
the folder and registers the card as an extra frontend module, so it needs
no second HACS entry and no manual resource. Skipped when Home Assistant
runs without web server or frontend.

- any date from 3000 BC to 3000 AD (Julian calendar before 15 Oct 1582),
  time-lapse, live mode
- 8 planets, 9 dwarf planets and candidates, 13 asteroids, 21 moons, each
  one switchable; moon systems of seven bodies to scale
- computed in the browser: no entity, no state, nothing in the recorder
- names its sources in the card and each object's checked years and error;
  outside the checked years an object is drawn hollow (extrapolated)

Orbit data (scripts/build_solar_system_data.py, needs network once):
- planets: NASA JPL "Approximate Positions of the Planets", table 2a/2b,
  parsed from the JPL page, not retyped
- small bodies: mean elements with linear rates (plus JPL's extra terms
  where they help) fitted to osculating elements from JPL Horizons
- moons: circular orbits fitted to JPL Horizons 1900-2100; Earth's Moon
  from Meeus ch. 47

Tests:
- tests_js/: the card's maths against 478 positions from JPL Horizons
  (new CI job, Node 22; also runs in a browser). Measured: planets at most
  0.33 deg, the Moon 0.06 deg.
- tests_ha/: in a real Home Assistant core the card is registered once and
  served as JavaScript; without frontend the sensors still come up.
- tests/: packaging (every imported file is shipped, sources are named).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hint below the picture

Seen in a real dashboard with a theme that sets --divider-color to transparent: buttons, inputs and separators had no outline at all. Outlines and fills are now derived from the text colour (color-mix, with a neutral grey fallback).

The wheel zoomed the card whenever the pointer was over it, and touch-action: none blocked swiping past it on a phone. Wheel and vertical swipes now scroll the page until the picture is clicked or tapped; leaving it with the mouse or focusing something else hands the wheel back.

Also: the usage hint moved from the picture to the info line, names near the right edge are drawn left of the dot instead of being cut off, and the picture is lower on narrow cards unless the YAML sets a height.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Lexorius
Lexorius merged commit c9f0c57 into main Nov 28, 2026
11 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.

1 participant