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

get_location() not updating if car is parked facing north #276

Closed
itssimon opened this issue Jan 18, 2022 · 1 comment · Fixed by #277
Closed

get_location() not updating if car is parked facing north #276

itssimon opened this issue Jan 18, 2022 · 1 comment · Fixed by #277

Comments

@itssimon
Copy link
Contributor

itssimon commented Jan 18, 2022

I'm using the tesla_custom custom component in Home Assistant and have been wondering why the location of our car is often reported as away or unknown by the device_tracker entity in HA if the car is parked in our garage.

I found the culprit in this line of code:

if self.__longitude and self.__latitude and self.__heading:

It just so happens that our garage is facing almost perfectly north, which means that often the Tesla API will return a heading value of 0, which of course evaluates to false and makes the get_location() not update the value or return an empty dict.

@itssimon itssimon changed the title get_location() returns null if car is parked facing north get_location() returns null if car is parked facing north Jan 18, 2022
@itssimon itssimon changed the title get_location() returns null if car is parked facing north get_location() not updating if car is parked facing north Jan 18, 2022
@alandtse
Copy link
Collaborator

Wow, nice catch and a good sign of proper boolean checking.

alandtse pushed a commit that referenced this issue Jan 18, 2022
Test for changes to location were based on non-0 values which would fail if any value was 0 (such as heading north). Fix correctly treats 0 as a valid value.

closes #276
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 a pull request may close this issue.

2 participants