Quickly search for entities from a Lovelace card.
- Search for entities and display results in frontend
- Define custom actions that can be called for search input
- More to come...
Some things I want to add in upcoming releases:
- Exclude domains and/or entities from results
- Button to show all results (to override "max results")
Make sure card-tools is installed first.
-
Download
search-card.js
and copy it intoconfig/www/search-card
(create thesearch-card
directory) -
Add a reference to
search-card/search-card.js
inside yourui-lovelace.yaml
resources:
- url: /local/search-card/search-card.js?v=0
type: module
-
Clone this repository into your
www
-directory:git clone https://github.com/postlund/search-card.git
-
Add a reference to
search-card/search-card.js
inside yourui-lovelace.yaml
resources:
- url: /local/search-card/search-card.js?v=0
type: module
Look for Search Card
in the store.
If you...
- manually copied the files, just download the latest files and overwrite what you already have
- cloned the repository from Github, just do
git pull
to update
... and increase ?v=X
to ?vX+1
.
Name | Type | Default | Description |
---|---|---|---|
max_results | integer | 10 | Max results to show by default |
actions | Object | optional | Custom defined actions |
search_text | String | "Type to search..." | Override of placeholder text |
included_domains | Array of String | optional | Only show entities from defined domains. Cannot be set together with excluded_domains . |
excluded_domains | Array of String | optional | Don't show entities from defined domains. Cannot be set together with included_domains . |
You can define custom actions that will call a service (if it exists) with the input. Matching is done via regular expressions and {1}, {2}, {3}, etc. will be replaced by the corresponding group. See example below for inspiration.
type: custom:search-card
max_results: 10
actions:
- matches: '^toggle (.+\..+)'
name: 'Toggle {1}'
service: homeassistant.toggle
service_data:
entity_id: {1}
excluded_domains:
- automation
This is still an early version and may contain bugs. If you find any problems, please write an issue.
Clear the browser cache, restart Home Assistant and make sure the configuration is correct. Also make sure card-tools is installed properly.
If you believe you have found an error, please write an issue.