ha-dashboard-cards
Creates Home Assistant dashboard cards programmatically using ha_card_utils.py utilities for static titles (fixes dynamic hover), color gradients (threshold-based), section separators (bubble-card), and info cards (markdown). Use when asked to "fix mini-graph title changing", "add color gradient to graph", "create dashboard section", "static title card_mod", or "organize dashboard with separators".
What this skill does
Works with Python dashboard builders, ha_card_utils.py module, and Lovelace YAML dashboards.
# Home Assistant Dashboard Cards
## Quick Start
Create a mini-graph-card with multiple entities that keeps its title static:
```python
from ha_card_utils import add_static_title_to_mini_graph
card = {
"type": "custom:mini-graph-card",
"name": "Last 24 Hours",
"hours_to_show": 24,
"entities": [
{"entity": "sensor.office_temperature", "name": "Office"},
{"entity": "sensor.bedroom_temperature", "name": "Bedroom"},
],
}
add_static_title_to_mini_graph(card)
# Title now stays "Last 24 Hours" instead of changing to "Office"/"Bedroom" on hover
```
## Table of Contents
1. When to Use This Skill
2. What This Skill Does
3. The Static Title Problem
4. Core Utilities
4.1. Static Title Fix
4.2. Color Gradients
4.3. Section Separators
4.4. Info Cards
5. Common Patterns
5.1. Three-Graph Layout (1hr, 24hr, 1wk)
5.2. Section Structure with Separators
5.3. Sensor Sections with History
6. Color Scheme Presets
7. Supporting Files
8. Expected Outcomes
9. Requirements
10. Red Flags to Avoid
## When to Use This Skill
### Explicit Triggers
- "Create HA dashboard cards"
- "Add mini-graph-card with static title"
- "Add color gradient to graph"
- "Create dashboard section with separator"
- "Fix mini-graph title changing on hover"
### Implicit Triggers
- Building Home Assistant dashboards programmatically
- Working with `custom:mini-graph-card` and multiple entities
- Creating sensor history graphs with time ranges
- Organizing dashboard sections visually
- Adding context/explanation cards to dashboards
### Problem Detection
- User reports mini-graph-card titles changing dynamically
- Dashboard needs visual thresholds (color-coded values)
- Need consistent section organization across dashboards
- Multiple graphs showing same data at different time ranges
## What This Skill Does
This skill provides reusable utilities for creating Home Assistant Lovelace dashboard cards with:
1. **Static Titles** - Prevents mini-graph-card from changing titles on hover
2. **Color Gradients** - Adds threshold-based color coding to graphs
3. **Section Separators** - Creates visual section headers with icons
4. **Info Cards** - Adds informational cards with colored borders
5. **Common Patterns** - Implements standard layouts (3-graph rows, sensor sections)
All utilities are available in `ha_card_utils.py` and work with both Python dashboard builders and YAML configurations.
## Usage
1. **Import utilities**: `from ha_card_utils import add_static_title_to_mini_graph, add_color_gradient_to_mini_graph, create_bubble_separator, COLOR_SCHEMES`
2. **Choose utility**: Static title (hover fix), color gradient (thresholds), separator (sections), info card (context)
3. **Apply to card**: Pass card dict to utility function, it modifies in place
4. **Save dashboard**: Use WebSocket API or manual YAML to save configuration
5. **Verify**: Check dashboard, test hover behavior, validate colors display correctly
See Core Utilities section for detailed function usage.
## The Static Title Problem
### The Problem
When `custom:mini-graph-card` displays multiple entities, hovering over different sensor lines causes the card title to dynamically change to the entity name.
**Example:**
- Card title: "Last 24 Hours"
- Entities: Office (green), Bedroom (blue)
- Hover over Office line → title changes to "Office"
- Hover over Bedroom line → title changes to "Bedroom"
This is confusing because the title should indicate the time range, not which sensor is hovered.
### The Solution
Use `card_mod` with CSS to overlay static text using a `::after` pseudo-element and hide the dynamic title.
**CSS Pattern:**
```yaml
card_mod:
style: |
.header .name {
visibility: visible !important;
}
.header .name::after {
content: "Last 24 Hours" !important;
visibility: visible !important;
}
.header .name > * {
display: none !important;
}
```
**How It Works:**
1. Keep header container visible
2. Inject static text via `::after` pseudo-element
3. Hide dynamic child elements with `display: none`
### Technical Deep Dive
See `references/static_title_technique.md` for complete CSS explanation, DOM structure analysis, and alternative approaches.
## Core Utilities
### 4.1. Static Title Fix
**Function:** `add_static_title_to_mini_graph(card: dict) -> dict`
Forces mini-graph-card titles to remain static regardless of hover state.
**Usage:**
```python
from ha_card_utils import add_static_title_to_mini_graph
card = {
"type": "custom:mini-graph-card",
"name": "Last Hour",
"hours_to_show": 1,
"entities": [
{"entity": "sensor.temperature", "name": "Office"},
],
}
add_static_title_to_mini_graph(card)
# Adds card_mod CSS to force static title
```
**When to Use:**
- Any mini-graph-card with multiple entities
- Time-range graphs (Last Hour, Last 24 Hours, Last Week)
- Comparison graphs showing multiple sensors
### 4.2. Color Gradients
**Function:** `add_color_gradient_to_mini_graph(card: dict, thresholds: list[dict]) -> dict`
Adds threshold-based color gradients to graphs for visual feedback.
**Usage:**
```python
from ha_card_utils import add_color_gradient_to_mini_graph
thresholds = [
{"value": 0, "color": "#3498db"}, # Blue: Cold
{"value": 20, "color": "#2ecc71"}, # Green: Comfortable
{"value": 30, "color": "#e74c3c"}, # Red: Hot
]
add_color_gradient_to_mini_graph(card, thresholds)
```
**When to Use:**
- Temperature graphs (cold/comfortable/hot zones)
- Air quality sensors (good/moderate/poor ranges)
- Battery levels (full/medium/low/critical)
- Any sensor with meaningful value thresholds
**Note:** This removes fixed entity colors so the gradient can take effect.
### 4.3. Section Separators
**Function:** `create_bubble_separator(name: str, icon: str, enhanced: bool = False) -> dict`
Creates bubble-card separators for organizing dashboard sections.
**Usage:**
```python
from ha_card_utils import create_bubble_separator
# Standard separator
separator = create_bubble_separator("Temperature", "mdi:thermometer")
# Enhanced separator with gradient background
separator = create_bubble_separator(
"Temperature",
"mdi:thermometer",
enhanced=True
)
```
**Enhanced Features:**
- Gradient background with spacing
- Larger font and bold text
- Thicker separator line
**When to Use:**
- Major section headers (enhanced=True)
- Sub-section labels (enhanced=False)
- Organizing related cards into groups
### 4.4. Info Cards
**Function:** `create_info_card(content: str, border_color: str, background_color: str | None = None) -> dict`
Creates markdown cards with colored borders for explanations and context.
**Usage:**
```python
from ha_card_utils import create_info_card
info = create_info_card(
"**Lower resistance = more pollution.** Good air quality: >100 kΩ",
"#e74c3c" # Red border
)
```
**When to Use:**
- Explaining sensor readings
- Providing context for air quality/gas sensors
- Warning messages or alerts
- Instructions for manual controls
**Color Suggestions:**
- `#e74c3c` (Red) - Warnings, critical info
- `#f1c40f` (Yellow) - Cautions, tips
- `#3498db` (Blue) - Informational notes
- `#2ecc71` (Green) - Success, good status
## Common Patterns
### 5.1. Three-Graph Layout (1hr, 24hr, 1wk)
Display the same sensor data at three time ranges in a horizontal row:
```python
from ha_card_utils import add_static_title_to_mini_graph
def create_three_graph_row(entity_id: str, entity_name: str):
"""Create 3 graphs showing 1 hour, 24 hours, and 1 week."""
return {
"type": "horizontal-stack",
"cards": [
add_static_title_to_mini_graph({
"type": "custom:mini-graph-card",
"name": "Last Hour",
"hours_to_show": 1,
"entities": [{"entity": entity_id, "name": entity_name}],
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.