Tesla Integration to Query Status and Send Commands to Your Car

does anyone elses show present without having homelink active in their car.. maybe as summizaed it is tied to that I cannot find much info on the attribute.. Tesla does not really document their api.. no suprise there.

It is set to my actual address.
As a work around, I could set my "home" based on the Lat/Lon, with a few degrees of difference. I don't need the immediate update. I only want to know if I'm charging between peak times or forgot to plug in the car.

Can confirm my Model 3 without homelink is showing not present at home. It is currently in the garage, and charging. The car seems to recognize my address well in terms of not running sentry or locking at home (which are the settings I want since it is always in a garage). Presence seems to be homelink controlled (or enabled when homelink is installed)

image

So it looks like Tesla changed the authentication token again so it resets after 8 hours instead of weeks. Anyone else seeing this? Or is it something related to the app I am using to get my token?

I'm not seeing this. I juat use teslafi and cut anf paste my token. Ive had yge same for about 2 wks now.

1 Like

@snell has logic in Pulling data out Tesla Powerwall that will get and refresh the token in the app. Any chance of incorporating that?

Good to know. I was using the Tesla Tokens app on Android and it was working good for me for a while. Though I went to update yesterday and it had a notice saying Tesla changed their token authentication time to 8 hours. Guess I'll need to look into other methods to update it.

This would be a nice addition, or even if there was a way to use that driver / app to get the token into a global variable into Hubitat which then the Tesla connect app could reference

2 Likes

@kahn-hubitat - I updated the driver and app to include valet mode indicator (my garage is valet) and tire pressure for the four tires. Will you add in for the community if I send to you?

valet_mode : On
tire_pressure_front_right : 44.0
tire_pressure_front_left : 44.0
tire_pressure_rear_left : 44.0
tire_pressure_rear_right : 44.0
1 Like

sure send me the code

ok integrated the changes above re tire pressure and valet mode with a slight change.

code was fine as is.. but noticed it would set tire pressures to NULL while parked as the car does not read tire pressures till you start moving.

So to handle this change tire presssure(s) attributrs to stirngs and set them to n/a when parked or pressures are not know.. Also related added last_known tire pressure attributes that only get set when value is not null..

new version on git hub.

1 Like

weird that you tire pressures seemed to be in your debuggin in psi.. that is not what was comning out in my test of your code.. check it.. mine was coming out in bar instead of psi so i addeded conversion and fixed a typo..

are you sure the code you are using is what you sent me..

anyway

  • new version fix misspelling of tpms vs tmps and notice tire pressures were in bar so convert to psi

yet another iteration the code sent to me by brad had mismatch driver and app code for the field names for the tire pressures.. new version on github.

and as before it is in bar converted to psi.. if someone really really needs it in bar instead i will add a parameter for it otherwise livef with it .. lol

1 Like

Thanks, @kahn-hubitat… this looks great. Thanks for reviewing and fixing my errors. I did notice the pressure null issue when not driving, but was just going to work around it… but I like your solution. Thanks again!

For some reason the last_known attributes aren't remaining permanent. It looks like they are zeroing out when the current pressures zero out. Perhaps the attribute isn't reading as null and the != null condition isn't applying correctly? Below are the logs and what I'm seeing. I'll play around with it as well and see what I can figure out. Also, feel free to remove my info and any explanation of my mistakes in the comments, since I just threw in some code and you're the one who's doing the real work :upside_down_face:
_
Both current and last_known set as expected:

2022-04-21 20:36:37.594 debug processData: [state:online, ... ..., tire_pressure_front_left:3.25, tire_pressure_front_right:3.225, tire_pressure_rear_left:3.2, tire_pressure_rear_right:3.225]
last_known_tire_pressure_rear_right	46.8 DEVICE 2022-04-21 20:36:28.319 EDT
           tire_pressure_rear_right	46.8 DEVICE 2022-04-21 20:36:28.319 EDT

_
Both current and last_known zeroed out:

2022-04-21 20:40:40.594 debug processData: [state:online, ... ..., tire_pressure_front_left:0.0, tire_pressure_front_right:0.0, tire_pressure_rear_left:0.0, tire_pressure_rear_right:0.0]
last_known_tire_pressure_rear_right 0.0 DEVICE 2022-04-21 20:40:40.616 EDT
           tire_pressure_rear_right 0.0 DEVICE 2022-04-21 20:40:40.615 EDT

I changed the if conditions to != 0.0 and I'm now getting the n/a results tire_pressure_front_left : n/a ... so I'll go for a drive tomorrow to test this out with actual pressure values coming through.

Mine are working fine..fo you have the latest version

Yeah... I'm using HPM, and I have the one from 18-Apr

I just touched it pull it and try. I made another change that day like an hour later and forgot to touch the main file. You can see in the log if you are are getting null or 0 when parked.

Hmmm... I just updated to the most recent version via HPM, and I don't see any difference in the logic. I'm going to revert to the below locally, because that is working for me. if null is working for you, perhaps an OR statement for null or 0?

if (data.vehicleState.tire_pressure_front_left != 0)

Show.me the.logs about what your.car is reporting when not in motion.