Skip to content

Commit

Permalink
allow filtering by entity_category (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsteddyyo authored Sep 16, 2024
2 parents cda9286 + 8f1f835 commit 404d769
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/util/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ export const filterValue: Record<FilterType, (entity: EntityRegistryEntry, hass:
const hiddenBy = entity.hidden_by;
return compare(comparator, hiddenBy, value);
},
entity_category: (entity, hass, value, comparator) => {
const entityCategory = entity.entity_category;
return compare(comparator, entityCategory, value);
},
};
10 changes: 10 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ export enum FilterType {
* ```
*/
hidden_by = "hidden_by",
/**
* Filter on the category of the entity.
* @example
* ```yaml
* - type: entity_category
* comparator: equal
* value: diagnostic
* ```
*/
entity_category = "entity_category",
}

export enum Comparator {
Expand Down

0 comments on commit 404d769

Please sign in to comment.