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

fix: don't remove entities when reloaded while car is asleep #365

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

carleeno
Copy link
Contributor

@carleeno carleeno commented Nov 21, 2022

This ensures the following entities aren't suddenly removed if the integration is reloaded (or HA restarted) while a vehicle is asleep:

  • heated steering wheel
  • sentry mode
  • homelink

Instead of conditionally creating these entities during setup, they will always be added. However, on first install (when wake_if_asleep is used), if any of these entities are not available they will be disabled by default. This ensures that entities which are not part of the vehicle will not be enabled (not visible and no logging), but also provides the option that a user could enable it if it was somehow wrongly disabled.

Once enabled, the entity would not self-disable upon reload even if it is unavailable: Fixes #293 (note these entities would show unavailable if reloaded while the vehicle is asleep, but would automatically become available again next time it's online)

Additionally this PR fixes dynamic updates of the availability of these items while the car is online (and reflect the last state while car is offline).

@carleeno
Copy link
Contributor Author

@shred86 for vis, this should fix the remaining entities disappearing issues, this seemed the next best thing given the option codes aren't reliable.

@carleeno carleeno changed the title fix: don't remove entities when car is asleep fix: don't remove entities when reloaded while car is asleep Nov 21, 2022
@alandtse
Copy link
Owner

alandtse commented Nov 21, 2022

Back out the is_metric change please as there is an existing pr #343 and I don't want to force a ha min update yet since that change is very recent.

@carleeno
Copy link
Contributor Author

Back out the is_metric change please as there is an existing pr #343 and I don't want to force a ha min update yet since that change is very recent.

Ahh I didn't realize it was so recent. Done.

@alandtse
Copy link
Owner

alandtse commented Nov 21, 2022

Since this is an area with active issues, can you also put in some tests covering these sensors being created with tests for both cases that cause them to be enabled or disabled?

@carleeno
Copy link
Contributor Author

Since this is an area with active issues, can you also put in some tests covering these sensors being created with tests for both cases that cause them to be enabled or disabled?

Took me a bit to work this out, let me know how that looks.

@alandtse
Copy link
Owner

Looks good. Thanks for that.

@alandtse alandtse merged commit f0fc6e4 into alandtse:dev Nov 21, 2022
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.

Upgrade 3.0 sentry mode switch missing
2 participants