Add multi-day history rings + fix HA editor dropdown components#6
Merged
Conversation
- Replace deprecated ha-select/mwc-list-item with ha-selector (select type) throughout the visual editor; replace ha-select booleans with ha-formfield+ha-switch - Add _getHistoryForDay() method for per-day cached history fetching - Rewrite _buildLayerData() to pre-expand layers with days>1 into N concentric rings (one per day), sharing min/max scale across the group - Add multi-day opacity fade (day_fade, day_fade_step) for older day rings - Guard stats markers to today ring only in multi-day mode - Add _renderDayLabel() for relative/date format labels on day rings - Add multi-day editor section with days, fade, labels, format, position controls - Guard History day selector and Keep across midnight to single-day mode only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
days: N. Outer ring = today, inner rings = progressively older days. Includes shared min/max scaling across the group, configurable opacity fade for older rings, and optional day labels.ha-select/mwc-list-itempatterns withha-selector(select type), and replaced booleanha-selectfields withha-switch. This resolves visual editor dropdowns that stopped working in recent HA versions.Background
This reimplements PR #4 (multi-day rings). That PR was closed because the local development repo was accidentally deleted. This is a clean reimplementation against the current v1.0.8 Beta codebase.
Changes
dist/andy-stats-clock.jsEditor fixes
ha-select/mwc-list-itemreplaced withha-selector(select type) for: clock mode, layer type, value source, history day, color mode, center layer type, bottom layer type, day label format, day label positionha-selectfields replaced withha-switchfor: show hour labels, show minute ticks, hands share center pivot, enable hour/minute/second hand, center show icon, bottom show iconMulti-day rings
_getHistoryForDay(lc, hass, stateObj, dayOffset)- fetches and caches one day's hourly buckets per ring. Cache keys are scoped per entity + layer + day offset + segment count. TTL: 5 min for today, 10 min for past days. Includes forward/backward fill and future-hour nulling for today._buildLayerData()rewritten to pre-expand layers withdays > 1into N entries before radius assignment, so each day-ring occupies its own concentric slot. A second pass shares min/max across the group for a consistent color scale._renderDayLabel(cfg, layer)- SVG text label at ring midpoint in relative ("Today", "Yesterday", "2d ago") or date ("Jan 15") format.days > 1.CHANGELOG.md(new)Documents both the editor fixes and the multi-day feature.
MULTI-DAY-RINGS.md(new)Proposed documentation for the README - config reference table and YAML examples. The maintainer can copy the relevant sections directly into README.md.
New layer config keys
days1day_fadetrueday_fade_step0.25base * max(0, 1 - dayIndex * step).day_labelsfalseday_label_formatrelativerelative(Today / Yesterday / Nd ago) ordate(Jan 15).day_label_positionrightright,left,top,bottom.day_label_font_size3day_label_colorrgba(255,255,255,0.7)