Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,35 @@ showcase updates itself. (Manual local regen still works too; the sandbox needs

Newest first. One short entry per working session: what shipped + open threads.

### 2026-07-21 — Sun card: moon-phase view after sunset (v0.17.0)
- **User:** refactor the sun card to also show moon phases / rise / set, with an
option to show the moon info after sunset. Kept the daytime sun-path arc as-is
and added a **night moon view** gated by `show_moon` (default true) + a moon
sensor being present.
- `prism-sun-card` now branches in `_render`: daytime → `_sunView` (the existing
arc, extracted verbatim into a method); after sunset (state `below_horizon` /
elevation ≤ 0) with `show_moon` on and the moon entity available → `_moonView`.
The moon view draws a **moon-phase glyph** via `moonLitPath(cx,cy,r,k)` (outer
semicircle on the lit side + a terminator half-ellipse of x-radius
`|cos(2πk)|·r`; waxing lights the right), with new-moon = nothing lit and
full-moon = full circle special-cased. Shows illumination % (from an optional
sensor, else computed `(1-cos2πk)/2`), the phase label, the next sunrise, and a
moonrise/moonset subrow when those sensors are configured. `moonInfo()` maps
the 8 HA phase names (or a numeric phase) → `{label, k}`.
- Config adds `show_moon`, `moon_entity` (default `sensor.moon`), `moonrise_entity`,
`moonset_entity`, `moon_illumination_entity`. Editor gains a **Moon** section
(switch + 4 pickers + hint). `getStubConfig` sets `moon_entity` when
`sensor.moon` exists. Moon colours are theme-safe (`#cdd6e5` lit + `--_text-2`
outline, `--_surface-2` unlit disk), moon icons use `--_text-2` (not accent).
- Wired: smoke gains a `sun.night` + `sensor.moon`/moonrise/moonset fixtures and
2 cases; preview gains a `sun.after_sunset` + moon mocks and a "Sun & Moon"
demo (renders offline, so the showcase picks it up). README table + quick-start,
docs/cards.md option table + example. VERSION 0.16.5 → 0.17.0.
- Verified in real Chromium across all **8 phases**: moon view active at night,
correct lit geometry (first/last quarter = half-width, gibbous > half, full =
circle, crescents thin), illumination 0→100%, phase labels, moonrise/moonset
subrow, zero console errors. `bash build.sh` + `node test/smoke.js` green.

### 2026-07-21 — Editor icon fields: HA icon-picker dropdown w/ fallback (v0.16.5)
- **User:** can the visual editor use the icon picker dropdown? Added a shared
`_iconField(value, onChange, label?)` on `PrismEditor`: uses HA's searchable
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Prism is two things working together:
| **Wind** | `custom:prism-wind-card` | Wind tile: dominant speed, a flat compass rose with an accent direction arrow, Beaufort descriptor, gusts, and animated flat wind-streak accents that intensify with the wind. Reads a `weather.*` entity or individual sensors. |
| **Weather** | `custom:prism-weather-card` | Current-conditions tile: big temperature, a flat animated condition icon, feels-like + today's high/low, and humidity / wind / pressure chips. Reads a `weather.*` entity. |
| **Forecast** | `custom:prism-forecast-card` | Daily or hourly forecast strip: a flat condition icon per period, high/low temps, and precipitation-chance chips. Reads a `weather.*` entity **or** the free US National Weather Service API (weather.gov). |
| **Sun** | `custom:prism-sun-card` | Sun-path arc: sunrise/sunset times, the sun riding its arc (a moon below the horizon at night), the traveled portion filled with the accent, and a live "sets in / rises in" countdown. Reads `sun.sun`. |
| **Sun** | `custom:prism-sun-card` | Sun-path arc: sunrise/sunset times, the sun riding its arc, the traveled portion filled with the accent, and a live "sets in / rises in" countdown. After sunset it can flip to a moon-phase view (phase, illumination, moonrise/moonset). Reads `sun.sun` (+ optional `sensor.moon`). |
| **UV** | `custom:prism-uv-card` | UV-index tile: a big value coloured by its WHO risk band, the category + sun-protection advice, and a flat UV-ramp scale (green→purple) with a value marker. Reads a UV sensor or a `weather.*` `uv_index`. |
| **Rain** | `custom:prism-rain-card` | Animated rain-gauge tile: a measuring cylinder that fills with the event total, raindrops falling in at a rate set by the intensity, the event amount + a rain-rate descriptor, and chips for hourly / 24h / weekly / monthly. |
| **Air Quality** | `custom:prism-aqi-card` | AQI tile: a big value coloured by its US EPA category, the category + health advice, and a flat Good→Hazardous scale with a value marker. Reads an AQI sensor. |
Expand Down Expand Up @@ -229,10 +229,15 @@ title: UV Index

```yaml
# Sun — sunrise/sunset arc with a live countdown. Reads sun.sun.
# After sunset it can show the moon phase (needs the Moon integration).
type: custom:prism-sun-card
entity: sun.sun
title: Sun
accent: amber
show_moon: true # after sunset: moon phase + illumination
moon_entity: sensor.moon # optional (defaults to sensor.moon)
# moonrise_entity: sensor.moonrise # optional
# moonset_entity: sensor.moonset # optional
```

```yaml
Expand Down
23 changes: 21 additions & 2 deletions docs/cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,16 +542,23 @@ units: us

## `custom:prism-sun-card`

Flat **sun-path arc**: a dome of the sky from sunrise to sunset with the sun riding along it (a moon below the horizon at night), the **traveled portion filled with the accent**, **sunrise/sunset times** at each end, and a live **"sets in / rises in"** countdown in the middle.
Flat **sun-path arc**: a dome of the sky from sunrise to sunset with the sun riding along it, the **traveled portion filled with the accent**, **sunrise/sunset times** at each end, and a live **"sets in / rises in"** countdown in the middle.

Optionally, **after sunset** it flips to a **moon view**: a moon-phase glyph drawn to the current illuminated fraction, the phase name + **illumination %**, the next **sunrise**, and — when their sensors are configured — **moonrise / moonset**.

| Key | Type | Default | Notes |
|-----|------|---------|-------|
| `entity` | string | `sun.sun` | The sun entity. Uses its `next_rising`, `next_setting`, `elevation`, and state. |
| `name` | string | friendly name | Used in the accessible label. |
| `title` | string | — | Card header. |
| `accent` | string | `amber` | Colours the traveled arc and the sun. |
| `show_moon` | bool | `true` | After sunset, show the moon view instead of the resting sun arc. |
| `moon_entity` | string | `sensor.moon` | Moon-phase sensor (the Moon integration's `sensor.moon`). Its state is a phase name like `waxing_gibbous`, or a numeric phase. |
| `moonrise_entity` | string | — | Optional sensor with a moonrise timestamp. |
| `moonset_entity` | string | — | Optional sensor with a moonset timestamp. |
| `moon_illumination_entity` | string | — | Optional illumination-% sensor. If unset, illumination is computed from the phase. |

Daytime progress uses the next setting as today's sunset and approximates today's sunrise from the next rising; at night the arc rests and a moon sits on the horizon. Tap opens more-info.
Daytime progress uses the next setting as today's sunset and approximates today's sunrise from the next rising. At night, with `show_moon` on and a moon sensor available, the card shows the moon phase; otherwise the arc rests with a moon on the horizon. Tap opens more-info.

```yaml
type: custom:prism-sun-card
Expand All @@ -560,6 +567,18 @@ title: Sun
accent: amber
```

```yaml
# With moon phase after sunset (needs the Moon integration for sensor.moon).
type: custom:prism-sun-card
entity: sun.sun
title: Sun & Moon
accent: amber
show_moon: true
moon_entity: sensor.moon
moonrise_entity: sensor.moonrise # optional
moonset_entity: sensor.moonset # optional
```

---

## `custom:prism-uv-card`
Expand Down
Loading
Loading