Skip to content

Feature: Add option to hide unavailable entities from the dashboard - #339

Merged
DigiLive merged 35 commits into
mainfrom
mushroom-strategy-322
Jun 20, 2026
Merged

Feature: Add option to hide unavailable entities from the dashboard#339
DigiLive merged 35 commits into
mainfrom
mushroom-strategy-322

Conversation

@DigiLive

Copy link
Copy Markdown
Owner

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

  • Add hide_unavailable_entities option to example.
  • Update SingleDomainConfig to ext. AllDomainsConfig.
  • Add type guard for EntityRegistryEntry.
  • Add card visibility based on entity availability.

Documentation Updates

Option type Default Description
hide_unavailable_entities boolean false Set to true to hide unavailable entities from the dashboard.

Agreements

Please confirm the following by inserting an x between the brackets:

  • My code adheres to the contribution guidelines of the project.
  • My changes generate no new warnings.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

jacauc and others added 11 commits June 12, 2026 11:16
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.
@codacy-production

codacy-production Bot commented Jun 12, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

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.

@DigiLive

Copy link
Copy Markdown
Owner Author

@jacauc I encountered an issue on my end while working on #322 and accidentally pushed to the wrong branch. I’ve opened this PR to replace the previous one.

Could you please check out this branch, build the JavaScript locally, and verify if it meets your requirements?

@DigiLive DigiLive self-assigned this Jun 12, 2026
@DigiLive DigiLive added the in progress Someone is already working on it. label Jun 12, 2026
@DigiLive
DigiLive requested a review from Copilot June 12, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_entities to domain configuration types and defaults.
  • Introduced entity state filtering support in RegistryFilter and 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.

Comment thread src/cards/AbstractCard.ts
Comment thread src/views/AbstractView.ts
Comment thread src/utilities/RegistryFilter.ts
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.
@jacauc

jacauc commented Jun 12, 2026

Copy link
Copy Markdown

@jacauc I encountered an issue on my end while working on #322 and accidentally pushed to the wrong branch. I’ve opened this PR to replace the previous one.

Could you please check out this branch, build the JavaScript locally, and verify if it meets your requirements?

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?
image

@DigiLive

Copy link
Copy Markdown
Owner Author

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

mushroom-strategy.js

DigiLive and others added 7 commits June 13, 2026 05:57
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
* 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.
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>
DigiLive and others added 16 commits June 20, 2026 07:08
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
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
@DigiLive
DigiLive merged commit b1a2c11 into main Jun 20, 2026
1 check passed
@DigiLive
DigiLive deleted the mushroom-strategy-322 branch June 20, 2026 05:32
@DigiLive DigiLive removed the in progress Someone is already working on it. label Jun 20, 2026
@jacauc

jacauc commented Jun 20, 2026

Copy link
Copy Markdown

Apologies, been away from home so never got around to testing. Appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow hiding of unavailable entities

3 participants