Git Product home page Git Product logo

search-card's Introduction

Search Card

Quickly search for entities from a Lovelace card.

Demo of card

Features

  • Search for entities and display results in frontend
  • Define custom actions that can be called for search input
  • More to come...

Roadmap

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

Install

Make sure card-tools is installed first.

Simple Install

  1. Download search-card.js and copy it into config/www/search-card (create the search-card directory)

  2. Add a reference to search-card/search-card.js inside your ui-lovelace.yaml

resources:
  - url: /local/search-card/search-card.js?v=0
    type: module

Git Install

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

  2. Add a reference to search-card/search-card.js inside your ui-lovelace.yaml

resources:
  - url: /local/search-card/search-card.js?v=0
    type: module

HACS

Look for Search Card in the store.

Updating

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.

Using the card

Options

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.

Actions

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.

Example

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

Issues and imitations

This is still an early version and may contain bugs. If you find any problems, please write an issue.

Getting errors?

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.

search-card's People

Contributors

indykoning avatar ktibow avatar oradsa avatar postlund avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.