ha-validate-dashboards

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Home Assistant Dashboard Validation

Home Assistant 仪表盘验证

Validates Home Assistant dashboard and configuration changes using a comprehensive 3-tier validation approach to catch errors before they impact users.
采用全面的三层验证方案来验证Home Assistant仪表盘及配置变更,在错误影响用户之前及时发现问题。

Quick Start

快速开始

Run a complete validation before deploying a dashboard:
bash
undefined
在部署仪表盘前运行完整验证:
bash
undefined

1. Validate config structure and entities (pre-publish)

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
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

2. Publish dashboard

./run.sh dashboard_builder.py
./run.sh dashboard_builder.py

3. Check HA logs (post-publish)

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
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)

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 '{}'
undefined
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 '{}'
undefined

Table of Contents

目录

  1. When to Use This Skill
  2. The 3-Tier Validation Approach
  3. Validation Workflows
  4. Common Failure Modes
  5. Supporting Files
  6. Integration with Project
  7. Requirements
  8. Red Flags to Avoid
  1. 适用场景
  2. 三层验证方案
  3. 验证工作流
  4. 常见故障模式
  5. 支持文件
  6. 项目集成
  7. 要求
  8. 需避免的错误做法

When to Use This Skill

适用场景

Explicit Triggers:
  • "validate my dashboard"
  • "check HA dashboard config"
  • "verify dashboard entities"
  • "validate before publish"
Implicit Triggers:
  • Before deploying dashboard changes
  • After modifying dashboard builder scripts
  • Before committing dashboard code changes
Debugging Triggers:
  • Dashboard shows "Entity not available"
  • Cards fail to render or show error states
  • Console shows JavaScript errors
  • HACS card doesn't appear after installation
明确触发场景:
  • "验证我的仪表盘"
  • "检查HA仪表盘配置"
  • "验证仪表盘实体"
  • "发布前验证"
隐含触发场景:
  • 部署仪表盘变更前
  • 修改仪表盘构建脚本后
  • 提交仪表盘代码变更前
调试触发场景:
  • 仪表盘显示「实体不可用」
  • 卡片无法渲染或显示错误状态
  • 控制台显示JavaScript错误
  • 安装HACS卡片后未显示

Usage

使用方法

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.
使用本方案在部署前验证Home Assistant仪表盘。运行快速开始工作流进行完整验证,或使用单独的验证层(发布前、发布后、可视化)满足特定验证需求。始终先运行发布前验证,在配置错误进入生产环境前将其捕获。

The 3-Tier Validation Approach

三层验证方案

Tier 1: Pre-Publish Validation (API-Based)

第一层:发布前验证(基于API)

Validate configuration and entities BEFORE publishing to Home Assistant.
Config Structure Validation:
python
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:
python
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:
python
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:
  • Catches config errors before they reach HA
  • Prevents "Entity not available" errors in production
  • Verifies HACS cards are installed
  • Fast feedback loop (API calls only)
在发布到Home Assistant之前验证配置和实体。
配置结构验证:
python
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
实体存在性检查:
python
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
    }
提取所有实体ID:
python
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))
发布前验证的重要性:
  • 在配置进入HA前捕获错误
  • 避免生产环境出现「实体不可用」错误
  • 验证HACS卡片已安装
  • 快速反馈循环(仅需API调用)

Tier 2: Post-Publish Verification (Log Analysis)

第二层:发布后验证(日志分析)

Monitor Home Assistant logs for errors after publishing dashboard changes.
Log Comparison Workflow:
bash
undefined
在发布仪表盘变更后监控Home Assistant日志中的错误。
日志对比工作流:
bash
undefined

1. Capture baseline errors before change

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
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

2. Make dashboard changes via WebSocket/API

3. Wait for errors to propagate

3. Wait for errors to propagate

sleep 5
sleep 5

4. Capture post-change errors

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
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

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:**
- Detects runtime errors that pre-publish checks miss
- Catches integration-specific issues
- Provides detailed error messages for debugging
- Confirms changes didn't break existing functionality
diff pre-change-errors.log post-change-errors.log

**关键错误模式:**

