Feature: Add option to hide unavailable entities from the dashboard - #339
Conversation
Added 'hide_unavailable_entities' property to AllDomainsConfig interface.
Introduce a new method `whereState` to filter registry entries based on their state, allowing for more precise queries. This enhancement improves the flexibility of the filtering mechanism by enabling checks against specific states like 'unavailable' or 'unknown'.
Enhance the entity filtering logic to include an option for hiding entities with the state 'unavailable'. This improves the user experience by allowing users to manage the visibility of entities based on their availability.
Extended `SingleDomainConfig` to include properties from `AllDomainsConfig`, improving consistency and reusability of shared fields between domain configurations.
Introduce `isEntityRegistryEntry` function to verify if a registry entry is of type `EntityRegistryEntry`. This enhances type safety and enables more precise checks when working with registry entries.
Set card visibility dynamically using `hide_unavailable_entities` option in domain configurations. This removes unavailable entity filtering from the registry and shifts visibility logic into the card configuration.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull request overview
Adds a new hide_unavailable_entities strategy option to suppress entities in unavailable state, intended to reduce dashboard clutter from offline/disconnected devices while supporting global and per-domain configuration.
Changes:
- Added
hide_unavailable_entitiesto domain configuration types and defaults. - Introduced entity state filtering support in
RegistryFilterand applied it in view generation. - Added documentation updates and examples for the new option.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/AbstractView.ts | Merges per-domain options and conditionally filters out unavailable entities when generating view cards. |
| src/utilities/RegistryFilter.ts | Adds a whereState() filter helper (and related typing) for filtering by entity state. |
| src/types/strategy/strategy-generics.ts | Extends domain option typings and adds an isEntityRegistryEntry type guard. |
| src/configurationDefaults.ts | Adds hide_unavailable_entities: false to global domain defaults (_). |
| src/cards/AbstractCard.ts | Adds card-level visibility logic based on entity availability and domain options. |
| docs/options/index.md | Minor punctuation fix. |
| docs/options/domain-options.md | Documents hide_unavailable_entities and adds a YAML example. |
| docs/full-example.md | Adds hide_unavailable_entities to the full configuration example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Eliminate the filtering logic for unavailable entities in the registry, shifting this responsibility to card configurations. This simplifies the data pipeline and aligns with recent changes to card visibility options.
I'd be happy to test - can you please give me some guidance on how to test the specific branch and build the JS? Is it v3.1.1? |
|
My apologies; I assumed you were familiar with these steps since you have already forked the repository and implemented changes. I have included the build for testing below. Please refer to this guide to add it to Home Assistant: Local Installation Guide. (Please ensure you clear your browser cache afterward to apply the changes.) |
Fixes #342. * Add utility to log freeze/seal states of objects Introduced `scanFreeze` function to recursively log frozen, sealed, and extensible states of objects and their nested properties. This is useful for debugging objects altered by third-party libraries or frameworks. Circular references are handled to prevent infinite recursion. * Refactor `StrategyArea` type Replaced `StrategyArea` interface with a union of `AreaRegistryEntry` and a partial `AreaConfig`. This enhances type reusability and allows greater flexibility by making certain properties optional. * Fix `viewCards` assignment - Replaced Registry-based access with direct usage of `area.extra_cards` to simplify logic and remove unnecessary dependency on the Registry. - Create a mutable copy or `area.extra_cards` will be frozen. * Bump version to v3.1.2
[skip codacy]
* Fix HomeView card stacking logic Add card stacking in HomeView to use `stackHorizontal` for `quick_access_cards` and `extra_cards`. This feature was probably gone missing when switching from masonary to sections view.
[skip codacy]
Bumps the actions group with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 6 to 7 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the minor-and-patch group with 3 updates: [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint), [eslint](https://github.com/eslint/eslint) and [ts-loader](https://github.com/TypeStrong/ts-loader). Updates `typescript-eslint` from 8.61.0 to 8.61.1 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.61.1/packages/typescript-eslint) Updates `eslint` from 10.4.1 to 10.5.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](eslint/eslint@v10.4.1...v10.5.0) Updates `ts-loader` from 9.6.0 to 9.6.1 - [Release notes](https://github.com/TypeStrong/ts-loader/releases) - [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md) - [Commits](TypeStrong/ts-loader@v9.6.0...v9.6.1) --- updated-dependencies: - dependency-name: typescript-eslint dependency-version: 8.61.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: eslint dependency-version: 10.5.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: ts-loader dependency-version: 9.6.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updated the `brace-expansion` package from v5.0.5 to v5.0.6 in package-lock.json to pull in the latest save version according to npm audit.
* Update FAQ for cache instructions - Improved cache clearing documentation in the FAQ to clarify browser behavior with Developer Tools and cache disabling. - Fixed a typo in the installation guide for better accuracy and consistency. * Add support for hiding domains in default domain - Added support for specifying `hidden_domains` in the `default` domain configuration. This allows excluding unsupported domains from being displayed while improving flexibility in strategy configurations. - Updated TypeScript interfaces to accommodate these changes, ensuring type safety and accurate structure representation. * Update documentation scripts - Added `docs:install` script to set up a Python virtual environment and install dependencies from `requirements.txt`. - Updated `docs:serve` and `docs:serve-versioned` scripts to activate the virtual environment before running `mkdocs` and `mike`. * Update domain-options documentation - Added `hidden_domains` option under the `default` domain, enabling hiding of specific domains in the 'Miscellaneous' section of an Area view. * Revert documentation scripts - Removed Python virtual environment activation from `docs:serve` and `docs:serve-versioned` scripts to simplify usage. - This change assumes the user has the required dependencies installed globally, reducing script complexity. * Update `hidden_domains` property - Changed the `hidden_domains` property in `DefaultDomainConfig` from optional to required in `strategy-generics.ts`. * Fix typo in domain-options documentation
[skip codacy]
Added 'hide_unavailable_entities' property to AllDomainsConfig interface.
Introduce a new method `whereState` to filter registry entries based on their state, allowing for more precise queries. This enhancement improves the flexibility of the filtering mechanism by enabling checks against specific states like 'unavailable' or 'unknown'.
Enhance the entity filtering logic to include an option for hiding entities with the state 'unavailable'. This improves the user experience by allowing users to manage the visibility of entities based on their availability.
Extended `SingleDomainConfig` to include properties from `AllDomainsConfig`, improving consistency and reusability of shared fields between domain configurations.
Introduce `isEntityRegistryEntry` function to verify if a registry entry is of type `EntityRegistryEntry`. This enhances type safety and enables more precise checks when working with registry entries.
Set card visibility dynamically using `hide_unavailable_entities` option in domain configurations. This removes unavailable entity filtering from the registry and shifts visibility logic into the card configuration.
Eliminate the filtering logic for unavailable entities in the registry, shifting this responsibility to card configurations. This simplifies the data pipeline and aligns with recent changes to card visibility options.
…room-strategy-322 # Conflicts: # docs/options/domain-options.md # src/types/strategy/strategy-generics.ts
|
Apologies, been away from home so never got around to testing. Appreciate it |

Feature Pull Request
Feature Summary
This pull request introduces a new configuration option, hide_unavailable_entities, which allows users to filter out Home Assistant entities that are currently in an unavailable state. This toggle can be applied globally to all domains or specifically to individual domains via the strategy options.
Motivation and Context
Currently, the Mushroom Strategy provides robust options to hide configuration and diagnostic entities, but it does not offer a native way to suppress entities that are offline or disconnected (state: unavailable).
This feature solves the problem of "dashboard clutter" caused by temporary device dropouts or unavailable integrations, ensuring that the generated dashboard only displays actionable and active entities. It is particularly useful for users with large homelabs or smart homes where a few unavailable devices can disrupt the visual flow of the UI.
Resolves #319
Closes: #322
List of Changes
SingleDomainConfigto ext.AllDomainsConfig.EntityRegistryEntry.Documentation Updates
hide_unavailable_entitiesfalsetrueto hide unavailable entities from the dashboard.Agreements
Please confirm the following by inserting an
xbetween the brackets: