Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to ignore unavailable entities #136

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

hugobloem
Copy link
Owner

This pull request introduces a new feature to the stateful_scenes custom component, allowing it to ignore entities that are in an unavailable state. Additionally, it includes some code refactoring and improvements to the handling of scene states. The most important changes are:

New Feature: Ignore Unavailable Entities

  • Added the ignore_unavailable configuration option to the StatefulScenes component, allowing users to specify whether entities in an unavailable state should be ignored. (custom_components/stateful_scenes/StatefulScenes.py, custom_components/stateful_scenes/config_flow.py, custom_components/stateful_scenes/const.py, custom_components/stateful_scenes/switch.py, custom_components/stateful_scenes/translations/en.json, custom_components/stateful_scenes/translations/nl.json, custom_components/stateful_scenes/translations/sk.json) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

Code Refactoring

  • Reorganized imports in StatefulScenes.py to improve readability. (custom_components/stateful_scenes/StatefulScenes.py)

Scene State Handling

  • Updated the check_all_states method to correctly handle unavailable entities, ensuring that the scene is considered off if all entities are unavailable. (custom_components/stateful_scenes/StatefulScenes.py)

Switch Entity Enhancements

  • Introduced the IgnoreUnavailable switch entity to manage the new ignore_unavailable feature. (custom_components/stateful_scenes/switch.py)

These changes enhance the flexibility and robustness of the stateful_scenes component, making it more resilient to entities that may become unavailable.

@hugobloem hugobloem linked an issue Nov 15, 2024 that may be closed by this pull request
@hugobloem hugobloem merged commit dff74e5 into main Nov 15, 2024
6 checks passed
@hugobloem hugobloem deleted the 130-option-to-ignore-unavailable-entities branch November 15, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to ignore unavailable entities
1 participant