| 错误模式 | 含义 | 修复方法 |
|---------------|---------|-----|
| `Custom element doesn't exist: custom:*-card` | HACS卡片未安装/加载 | 通过HACS安装,清除缓存 |
| `Entity not available: sensor.*` | 实体不存在或离线 | 检查实体ID,验证设备状态 |
| `Error while loading page lovelace` | 仪表盘配置语法错误 | 检查配置结构 |
| `Invalid configuration for card` | 卡片验证失败 | 查看卡片 schema |

**日志分析的重要性:**
- 检测发布前检查未发现的运行时错误
- 捕获集成特定问题
- 提供详细错误信息用于调试
- 确认变更未破坏现有功能

Tier 3: Visual Validation (Browser Automation)

第三层:可视化验证(浏览器自动化)

Use Chrome extension MCP tools to verify rendering and check browser console.
Browser Validation Workflow:
bash
undefined
使用Chrome扩展MCP工具验证渲染情况并检查浏览器控制台。
浏览器验证工作流:
bash
undefined

1. Navigate to dashboard

1. Navigate to dashboard

mcp-cli call claude-in-chrome/navigate '{ "url": "http://192.168.68.123:8123/climate-dashboard" }'
mcp-cli call claude-in-chrome/navigate '{ "url": "http://192.168.68.123:8123/climate-dashboard" }'

2. Wait for page load

2. Wait for page load

sleep 2
sleep 2

3. Check console for JavaScript errors

3. Check console for JavaScript errors

mcp-cli call claude-in-chrome/read_console_messages '{}'
mcp-cli call claude-in-chrome/read_console_messages '{}'

4. Take screenshot for visual verification

4. Take screenshot for visual verification

mcp-cli call claude-in-chrome/computer '{ "action": "screenshot" }'
mcp-cli call claude-in-chrome/computer '{ "action": "screenshot" }'

5. Read page content to verify cards rendered

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:
- Major dashboard restructuring
- New custom cards from HACS
- card_mod CSS customizations
- After updating HACS cards

Skip for:
- Simple entity ID changes
- Backend configuration
- Non-frontend changes

**Why Visual Validation Matters:**
- Catches rendering issues that API checks miss
- Verifies card styling and layout
- Confirms HACS cards loaded correctly
- Provides visual proof of correctness
mcp-cli call claude-in-chrome/read_page '{}'

**控制台错误解读:**

| 控制台错误 | 根本原因 | 修复方法 |
|---------------|------------|-----|
| `Custom element doesn't exist: custom:*` | HACS卡片未加载 | 强制刷新(Ctrl+Shift+R) |
| `Uncaught TypeError: Cannot read property 'state'` | 实体ID不匹配 | 通过API检查实体 |
| `Failed to fetch` | 网络/API连接问题 | 检查HA可用性 |
| `SyntaxError: Unexpected token` | JSON配置语法错误 | 验证JSON结构 |

**可视化测试的适用场景:**

以下场景必须使用:
- 仪表盘重大重构
- 来自HACS的新自定义卡片
- card_mod CSS自定义
- 更新HACS卡片后

以下场景可跳过:
- 简单的实体ID变更
- 后端配置变更
- 非前端变更

**可视化验证的重要性:**
- 捕获API检查未发现的渲染问题
- 验证卡片样式和布局
- 确认HACS卡片已正确加载
- 提供正确性的视觉证明

Validation Workflows

验证工作流

Quick Validation (Minor Changes)

快速验证(小变更)

Fast validation for simple entity ID updates:
bash
#!/bin/bash
针对简单实体ID更新的快速验证:
bash
#!/bin/bash

quick_validate.sh

quick_validate.sh

DASHBOARD="climate-dashboard"
DASHBOARD="climate-dashboard"

Rebuild dashboard

Rebuild dashboard

./run.sh dashboard_builder.py
./run.sh dashboard_builder.py

Check logs for errors

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
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

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"
undefined
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"
undefined

Full Validation (Major Changes)

完整验证(大变更)

