{"id":13588854,"url":"https://github.com/thomasloven/lovelace-auto-entities","last_synced_at":"2025-05-14T14:08:47.994Z","repository":{"id":34289811,"uuid":"167744584","full_name":"thomasloven/lovelace-auto-entities","owner":"thomasloven","description":"🔹Automatically populate the entities-list of lovelace cards","archived":false,"fork":false,"pushed_at":"2025-05-05T09:03:42.000Z","size":322,"stargazers_count":1473,"open_issues_count":131,"forks_count":125,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-05-05T10:24:23.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasloven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-26T22:10:57.000Z","updated_at":"2025-05-05T09:03:47.000Z","dependencies_parsed_at":"2025-04-08T01:46:20.539Z","dependency_job_id":null,"html_url":"https://github.com/thomasloven/lovelace-auto-entities","commit_stats":{"total_commits":108,"total_committers":10,"mean_commits":10.8,"dds":"0.10185185185185186","last_synced_commit":"843e84b95501fb8baabd3e5067354263ec653b11"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-auto-entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-auto-entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-auto-entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasloven%2Flovelace-auto-entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasloven","download_url":"https://codeload.github.com/thomasloven/lovelace-auto-entities/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160015,"owners_count":22024567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:06:59.155Z","updated_at":"2025-05-14T14:08:47.988Z","avatar_url":"https://github.com/thomasloven.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/uqD6KHCdJ"],"categories":["TypeScript","Install from Source","Dashboards","Lovelace User Interface"],"sub_categories":["Smart Home Automation","Custom Cards","Custom Lovelace UI Cards"],"readme":"# auto-entities\n\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration)\n\nAutomatically populate lovelace cards with entities matching certain criteria.\n\nInstall Custom Icons through HACS [![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=thomasloven\u0026repository=lovelace-auto-entities) or [see this guide](https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins).\n\n## Usage\n\n```yaml\ntype: custom:auto-entities\ncard: \u003ccard\u003e\ncard_param: \u003ccard_param\u003e\nentities:\n  - \u003centity\u003e\n  - \u003centity\u003e\nfilter:\n  template: \u003ctemplate\u003e\n  include:\n    - \u003cfilter\u003e\n    - \u003cfilter\u003e\n  exclude:\n    - \u003cfilter\u003e\n    - \u003cfilter\u003e\n\nshow_empty: \u003cshow_empty\u003e\nelse: \u003celse\u003e\nunique: \u003cunique\u003e\nsort: \u003csort_method\u003e\n```\n\n| Option                 | Type                             | Description                                                                                                           | Default         |\n| ---------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------- |\n| `card`                 | Dashboard card\\*                 | The card to display. Specify this as you would specify any normal dashboard card, but ommit the `entities` parameter. | `entities`-card |\n| `entities`             | List of Entities\\*\\*             | Any entities added here will be added to the card before any filters are applied                                      |\n| `filter`               |\n| \u0026nbsp;\u0026nbsp;`template` | string                           | A jinja template evaluating to a list of entities to include                                                          |\n| \u0026nbsp;\u0026nbsp;`include`  | List of [Filters](#filters)      | A list of filters specifying which entities to add to the card                                                        |\n| \u0026nbsp;\u0026nbsp;`exclude`  | List of [Filters](#filters)      | A list of filters specifying which entities to remove from the card                                                   |\n| `show_empty`           | `true`/`false`                   | Whether to display the card if there are no entities                                                                  | `false`         |\n| `else`                 | Dashboard card\\*                 | Card to display if the main card has no entities. Overrides `show_empty`                                              |\n| `sort`                 | [Sort config](#sorting-entities) | How to sort the entities of the card                                                                                  | `none`          |\n| `card_param`           | string                           | The parameter of the card to populate with entities                                                                   | `entities`      |\n\n\\* [Dashboard card](https://www.home-assistant.io/dashboards/cards/) \\\n\\*\\* [Entities](https://www.home-assistant.io/dashboards/entities/#options-for-entities)\n\n### Filters\n\nThe two main filter sections `include` and `exclude` each takes a list of filters.\n\nEach filter has a set of rules and will match entities which match **ALL** rules:\n\n| Rule                  | Matches                                                                                     | Example                                              |\n| --------------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------- |\n| `domain`              | Entity domain                                                                               | `light`, `binary_sensor`, `media_player`             |\n| `state`               | Current state of entity                                                                     | `\"on\"`, `home`, `\"3.14\"`                             |\n| `entity_id`           | Full entity id                                                                              | `light.bed_light`, `input_binary.weekdays_only`      |\n| `name`                | Friendly name attribute                                                                     | `Kitchen lights`, `Front door`                       |\n| `group`               | Entities in the group                                                                       | `group.living_room_lights`                           |\n| `area`                | Entities in a given area. Also matches all entities belonging to a Device in the area.      | `Kitchen`                                            |\n| `device`              | Entities belonging to a Device                                                              | `Thomas iPhone`                                      |\n| `label`               | Entities that are tagged with a certain label                                               | `Show on dashboard`, `Holiday light`                 |\n| `device_manufacturer` | Entities belonging to a device by a given manufacturer                                      | `IKEA`                                               |\n| `device_model`        | Entities belonging to a device of a given model                                             | `Hue white ambiance E26/E27 (8718696548738)`         |\n| `integration`         | Entities included by a given integration. This is not possible for _all_ integrations.      | `plex`, `input_boolean`, `xiaomi_miio`, `mobile_app` |\n| `hidden_by`           | Who has hidden an entity                                                                    | `user`, `integration`                                |\n| `attributes`          | Map of `attribute: value` pairs to match                                                    |\n| `last_changed`        | Time since last state change (defaults to minutes)                                          | `\u003c 15`, `\u003e 2 d ago`                                  |\n| `last_updated`        | Time since last update (defaults to minutes)                                                | `\u003c 15`, `\u003e 2 d ago`                                  |\n| `entity_category`     | [Entity category](https://developers.home-assistant.io/docs/core/entity#generic-properties) | `config`, `diagnostic`                               |\n|                       |                                                                                             |                                                      |\n| `not`                 | Matche entities that do _not_ match a filter                                                |\n| `or`                  | Matches any in a list of filters                                                            |\n| `and`                 | Matches all in a list of filters                                                            |\n\nSpecial options:\n| Option | Description |\n|-----------|-------------|\n| `options` | Map of configuration options to apply to the entity when passed to the card\n| `type` | If a `type` is given, the filter is handled as a complete entity description and passed along directly to the card\n| `sort` | [Sort config](#sorting-entities) applied to entities in _this filter only_\n\n### Template filter\n\nThe filter section `template` takes a jinja template which evaluates to a list of entities or entity objects.\n\n## How it works\n\n`auto-entities` creates a list of entities by:\n\n1. Including every entity given in `entities:` (this allow nesting of `auto-entities`if you'd want to do that for some reason...)\n2. Include every entity listed in a `filter.template` evaluation\n3. Include all entities that matches **ALL** options of **ANY** filter in the `filter.include` section. The same entity may be included several times by different filters.\n4. Remove all entities that matches **ALL** options on **ANY** filter in the `filter.exclude` section.\n\nIt then creates a card based on the configuration given in `card:`, and fills in `entities:` of that card with the entities from above.\n\n## Matching rules\n\n### Wildcards\n\nAny filter option can use `*` as a wildcard for string comparison. Note that strings must be quoted when doing this:\n\n```yaml\nfilter:\n  include:\n    - name: \"Bedroom *\"\n    - entity_id: \"sensor.temperature_*_max\"\n```\n\n### Regular expressions\n\nAny filter option can use [javascript Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) for string comparison. To do this, enclose the regex in `/`. Also make sure to quote the string:\n\n```yaml\nfilter:\n  include:\n    - name: \"/^.* [Ll]ight$/\"\n    - entity_id: \"/sensor.temperature_4[abd]/\"\n```\n\n### Numerical comparison\n\nAny filter option dealing with numerical quantities can use comparison operators if specified as a string (must be quoted):\n\n```yaml\nfilter:\n  include:\n    - attributes:\n        battery_level: \"\u003c= 50\" # Attribute battery_level is 50 or less\n    - state: \"\u003e 25\" # State is greater than 25\n    - attributes:\n        count: \"! 2\" # Attribute count is not equal to 2\n    - state: \"= 12\" # State is exactly 12 (also matches \"12\", \"12.0\" etc.)\n    - state: \"12\" # State is exactly \"12\" but not e.g. \"12.0\"\n```\n\n### Time since an event\n\nAny filter option dealing with an event time can filter entities by time elapsed since that event:\n\n```yaml\nfilter:\n  include:\n    - attributes:\n        last_seen: \"\u003e 1h ago\" # Entity was seen more than 1 hour ago\n    - last_updated: \"\u003c 20m ago\" # Entity was updated less than 20 minutes ago\n    - last_triggered: \"\u003e 1d ago\" # Entity was triggered more than 1 day ago\n```\n\nAll the numeric comparison operators are available.\n\n### Repeating options\n\nAny option can be used more than once by appending a number or string to the option name:\n\n```yaml\nfilter:\n  include:\n    - state 1: \"\u003e 100\"\n      state 2: \"\u003c 200\"\n```\n\nThe filter above matches entities where the state is above 100 **AND** below 200. Compare to the following:\n\n```yaml\nfilter:\n  include:\n    - state: \"\u003c 100\"\n    - state: \"\u003e 200\"\n```\n\nThe two filters above together match entities where the state is below 100 **OR** above 200.\n\n### Object attributes\n\nSome entity attributes actually contain several values. One example is `hs_color` for a light, which has one value for Hue and one for Saturation. Such values can be stepped into using keys or indexes separated by a colon (`:`):\n\n```yaml\nfilter:\n  include:\n    - attributes:\n        hs_color:1: \"\u003e30\"\n```\n\nThe example above matches lights with a `hs_color` saturation value greater than 30.\n\n### Stringification\n\nSome entity attributes are not text strings, but can be advanced structures. By starting the pattern to match with `$$` auto-entities will convert the attribute to JSON before comparing:\n\n```yaml\nfilter:\n  include:\n    - attributes:\n        entity_id: \"$$*\"\n```\n\nThe example above matches any entity that has a `entity_id` attribute - i.e. all kinds of group entities.\n\n## Sorting entities\n\nEntities can be sorted, either on a filter-by-filter basis by adding a `sort:` option to the filter, or all at once after all filters have been applied using the `sort:` option of `auto-entities` itself.\n\nSorting methods are specified as:\n\n```yaml\nsort:\n  method: \u003cmethod\u003e\n  reverse: \u003creverse\u003e\n  ignore_case: \u003cignore_case\u003e\n  attribute: \u003cattribute\u003e\n  first: \u003cfirst\u003e\n  count: \u003ccount\u003e\n  numeric: \u003cnumeric\u003e\n  ip: \u003cip\u003e\n```\n\n- `method:` **Required** One of `domain`, `entity_id`, `name`, `device`, `area`, `state`, `attribute`, `last_changed` `last_updated` or `last_triggered`.\n- `reverse:` Set to `true` to reverse the order. Default: `false`.\n- `ignore_case:` Set to `true` to make the sort case-insensitive. Default: `false`.\n- `numeric:` Set to `true` to sort by numeric value. Default: `false` except for `last_changed`, `last_updated` and `last_triggered` sorting methods.\n- `ip:` Set to `true` to sort IP addresses group by group (e.g. 192.168.1.2 will be before 192.168.1.100).\n- `attribute:` Attribute to sort by if `method: attribute`. Can be an _object attribute_ as above (e.g. `attribute: rgb_color:2`)\n- `first` and `count` can be used to only display `\u003ccount\u003e` entities, starting with the `\u003cfirst\u003e` (starts with 0).\n\n## Entity options\n\nIn the `options:` option of the filters, the string `this.entity_id` will be replaced with the matched entity_id. Useful for service calls - see below.\n\n## Examples\n\nShow all entities, except yahoo weather, groups and zones in a glance card:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: glance\nfilter:\n  include: [{}]\n  exclude:\n    - entity_id: \"*yweather*\"\n    - domain: group\n    - domain: zone\n```\n\nShow all gps `device_tracker`s with battery level less than 50:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\n  title: Battery warning\nfilter:\n  include:\n    - domain: device_tracker\n      options:\n        secondary_info: last-changed\n      attributes:\n        battery: \"\u003c 50\"\n        source_type: gps\n```\n\nShow all lights that are on:\n\n```yaml\ntype: custom:auto-entities\nshow_empty: false\ncard:\n  type: glance\n  title: Lights on\nfilter:\n  include:\n    - domain: light\n      state: \"on\" # Remember that \"on\" and \"off\" are magic in yaml, and must always be quoted\n      options:\n        tap_action:\n          action: toggle\n```\n\nAlso show all lights that are on, except the hidden ones:\n\n```yaml\ntype: custom:auto-entities\nshow_empty: false\ncard:\n  type: entities\n  title: Lights on\n  show_header_toggle: false\nfilter:\n  include:\n    - domain: light\n  exclude:\n    - state: \"off\"\n    - state: \"unavailable\"\n    - hidden_by: \"user\"\n```\n\nShow everything that has \"light\" in its name, but isn't a light, and all switches in the living room:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\n  title: Lights on\n  show_header_toggle: false\nfilter:\n  include:\n    - name: /[Ll]ight/\n      not:\n        domain: light\n    - type: section\n    - domain: switch\n      area: Living Room\n```\n\nList every sensor belonging to any iPhone:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\n  title: Phones\n  show_header_toggle: false\nfilter:\n  include:\n    - device: /iPhone/\n```\n\nList the five last triggered motion sensors:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\nfilter:\n  include:\n    - domain: binary_sensor\n      attributes:\n        device_class: motion\nsort:\n  method: last_changed\n  reverse: true\n  count: 5\n```\n\nPut all sensors in individual entity cards in a grid card:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: grid\ncard_param: cards\nfilter:\n  include:\n    - domain: sensor\n      options:\n        type: entity\n```\n\nTurn on scenes by clicking them:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: glance\nfilter:\n  include:\n    - domain: scene\n      options:\n        tap_action:\n          action: call-service\n          service: scene.turn_on\n          service_data:\n            # Note the magic value this.entity_id here\n            entity_id: this.entity_id\n```\n\nExample using templates:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\nfilter:\n  template: |\n    {% for light in states.light %}\n      {% if light.state == \"on\" %}\n        {{ light.entity_id}},\n      {% endif %}\n    {% endfor %}\n```\n\nOr:\n\n```yaml\ntemplate: \"{{states.light | selectattr('state', '==', 'on') | map(attribute='entity_id') | list}}\"\n```\n\nTemplates also give great opportunity for customization:\n\n```yaml\ntype: custom:auto-entities\ncard:\n  type: entities\nfilter:\n  template: |\n    [{% for e in area_entities(\"bedroom\") %}\n      {'entity': '{{e}}',\n       'name': 'Lamp at {{device_attr(e, \"name\").removesuffix(\"Light\").removesuffix(\"Lights\")}}',\n      },\n    {% endfor %}]\n```\n\n---\n\n\u003ca href=\"https://www.buymeacoffee.com/uqD6KHCdJ\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/white_img.png\" alt=\"Buy Me A Coffee\" style=\"height: auto !important;width: auto !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasloven%2Flovelace-auto-entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasloven%2Flovelace-auto-entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasloven%2Flovelace-auto-entities/lists"}