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

Destination of Navigation #384

Closed
pbathuk opened this issue Nov 30, 2022 · 9 comments · Fixed by #409 or #423
Closed

Destination of Navigation #384

pbathuk opened this issue Nov 30, 2022 · 9 comments · Fixed by #409 or #423
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@pbathuk
Copy link

pbathuk commented Nov 30, 2022

Is your feature request related to a problem? Please describe.
I don't know if this is possible from the API or not, but would be great to get access to some / all of the following:
Destination set within the Tesla
Time to destination

I have to automation ideas if these can be exposed e.g. if destination eq home, the time remaining is < 30 minutes and the house is below X then activate the heating (set house occupancy as occupied).

Or - if destination equal friends house, message them when time to house is 10 minutes out.

Describe the solution you'd like
Ideally the API contains these and can be exposed via the Tesla intergration.

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

@alandtse alandtse added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Nov 30, 2022
@carleeno
Copy link
Contributor

carleeno commented Dec 1, 2022

+1, this would be great for "heading home" automations.

I'll take a look to see if the data is available tonight

@InTheDaylight14
Copy link
Contributor

I haven't seen anything in the API response that points to a destination, arrival time, etc. Unfortunate because that would be super cool. I was imagining a location_tracker that could use the setup zones to know if you were going home or to work. Then a sensor to estimate when you would get there.

Side note: There is the proximity sensor for heading home automatons

The one possibility is sharing an address to start navigation. I'm not sure what best implementation would be for that. This is possible through the custom api call service.

@carleeno
Copy link
Contributor

carleeno commented Dec 2, 2022

I suspect that data is only in the websockets payload, but it is available to the app somehow.

It looks like the websockets feature is currently broken in teslajsonpy, but it also looks like there is now an httpx-ws library we might be able to switch to if needed.

I didn't have time last night to get very far with this, but will try to get a capture of some ws data to see if nav destination is available there or not, to inform if it's worth fixing websockets support.

@pbathuk
Copy link
Author

pbathuk commented Dec 3, 2022

Oh wow, I was not expecting any traction on this, so to see someone else who likes the idea is great :)

If I get any time I am happy to do my own digging as well, but relies on a few things:

  1. Kids not needing my attention or trips out
  2. The car not beaconing me to drive it all the time :)
  3. Not feeling shattered after 1.

Fingers crossed for Sunday to have some time

@carleeno
Copy link
Contributor

carleeno commented Dec 4, 2022

I messed around trying to get websockets working again, but it's requiring some large rewrites of the old websocket logic to use the new httpx_ws library, and I ran out of time today.

I think it'll be easier to try to create a small stand-alone script to test the websocket connection and see if the nav info is available there. I did confirm with the app again that it does reflect the nav destination and eta, so I still have some hope.

@InTheDaylight14
Copy link
Contributor

Just noticed these fields in drive_state.

"active_route_destination": "Saved dest. name (maybe address if not saved??)",
"active_route_energy_at_arrival": 40,
"active_route_latitude": 34.111111,
"active_route_longitude": -88.11111,
"active_route_miles_to_arrival": 19.849678,
"active_route_minutes_to_arrival": 34.133333,
"active_route_traffic_minutes_delay": 0.0,

Some are not available when parked, but it looks to be everything we would need.

@carleeno
Copy link
Contributor

carleeno commented Dec 5, 2022

Nice! I even meant to check the api data to see if it was there only when in Drive, and I totally forgot to do so.
I'm glad we don't have to fuss with websockets!!

@InTheDaylight14
Copy link
Contributor

In the draft PR I have a location tracker for the destination, a distance to destination sensor, and an arrival time sensor.

The arrival time sensor has extra attributes with the energy at arrival, traffic minutes delay, and the destination name/string.

Naming convention:

  • sensor.my_model_s_arrival_time
  • sensor.my_model_s_distance_to_arrival
  • device_tracker.my_model_s_destination_location_tracker

Let me know if those attributes deserve their own HA sensors and if there are better entity names than what I came up with.

@pbathuk
Copy link
Author

pbathuk commented Dec 6, 2022

Oh wow, you guys are amazing. I believe this provides what is needed for my usecase :)

Looking forward to seeing the PRs track through

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
4 participants