Comprehensive validation for major dashboard updates. See
references/workflows.md
for the complete full validation script (full_validate.sh).
Key steps:
  1. Pre-publish validation (config + entities)
  2. Publish to production
  3. Check HA logs for new errors
  4. Automated browser validation
  5. Take screenshot for visual confirmation
针对仪表盘重大更新的全面验证。完整的完整验证脚本(full_validate.sh)请参考
references/workflows.md
关键步骤:
  1. 发布前验证(配置+实体)
  2. 发布到生产环境
  3. 检查HA日志中的新错误
  4. 自动化浏览器验证
  5. 截图用于视觉确认

Incremental Testing

增量测试

Build complex dashboards section by section with validation:
python
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}]
    })
分部分构建复杂仪表盘并进行验证:
python
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}]
    })

Common Failure Modes

常见故障模式

Configuration Errors

配置错误

Failure ModeDetectionFix
Missing entity IDAPI entity checkFix entity ID typo
Invalid card typeConsole errorCheck spelling, verify HACS
Malformed JSONWebSocket errorValidate JSON syntax
Missing required fieldPre-publish validationAdd required field
故障模式检测方式修复方法
缺少实体IDAPI实体检查修正实体ID拼写错误
无效卡片类型控制台错误检查拼写,验证HACS配置
JSON格式错误WebSocket错误验证JSON语法
缺少必填字段发布前验证添加必填字段

HACS Card Issues

HACS卡片问题

Failure ModeDetectionFix
Card not installedConsole, HACS checkInstall via HACS
Card not loadedConsole, network tabHard refresh
Version incompatibilityCheck versionsUpdate card or HA
故障模式检测方式修复方法
卡片未安装控制台、HACS检查通过HACS安装
卡片未加载控制台、网络面板强制刷新
版本不兼容版本检查更新卡片或HA

Entity Issues

实体问题

Failure ModeDetectionFix
Entity unavailableAPI state checkCheck device connection
Entity renamedAPI 404Update entity ID
Entity removedPre-publish checkRemove/update card
故障模式检测方式修复方法
实体不可用API状态检查检查设备连接
实体重命名API 404错误更新实体ID
实体已移除发布前检查删除或更新卡片

Supporting Files

支持文件

references/validation-reference.md

references/validation-reference.md

Comprehensive reference documentation including:
  • REST API endpoint reference (full request/response examples)
  • WebSocket API command reference (auth flow, dashboard operations)
  • MCP Chrome extension tool details (all available tools)
  • Complete validation function implementations
  • Entity state validation patterns
  • Log analysis techniques and Python helpers
When to read: Need API details, complete code examples, or advanced validation patterns.
全面的参考文档,包括:
  • REST API端点参考(完整请求/响应示例)
  • WebSocket API命令参考(认证流程、仪表盘操作)
  • MCP Chrome扩展工具详情(所有可用工具)
  • 完整的验证函数实现
  • 实体状态验证模式
  • 日志分析技术和Python辅助工具
阅读时机: 需要API详情、完整代码示例或高级验证模式时。

references/workflows.md

references/workflows.md

Detailed workflow documentation including:
  • Pre-commit validation checklist
  • Rollback strategy and procedures (backup/restore)
  • Complete end-to-end deployment workflow
  • CI/CD integration patterns (GitHub Actions, pre-commit hooks)
  • Automated testing scripts (validate_all.py, check_entities.py)
When to read: Setting up automation, implementing CI/CD, or need complete deployment scripts.
详细的工作流文档,包括:
  • 提交前验证清单
  • 回滚策略和流程(备份/恢复)
  • 完整的端到端部署工作流
  • CI/CD集成模式(GitHub Actions、提交前钩子)
  • 自动化测试脚本(validate_all.py、check_entities.py)
阅读时机: 设置自动化、实现CI/CD或需要完整部署脚本时。

Integration with Project

项目集成

This skill integrates with the Home Assistant dashboard management workflow:
Integration Points:
  1. Dashboard Builder Scripts (
    dashboard_builder.py
    )
    • Add validation calls before publishing
    • Use
      publish_dashboard_safely()
      wrapper
  2. Card Utilities (
    ha_card_utils.py
    )
    • Validation helpers can be added here
    • Keep utilities project-specific
  3. Chrome Extension (MCP tools)
    • Use for visual validation
    • Check console errors, take screenshots
  4. CLAUDE.md Documentation
    • Update validation checklist
    • Document validation commands
