ha-conditional-cards
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".
What this skill does
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 `visibility` property 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)
```yaml
type: conditional
conditions:
- condition: state
entity: person.john
state: home
card:
type: entities
entities:
- light.bedroom
```
### Per-Card Visibility (Native)
```yaml
type: entities
entities:
- light.bedroom
visibility:
- condition: state
entity: person.john
state: home
```
## Usage
1. **Choose approach**: Use Conditional Card wrapper for complex logic, per-card visibility for simple conditions
2. **Select condition type**: state, numeric_state, screen, user, time, and/or
3. **Apply condition**: Add `conditions` to conditional card or `visibility` to any card
4. **Test in edit mode**: Exit edit mode to test visibility (cards always show when editing)
5. **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
```yaml
type: conditional
conditions:
- condition: state
entity: binary_sensor.motion_living_room
state: "on"
card:
type: camera
entity: camera.living_room
```
### Multiple State Options
```yaml
visibility:
- condition: state
entity: climate.living_room
state_not:
- "off"
- unavailable
```
### State with Attributes (Workaround)
**Note:** Native conditional cards don't support attribute conditions. Create a template sensor instead.
```yaml
# In configuration.yaml
template:
- sensor:
- name: "AC Mode Cool"
state: "{{ state_attr('climate.living_room', 'hvac_mode') == 'cool' }}"
# In dashboard
visibility:
- condition: state
entity: sensor.ac_mode_cool
state: "True"
```
## Numeric State Conditions
### Temperature Range
```yaml
type: entities
entities:
- climate.bedroom
visibility:
- condition: numeric_state
entity: sensor.temperature
above: 18
below: 30
```
### Above Threshold
```yaml
visibility:
- condition: numeric_state
entity: sensor.battery
below: 20 # Show when battery < 20%
```
### Between Values
```yaml
visibility:
- condition: numeric_state
entity: sensor.humidity
above: 40
below: 60 # Show when 40% < humidity < 60%
```
## Screen/Responsive Conditions
### Mobile Only
```yaml
visibility:
- condition: screen
media_query: "(max-width: 600px)"
```
### Desktop Only
```yaml
visibility:
- condition: screen
media_query: "(min-width: 1280px)"
```
### Tablet Range
```yaml
visibility:
- condition: screen
media_query: "(min-width: 601px) and (max-width: 1279px)"
```
### Common Media Queries
```yaml
# Mobile (portrait)
media_query: "(max-width: 600px)"
# Tablet (portrait)
media_query: "(min-width: 601px) and (max-width: 900px)"
# Desktop
media_query: "(min-width: 1280px)"
# Landscape orientation
media_query: "(orientation: landscape)"
# Portrait orientation
media_query: "(orientation: portrait)"
```
## User Conditions
### Single User
```yaml
visibility:
- condition: user
users:
- 1234567890abcdef # User ID (not username)
```
### Multiple Users (Admin Access)
```yaml
type: entities
entities:
- switch.advanced_settings
visibility:
- condition: user
users:
- 1234567890abcdef # Admin user 1
- fedcba0987654321 # Admin user 2
```
**Finding User IDs:**
1. Go to Settings → People
2. Click on user
3. User ID is in the URL: `/config/person/USER_ID_HERE`
## Time Conditions
### During Daytime
```yaml
visibility:
- condition: time
after: "06:00:00"
before: "22:00:00"
```
### Night Mode Cards
```yaml
visibility:
- condition: time
after: "22:00:00"
before: "06:00:00"
```
### Business Hours
```yaml
visibility:
- condition: time
after: "09:00:00"
before: "17:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
```
## Complex Logic (AND/OR)
### AND Condition (All Must Be True)
```yaml
visibility:
- condition: and
conditions:
- condition: state
entity: person.john
state: home
- condition: numeric_state
entity: sensor.temperature
below: 18
- condition: time
after: "06:00:00"
before: "23:00:00"
```
### OR Condition (At Least One Must Be True)
```yaml
visibility:
- condition: or
conditions:
- condition: state
entity: person.john
state: home
- condition: state
entity: person.jane
state: home
```
### Nested Logic
```yaml
visibility:
- condition: and
conditions:
# Show during daytime...
- condition: time
after: "06:00:00"
before: "22:00:00"
# ...AND (someone is home OR security is armed)
- condition: or
conditions:
- condition: state
entity: person.john
state: home
- condition: state
entity: alarm_control_panel.home
state: armed_away
```
## Real-World Patterns
### Show Camera When Motion Detected
```yaml
type: conditional
conditions:
- condition: state
entity: binary_sensor.motion_living_room
state: "on"
card:
type: camera
entity: camera.living_room
```
### Mobile vs Desktop Layout
```yaml
# Mobile: Compact view
type: custom:mushroom-chips-card
visibility:
- condition: screen
media_query: "(max-width: 600px)"
# Desktop: Detailed view
type: grid
columns: 3
visibility:
- condition: screen
media_query: "(min-width: 1280px)"
```
### User-Specific Controls
```yaml
type: entities
entities:
- switch.developer_mode
visibility:
- condition: user
users:
- 1234567890abcdef # Admin user ID (Settings → People → URL)
```
For more patterns (low battery alerts, temperature warnings, occupied rooms, time-based controls), see `references/advanced-patterns.md`.
## Best Practices
1. **Combine approaches**: Use conditional card for complex logic, per-card visibility for simple conditions
2. **Test in edit mode**: Exit edit mode to test visibility (cards always visible when editing)
3. **Use helRelated 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.