xiaohongshu
xiaohongshu
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 ...
Full skill instructions
Works with Python dashboard builders, ha_card_utils.py module, and Lovelace YAML dashboards.
Create a mini-graph-card with multiple entities that keeps its title static:
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
custom:mini-graph-card and multiple entitiesThis skill provides reusable utilities for creating Home Assistant Lovelace dashboard cards with:
All utilities are available in ha_card_utils.py and work with both Python dashboard builders and YAML configurations.
from ha_card_utils import add_static_title_to_mini_graph, add_color_gradient_to_mini_graph, create_bubble_separator, COLOR_SCHEMESSee Core Utilities section for detailed function usage.
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:
This is confusing because the title should indicate the time range, not which sensor is hovered.
Use card_mod with CSS to overlay static text using a ::after pseudo-element and hide the dynamic title.
CSS Pattern:
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:
::after pseudo-elementdisplay: noneSee references/static_title_technique.md for complete CSS explanation, DOM structure analysis, and alternative approaches.
Function: add_static_title_to_mini_graph(card: dict) -> dict
Forces mini-graph-card titles to remain static regardless of hover state.
Usage:
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:
Function: add_color_gradient_to_mini_graph(card: dict, thresholds: list[dict]) -> dict
Adds threshold-based color gradients to graphs for visual feedback.
Usage:
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:
Note: This removes fixed entity colors so the gradient can take effect.
Function: create_bubble_separator(name: str, icon: str, enhanced: bool = False) -> dict
Creates bubble-card separators for organizing dashboard sections.
Usage:
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:
When to Use:
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:
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:
Color Suggestions:
#e74c3c (Red) - Warnings, critical info#f1c40f (Yellow) - Cautions, tips#3498db (Blue) - Informational notes#2ecc71 (Green) - Success, good statusDisplay the same sensor data at three time ranges in a horizontal row:
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}],
}),
add_static_title_to_mini_graph({
"type": "custom:mini-graph-card",
"name": "Last 24 Hours",
"hours_to_show": 24,
"entities": [{"entity": entity_id, "name": entity_name}],
}),
add_static_title_to_mini_graph({
"type": "custom:mini-graph-card",
"name": "Last Week",
"hours_to_show": 168, # 7 days × 24 hours
"entities": [{"entity": entity_id, "name": entity_name}],
}),
],
}
When to Use:
Organize dashboard sections with enhanced separators and sub-sections:
from ha_card_utils import create_bubble_separator
section = {
"type": "vertical-stack",
"cards": [
# Major section header
create_bubble_separator("Temperature", "mdi:thermometer", enhanced=True),
# Sub-section label
{
"type": "custom:bubble-card",
"card_type": "separator",
"name": "Current Readings",
"icon": "mdi:home-thermometer",
},
# Sensor cards here...
# Sub-section label
{
"type": "custom:bubble-card",
"card_type": "separator",
"name": "Temperature History",
"icon": "mdi:chart-line",
},
# Graph row here...
],
}
Structure Pattern:
Complete sensor section combining current values, context, and history. See examples/complete-sections.md for full implementation.
Pattern:
The COLOR_SCHEMES dict provides preset thresholds for common sensor types.
Temperature: Cold (10°C, blue) → Comfortable (18°C, green) → Warm (26°C, yellow) → Hot (32°C, red)
Humidity: Dry (0%, red) → Low (30%, green) → Comfortable (60%, yellow) → High (80%, red)
Air Quality: Poor (low kΩ, red) → Moderate (orange) → Good (green) → Excellent (high kΩ, blue)
from ha_card_utils import COLOR_SCHEMES
# Use presets
temp_thresholds = [
COLOR_SCHEMES["temperature"]["cold"],
COLOR_SCHEMES["temperature"]["comfortable"],
COLOR_SCHEMES["temperature"]["warm"],
COLOR_SCHEMES["temperature"]["hot"],
]
# Or customize
custom_thresholds = [
{"value": 15, "color": "#3498db"},
{"value": 22, "color": "#2ecc71"},
{"value": 28, "color": "#e74c3c"},
]
See references/color_gradients.md for complete color palette and threshold recommendations.
✓ Static Title Applied
Card: "Last 24 Hours"
Has card_mod: True
CSS injected: .header .name::after
✓ Color Gradient Applied
Thresholds: 4 levels (Cold/Comfortable/Warm/Hot)
Entity colors removed: True
Gradient active: True
✓ Section Created
Cards: 8 (separator, sub-headers, sensors, graphs)
Three-graph row: 1hr, 24hr, 1wk
All titles static: True
Issue: Title still changes on hover
Issue: Color gradient not visible
add_color_gradient_to_mini_graph() removes entity colors automaticallyIssue: Separator not showing gradient
enhanced=False or card-mod not appliedcreate_bubble_separator(name, icon, enhanced=True)websocket-client - For WebSocket API communicationha_card_utils.py - Core utilities module
~/.claude/skills/ha-dashboard-cards/ha_card_utils.py)~/projects/play/ha/ha_card_utils.py)CLAUDE.md - Project configuration with HA instance details (in HA project)add_static_title_to_mini_graph() when showing multiple entitiesCOLOR_SCHEMES for consistency across dashboardsfrom ha_card_utils import ... at top of file{{ and }} to escape braces in f-stringscontent value in card_mod must match the name value for consistencydashboard_builder.py as the single source of truth for programmatically managed dashboardsha_card_utils.py and dashboard builders to git for reproducibilityApplied Successfully:
Dashboard URL: http://192.168.68.123:8123/enviro-plus/new-panel
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience