Entity Exporter Card - Lovelace card for exporting filtered entities to AI assistants

Entity Exporter Card - Lovelace card for exporting filtered entities to AI assistants

Hello Home Assistant community!

I’m pleased to share a new custom Lovelace card I’ve developed that might be useful for those who use AI tools like ChatGPT or Claude to help with their Home Assistant configurations.

Entity Exporter Card

Purpose

The Entity Exporter Card solves a specific problem: providing proper context to AI assistants when asking for help with Home Assistant. Instead of manually copying entity IDs or trying to describe your setup, this card lets you:

  1. Filter your entities by domain and/or text searches
  2. Export the filtered entities as structured JSON
  3. Share this data with AI tools to get more accurate, contextual assistance

It’s particularly helpful when you’re:

  • Creating complex automations or scripts
  • Troubleshooting configuration problems
  • Understanding relationships between various entities
  • Getting suggestions for improvements or optimizations

Features

The card provides several useful features:

  • Domain Filtering: Quickly select which entity domains to include (lights, switches, sensors, etc.)
  • Text Filtering: Add one or more text filters to find specific entities
  • Live Preview: See matching entities in real-time as you type
  • Copy to Clipboard: One-click copy (automatically detects if you’re in a secure context)
  • JSON Download: Save filtered entities as a JSON file
  • Entity Counter: Shows how many entities match out of total available

Installation

The card is available through HACS:

As a custom repository:

  1. In HACS, go to “Frontend”
  2. Click the three dots menu and select “Custom repositories”
  3. Add https://github.com/scharc/ha-entity-exporter-card
  4. Select category “Lovelace”
  5. Click “Add”
  6. Install “Entity Exporter Card”

Manual installation:

  1. Download entity-exporter-card.js from the repository
  2. Upload to your /config/www/ directory
  3. Add the resource in your Lovelace configuration:
    resources:
      - url: /local/entity-exporter-card.js
        type: module
    

Usage

Add to your dashboard with:

type: entity-exporter-card

The card is straightforward to use:

  1. Select domains using the checkboxes
  2. Type in the filter box to find specific entities
  3. Click “Add Filter” to save multiple filters (they work with OR logic)
  4. Use the copy or download buttons to export the filtered entities

Example Workflow

Here’s how I use it:

  1. I wanted to create an automation that would trigger specific scenes based on time of day and presence
  2. I used the card to filter just my presence sensors, lights, and scene entities
  3. Exported the JSON and shared it with Claude
  4. Asked: “Create an automation that activates different lighting scenes based on whether someone is home and the time of day”
  5. Claude could see exactly which entities were available and their current states/attributes
  6. The result was a perfectly tailored automation that worked with my specific entities

Development and Feedback

I developed this card with assistance from Claude AI, focusing on making it reliable and user-friendly. If you’re interested in the development process, check out the VIBE_CODING.md file in the repository.

The code is open source under MIT license, and feedback, suggestions, and contributions are welcome:

I hope this tool can be useful for others who use AI to help with their Home Assistant setups. Let me know if you have any questions or feature requests!


Technical Details

For those interested in the implementation:

  • The card uses Home Assistant’s internal APIs to access entity data
  • It implements proper focus retention when typing in the filter field
  • It automatically detects clipboard support based on browser context
  • The filtering algorithm applies domain filters first, then text filters
  • Text filters are applied with OR logic - an entity matching any filter is included
  • The card shows real-time previews as you type without requiring submission

The JSON export includes each entity’s state and attributes, providing comprehensive context to AI tools.

1 Like