Example Integration:
python
undefined
本方案可集成到Home Assistant仪表盘管理工作流中:
集成点:
  1. 仪表盘构建脚本
    dashboard_builder.py
    • 在发布前添加验证调用
    • 使用
      publish_dashboard_safely()
      包装器
  2. 卡片工具类
    ha_card_utils.py
    • 可在此添加验证辅助函数
    • 保持工具类与项目相关
  3. Chrome扩展(MCP工具)
    • 用于可视化验证
    • 检查控制台错误、截图
  4. CLAUDE.md文档
    • 更新验证清单
    • 记录验证命令
集成示例:
python
undefined

In dashboard_builder.py

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
undefined
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
undefined

Requirements

要求

Environment

环境

  • Home Assistant 2025.12.3+ (WebSocket/REST API)
  • Python 3.11+ (validation scripts)
  • Chrome browser with Claude extension (visual testing)
  • MCP CLI installed and configured
  • Home Assistant 2025.12.3+(WebSocket/REST API)
  • Python 3.11+(验证脚本)
  • 安装Claude扩展的Chrome浏览器(可视化测试)
  • MCP CLI已安装并配置

Dependencies

依赖

bash
pip install requests websocket-client
export HA_LONG_LIVED_TOKEN="your-token"
bash
pip install requests websocket-client
export HA_LONG_LIVED_TOKEN="your-token"

Knowledge Required

必备知识

  • Basic Python programming
  • Home Assistant entity ID format
  • Dashboard config structure (views, cards)
  • curl and bash scripting basics
  • 基础Python编程
  • Home Assistant实体ID格式
  • 仪表盘配置结构(视图、卡片)
  • curl和bash脚本基础

Red Flags to Avoid

需避免的错误做法

  • Skipping pre-publish validation - Always validate BEFORE deploying
  • Ignoring entity existence checks - Missing entities cause runtime errors
  • Not checking HACS cards - Custom cards must be installed first
  • Skipping log analysis - New errors won't be detected
  • Publishing without backup - Always save current config before changes
  • Ignoring console errors - Browser console shows critical rendering issues
  • Testing only in code - Visual validation catches real rendering problems
  • Not using incremental testing - Build dashboards section by section
  • Publishing to production first - Test on test-dashboard first
  • Ignoring rollback strategy - Know how to revert if deployment fails
  • 跳过发布前验证 - 部署前必须验证
  • 忽略实体存在性检查 - 缺失实体会导致运行时错误
  • 不检查HACS卡片 - 自定义卡片必须先安装
  • 跳过日志分析 - 无法检测新错误
  • 未备份就发布 - 变更前务必保存当前配置
  • 忽略控制台错误 - 浏览器控制台显示关键渲染问题
  • 仅在代码中测试 - 可视化验证可捕获实际渲染问题
  • 不使用增量测试 - 分部分构建仪表盘
  • 直接发布到生产环境 - 先在测试仪表盘上测试
  • 忽略回滚策略 - 需知道变更失败时如何回滚

Notes

注意事项

  • Integration Priority: Pre-publish validation is most critical - it prevents bad configs from reaching HA
  • Visual Testing Cost: Browser automation is slower but catches rendering issues that API checks miss
  • Log Monitoring: Post-publish log checks detect issues that only appear at runtime
  • Incremental Testing: Build complex dashboards section by section to isolate issues quickly
  • Rollback Safety: Always capture current config before making changes for easy rollback
  • 集成优先级:发布前验证最为关键 - 可阻止不良配置进入HA
  • 可视化测试成本:浏览器自动化速度较慢,但可捕获API检查未发现的渲染问题
  • 日志监控:发布后日志检查可检测仅在运行时出现的问题
  • 增量测试:分部分构建复杂仪表盘可快速定位问题
  • 回滚安全性:变更前务必捕获当前配置,以便快速回滚