Ignore state changes when new state is unknown #398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates "async_check_cover_state_change" to also ignore when the New state is unknown, not just when the Old state is unknown.
Motivation and Context
I recently wrapped my shades/covers in a template to adjust the functionality of how they respond to commands (some of my shades get unfortunately "stuck" if they havent moved in a while). This worked well, and didn't cause issues with adaptive cover most of the time. However, when Home Assistant restarts or the templates are reloaded, they shades are briefly put in an unavailable state.
Adaptive Cover would read this as a state change and, in addition, report this as a manual action because the "None" position didn't equal the previous position. All of my shades would end up under manual control as a result.
In addition to looking at the old state, also look at the new state, when deciding whether or not to process the state change.
I do not know if there are any unintended consequences of this. Maybe some people would want the shades to enter manual control if the shade is considered unavailable?
How has this been tested?
Mostly just tested locally.
Screenshots (if appropriate):
Types of changes
Checklist