dawiddutoit/custom-claude/ha-conditional-cards
Claude Code and agent skill by dawiddutoit/custom-claude
- community
Checking that the SKILL.md file is still in the repository.
Implements conditional visibility for Home Assistant dashboard cards using state, numeric_state, screen, user, time, and/or conditions via Conditional Card wrapper and per-card visibility property. Use when asked to "hide card when", "show only if", "user-specific dashboard", "mobile vs desktop cards", "conditional visibility", or "show card based on state/time/user".
Install
npx vskill@latest install dawiddutoit/custom-claude/ha-conditional-cardsSKILL.md
Works with Lovelace YAML dashboards and conditional/visibility card configurations.
Home Assistant Conditional Cards
Control card visibility dynamically based on states, users, screen size, and complex conditions.
Overview
Home Assistant provides two approaches for conditional visibility:
- Conditional Card (wrapper): Shows/hides entire card based on conditions
- Per-Card Visibility: Native
visibilityproperty on any card
Both support multiple condition types:
- state: Entity matches specific state
- numeric_state: Sensor value within range
- screen: Screen width/media queries
- user: Current user matches list
- time: Current time within range
- and/or: Complex logic combinations
When to Use This Skill
Use this skill when you need to:
- Show cards only when specific conditions are met (person home, motion detected, temperature threshold)
- Create responsive dashboards with mobile vs desktop layouts
- Build user-specific views with different access levels
- Display time-based cards (daytime vs nighttime controls)
- Combine multiple conditions with AND/OR logic for complex visibility rules
Do NOT use when:
- You need to modify card content based on state (use template cards instead)
- Building static dashboards where all cards are always visible
- Checking entity attributes directly (create template sensor first)
Quick Start
Conditional Card (Wrapper)
Per-Card Visibility (Native)
Usage
- Choose approach: Use Conditional Card wrapper for complex logic, per-card visibility for simple conditions
- Select condition type: state, numeric_state, screen, user, time, and/or
- Apply condition: Add
conditionsto conditional card orvisibilityto any card - Test in edit mode: Exit edit mode to test visibility (cards always show when editing)
- Verify entity states: Check Developer Tools → States to debug conditions
See Condition Types Reference below for all available conditions and syntax.
Condition Types Reference
| Condition | Parameters | Use Case | |
|---|---|---|---|
state | entity, state | Show when entity has specific state | |
numeric_state | entity, above, below | Show when sensor in range | |
screen | media_query | Show based on screen width | |
user | users (list of user IDs) | Show for specific users only | |
time | after, before | Show during specific time window | |
and | List of conditions | All conditions must be true | |
or | List of conditions | At least one condition must be true |
State Conditions
Basic State Match
Multiple State Options
State with Attributes (Workaround)
Note: Native conditional cards don't support attribute conditions. Create a template sensor instead.
Numeric State Conditions
Temperature Range
Above Threshold
Between Values
Screen/Responsive Conditions
Mobile Only
Desktop Only
Tablet Range
Common Media Queries
User Conditions
Single User
Multiple Users (Admin Access)
Finding User IDs:
- Go to Settings → People
- Click on user
- User ID is in the URL:
/config/person/USER_ID_HERE
Time Conditions
During Daytime
Night Mode Cards
Business Hours
Complex Logic (AND/OR)
AND Condition (All Must Be True)
OR Condition (At Least One Must Be True)
Nested Logic
Real-World Patterns
Show Camera When Motion Detected
Mobile vs Desktop Layout
User-Specific Controls
For more patterns (low battery alerts, temperature warnings, occupied rooms, time-based controls), see references/advanced-patterns.md.
Best Practices
- Combine approaches: Use conditional card for complex logic, per-card visibility for simple conditions
- Test in edit mode: Exit edit mode to test visibility (cards always visible when editing)
- Use helper entities: Create template sensors for attribute-based or complex conditions
- Add buffer zones: Use hysteresis for numeric conditions to prevent flapping
- Document user IDs: Keep reference of user IDs for maintenance
- Screen conditions: Use media queries for responsive mobile/desktop layouts
Limitations
Cannot check attributes directly - Create template sensor to expose attribute as entity state.
No template conditions - Create template binary sensor instead.
Always visible in edit mode - Must exit edit mode to test visibility behavior.
For detailed workarounds, see references/advanced-patterns.md.
Troubleshooting
| Issue | Solution | |
|---|---|---|
| Card not hiding | Exit edit mode, check entity state, verify YAML indentation | |
| User condition fails | Use user ID (not username), find in Settings → People → URL | |
| Time condition fails | Use 24-hour format "23:00:00", check HA timezone | |
| Numeric condition fails | Verify sensor has numeric state (not "unknown") | |
| Screen condition fails | Test on actual device (not browser resize) |
For detailed troubleshooting, see references/advanced-patterns.md.
Supporting Files
- references/advanced-patterns.md - Complex logic patterns, real-world use cases, workarounds, detailed troubleshooting, best practices, common media queries
Official Documentation
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ha-conditional-cards/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 31 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dawiddutoit/custom-claude/ha-conditional-cards)