xiaohongshu
xiaohongshu
ha-validate-dashboards
Provides 3-tier validation approach for Home Assistant dashboards including pre-publish validation (entity checks, config structure), post-publish verification (log analysis), and visual validation (browser console, rendering). Use when validating HA dashboards, checking dashboard configs, verify...
Full skill instructions
Validates Home Assistant dashboard and configuration changes using a comprehensive 3-tier validation approach to catch errors before they impact users.
Run a complete validation before deploying a dashboard:
# 1. Validate config structure and entities (pre-publish)
python3 << 'EOF'
import json
with open('climate_dashboard.json') as f:
config = json.load(f)
from validation_helpers import validate_dashboard_config, verify_entities_exist, extract_all_entity_ids
is_valid, errors = validate_dashboard_config(config)
if not is_valid:
print("Config errors:", errors)
exit(1)
entities = extract_all_entity_ids(config)
existence = verify_entities_exist(entities)
missing = [e for e, exists in existence.items() if not exists]
if missing:
print("Missing entities:", missing)
exit(1)
print("✅ Pre-publish validation passed")
EOF
# 2. Publish dashboard
./run.sh dashboard_builder.py
# 3. Check HA logs (post-publish)
curl -s "http://192.168.68.123:8123/api/error_log" \
-H "Authorization: Bearer $HA_LONG_LIVED_TOKEN" | \
grep -i "lovelace" | tail -5
# 4. Visual validation (browser)
mcp-cli call claude-in-chrome/navigate '{"url": "http://192.168.68.123:8123/climate-dashboard"}'
sleep 2
mcp-cli call claude-in-chrome/read_console_messages '{}'
Explicit Triggers:
Implicit Triggers:
Debugging Triggers:
Use this skill to validate Home Assistant dashboards before deployment. Run the Quick Start workflow for a complete validation, or use individual tiers (pre-publish, post-publish, visual) for specific validation needs. Always run pre-publish validation first to catch config errors before they reach production.
Validate configuration and entities BEFORE publishing to Home Assistant.
Config Structure Validation:
def validate_dashboard_config(config: dict) -> tuple[bool, list[str]]:
"""Validate dashboard configuration structure."""
errors = []
if "views" not in config:
errors.append("Missing required 'views' key")
return False, errors
if not isinstance(config["views"], list):
errors.append("'views' must be a list")
return False, errors
for idx, view in enumerate(config["views"]):
if "title" not in view:
errors.append(f"View {idx}: Missing required 'title'")
if "cards" in view and not isinstance(view["cards"], list):
errors.append(f"View {idx}: 'cards' must be a list")
return len(errors) == 0, errors
Entity Existence Check:
def verify_entities_exist(entity_ids: list[str]) -> dict[str, bool]:
"""Check if entities exist via REST API."""
url = "http://192.168.68.123:8123/api/states"
headers = {"Authorization": f"Bearer {os.environ['HA_LONG_LIVED_TOKEN']}"}
response = requests.get(url, headers=headers, timeout=10)
existing_entities = {state["entity_id"] for state in response.json()}
return {
entity_id: entity_id in existing_entities
for entity_id in entity_ids
}
Extract All Entity IDs:
def extract_all_entity_ids(config: dict) -> list[str]:
"""Recursively extract all entity IDs from dashboard config."""
entity_ids = []
def extract_from_dict(d):
if isinstance(d, dict):
if "entity" in d and isinstance(d["entity"], str):
entity_ids.append(d["entity"])
if "entities" in d and isinstance(d["entities"], list):
for item in d["entities"]:
if isinstance(item, str):
entity_ids.append(item)
elif isinstance(item, dict) and "entity" in item:
entity_ids.append(item["entity"])
for value in d.values():
if isinstance(value, (dict, list)):
extract_from_dict(value)
elif isinstance(d, list):
for item in d:
extract_from_dict(item)
extract_from_dict(config)
return list(set(entity_ids))
Why Pre-Publish Validation Matters:
Monitor Home Assistant logs for errors after publishing dashboard changes.
Log Comparison Workflow:
# 1. Capture baseline errors before change
curl -s "http://192.168.68.123:8123/api/error_log" \
-H "Authorization: Bearer $HA_LONG_LIVED_TOKEN" > pre-change-errors.log
# 2. Make dashboard changes via WebSocket/API
# 3. Wait for errors to propagate
sleep 5
# 4. Capture post-change errors
curl -s "http://192.168.68.123:8123/api/error_log" \
-H "Authorization: Bearer $HA_LONG_LIVED_TOKEN" > post-change-errors.log
# 5. Compare for new errors
diff pre-change-errors.log post-change-errors.log
Key Error Patterns:
| Error Pattern | Meaning | Fix |
|---|---|---|
Custom element doesn't exist: custom:*-card | HACS card not installed/loaded | Install via HACS, clear cache |
Entity not available: sensor.* | Entity doesn't exist or offline | Check entity ID, verify device |
Error while loading page lovelace | Dashboard config syntax error | Check config structure |
Invalid configuration for card | Card validation failed | Review card schema |
Why Log Analysis Matters:
Use Chrome extension MCP tools to verify rendering and check browser console.
Browser Validation Workflow:
# 1. Navigate to dashboard
mcp-cli call claude-in-chrome/navigate '{
"url": "http://192.168.68.123:8123/climate-dashboard"
}'
# 2. Wait for page load
sleep 2
# 3. Check console for JavaScript errors
mcp-cli call claude-in-chrome/read_console_messages '{}'
# 4. Take screenshot for visual verification
mcp-cli call claude-in-chrome/computer '{
"action": "screenshot"
}'
# 5. Read page content to verify cards rendered
mcp-cli call claude-in-chrome/read_page '{}'
Console Error Interpretation:
| Console Error | Root Cause | Fix |
|---|---|---|
Custom element doesn't exist: custom:* | HACS card not loaded | Hard refresh (Ctrl+Shift+R) |
Uncaught TypeError: Cannot read property 'state' | Entity ID mismatch | Check entity via API |
Failed to fetch | Network/API connectivity | Check HA availability |
SyntaxError: Unexpected token | JSON config syntax error | Validate JSON structure |
When to Use Visual Testing:
Always use for:
Skip for:
Why Visual Validation Matters:
Fast validation for simple entity ID updates:
#!/bin/bash
# quick_validate.sh
DASHBOARD="climate-dashboard"
# Rebuild dashboard
./run.sh dashboard_builder.py
# Check logs for errors
if curl -s "http://192.168.68.123:8123/api/error_log" \
-H "Authorization: Bearer $HA_LONG_LIVED_TOKEN" | \
grep -i "error.*lovelace"; then
echo "❌ Errors in logs"
exit 1
fi
# Quick browser check
mcp-cli call claude-in-chrome/navigate "{\"url\": \"http://192.168.68.123:8123/$DASHBOARD\"}" > /dev/null
sleep 2
mcp-cli call claude-in-chrome/read_console_messages '{}' | grep -q '"level": "error"'
if [ $? -eq 0 ]; then
echo "❌ Console errors detected"
exit 1
fi
echo "✅ Quick validation passed"
Comprehensive validation for major dashboard updates. See references/workflows.md for the complete full validation script (full_validate.sh).
Key steps:
Build complex dashboards section by section with validation:
def build_dashboard_incrementally():
"""Build dashboard section by section with validation."""
cards = []
# Section 1: Temperature
temp_cards = create_temperature_section()
test_partial_dashboard("test-temp", temp_cards)
cards.extend(temp_cards)
# Section 2: Humidity
humidity_cards = create_humidity_section()
test_partial_dashboard("test-humidity", cards + humidity_cards)
cards.extend(humidity_cards)
# Final publish
publish_dashboard("climate-dashboard", {
"views": [{"title": "Climate", "cards": cards}]
})
| Failure Mode | Detection | Fix |
|---|---|---|
| Missing entity ID | API entity check | Fix entity ID typo |
| Invalid card type | Console error | Check spelling, verify HACS |
| Malformed JSON | WebSocket error | Validate JSON syntax |
| Missing required field | Pre-publish validation | Add required field |
| Failure Mode | Detection | Fix |
|---|---|---|
| Card not installed | Console, HACS check | Install via HACS |
| Card not loaded | Console, network tab | Hard refresh |
| Version incompatibility | Check versions | Update card or HA |
| Failure Mode | Detection | Fix |
|---|---|---|
| Entity unavailable | API state check | Check device connection |
| Entity renamed | API 404 | Update entity ID |
| Entity removed | Pre-publish check | Remove/update card |
Comprehensive reference documentation including:
When to read: Need API details, complete code examples, or advanced validation patterns.
Detailed workflow documentation including:
When to read: Setting up automation, implementing CI/CD, or need complete deployment scripts.
This skill integrates with the Home Assistant dashboard management workflow:
Integration Points:
Dashboard Builder Scripts (dashboard_builder.py)
publish_dashboard_safely() wrapperCard Utilities (ha_card_utils.py)
Chrome Extension (MCP tools)
CLAUDE.md Documentation
Example Integration:
# In dashboard_builder.py
from validation_helpers import validate_dashboard_config, verify_entities_exist
def build_climate_dashboard():
"""Build climate dashboard with validation."""
cards = create_climate_cards()
config = {"views": [{"title": "Climate", "cards": cards}]}
# Validate before publish
is_valid, errors = validate_dashboard_config(config)
if not is_valid:
print("❌ Validation failed:", errors)
return False
# Verify entities
entities = extract_all_entity_ids(config)
existence = verify_entities_exist(entities)
missing = [e for e, exists in existence.items() if not exists]
if missing:
print("❌ Missing entities:", missing)
return False
# Safe publish
success, msg = publish_dashboard_safely("climate-dashboard", config)
return success
pip install requests websocket-client
export HA_LONG_LIVED_TOKEN="your-token"
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