Search Card

March 27, 2025 ยท View on GitHub

A Lovelace card for Home Assistant that enables quick entity searching with customizable actions.

Demo of card

Features

  • ๐Ÿ” Quick entity search within the Home Assistant frontend
  • โšก Custom actions with regex-based matching
  • ๐ŸŽฏ Domain filtering (include/exclude specific domains)
  • ๐Ÿ“‹ Configurable result limits and placeholder text

Installation

Prerequisites

  1. Search for "Search Card" in the HACS store
  2. Install and follow the HACS prompts

Option 2: Manual Install

  1. Download search-card.js
  2. Copy it to config/www/search-card/ (create directory if needed)
  3. Add to ui-lovelace.yaml:
resources:
  - url: /local/search-card/search-card.js?v=0
    type: module

Option 3: Git Install

# Clone into your www directory
git clone https://github.com/postlund/search-card.git

Then add the same resource reference as in Manual Install.

Configuration

Basic Example

type: custom:search-card
max_results: 10
search_text: "Search entities..."
excluded_domains:
  - automation

Available Options

NameTypeDefaultDescription
max_resultsinteger10Maximum number of search results to display
search_textstring"Type to search..."Custom placeholder text
actionsobjectoptionalCustom action definitions
included_domainsstring[]optionalOnly show entities from these domains*
excluded_domainsstring[]optionalHide entities from these domains*

*Note: included_domains and excluded_domains cannot be used together

Domain Filtering

The card supports filtering entities by their domains using either included_domains or excluded_domains.

Common Home Assistant Domains

  • light - Light entities
  • switch - Switch entities
  • sensor - Sensor entities
  • binary_sensor - Binary sensor entities
  • climate - Climate control entities
  • media_player - Media player entities
  • automation - Automation entities
  • script - Script entities
  • camera - Camera entities
  • cover - Cover/blind/garage door entities

Examples

Include only lights and switches:

type: custom:search-card
included_domains:
  - light
  - switch

Exclude automation and script entities:

type: custom:search-card
excluded_domains:
  - automation
  - script

Note: The card will show entities from all available domains in your Home Assistant instance unless you specify domain filters.

Custom Actions

Actions allow you to define service calls triggered by regex matches. Example:

type: custom:search-card
actions:
  - matches: '^toggle (.+\..+)'
    name: "Toggle {1}"
    service: homeassistant.toggle
    service_data:
      entity_id: { 1 }

Troubleshooting

If you encounter issues:

  1. Clear browser cache
  2. Restart Home Assistant
  3. Verify card-tools is properly installed
  4. Check your configuration syntax

For bug reports, please create an issue with:

  • Your configuration
  • Home Assistant version
  • Browser and version
  • Error messages (if any)

Roadmap

Planned features:

  • Entity exclusion list
  • "Show all" results button
  • Additional action types