Control and Query your Tesla vehicles (via Tessie.com)

You have at least one referral now. Hopefully we can get you a free lifetime account for your efforts on the Hubitat integration.

I'm pretty pleased with Tessie so far. They had a way to import from Teslamate, meaning I have about 3 years of data in my brand new account that I created today, and when I asked them to link your referral code to my already-created sign-up, they did so, and got back to me in less than 10 minutes!

2 Likes

I think I've found a bug :slight_smile:

NPE over a reservation in the account without an actual car :slight_smile:

I have a pending delivery of the Cybertruck, but it doesn't have most of the properties the app expects, such as name, VIN, etc, so it fails with java.lang.NullPointerException: Cannot get property 'vehicle_id' on null object

Those probably should be filtered out (probably by lack of vehicle_id) when populating the vehicle list.

@kahn-hubitat do you want me to do a PR for that?

not really a bug.. it cannot work without a vehicle with a vin.. that is required for the apis.

unless you have a car and this is an additional one that needs to be skipped.. then yes that would be a bug and i can look into that.. and skip it.. can you post full logs of trying to add the vehicle.

assuming that is the case ie you have a valid vehicle and a pending one in your account.. interestingly enough the old implementation around for years would have also barfed on this.. weird it was never found.

Anyway, try the new version that should skip over the bad vehicle.

v 1.5 1/16/24 skip over vehicle in account ie on order, without a valid vehicle id or vin
*/

That's exactly what happens.

Still failing. Here the log:

app:473 2024-01-16 10:48:23.298 PM error java.lang.NullPointerException: Cannot get property 'vehicle_id' on null object
app:473 2024-01-16 10:48:23.294 PM debug last_state = null
app:473 2024-01-16 10:48:23.292 PM debug  found the vehicle = [is_active:false, ...]
app:473 2024-01-16 10:48:23.289 PM info Found Vehicle XXX: The Rustler, vin: XXX
app:473 2024-01-16 10:48:23.288 PM debug vin = XXX
app:473 2024-01-16 10:48:23.286 PM debug vehicle name = The Rustler
app:473 2024-01-16 10:48:23.284 PM debug vehicle id= XXX
app:473 2024-01-16 10:48:22.854 PM debug last_state = [access_type:OWNER, api_version:71, ...]
app:473 2024-01-16 10:48:22.521 PM debug found the vehicle = [is_active:true, is_archived_manually:false, ...]
app:473 2024-01-16 10:48:22.517 PM infoFound 2 vehicles
app:473 2024-01-16 10:48:22.031 PM debug one result = [[is_active:true, is_archived_manually:false, ...]]
app:473 2024-01-16 10:48:21.586 PM debug result = [results:[[is_active:true, is_archived_manually:false, ...]]]
app:473 2024-01-16 10:48:21.583 PM debug result = groovyx.net.http.HttpResponseDecorator@101917a
app:473 2024-01-16 10:48:21.294 PM debug request parms = [uri:https://api.tessie.com/vehicles, timeout:20, headers:[User-Agent:lgkahn, Authorization:Bearer XXX]]
app:473 2024-01-16 10:48:21.291 PM debug method = GET
app:473 2024-01-16 10:48:21.290 PM debug path = /vehicles
app:473 2024-01-16 10:48:21.289 PM debug server url = https://api.tessie.com
app:473 2024-01-16 10:48:21.288 PM debug token = XXX
app:473 2024-01-16 10:48:21.286 PM info authorizedHttpVehicleRequest GET /vehicles
app:473 2024-01-16 10:48:21.285 PM debug in authorize http req
app:473 2024-01-16 10:48:21.282 PM info refreshAccountVehicles
app:473 2024-01-16 10:48:21.281 PM debug in refreshAccountVehicles. current token = XXX
app:473 2024-01-16 10:48:21.279 PM debug In select vehicles

its going to keep failing.. you need to delete your vehicles then go back in app and start again..

Delete them from where? They were never created in Hubitat.

The output makes no sense it cannot get into the line of code looking for vehicle id it already checks if the vehicle id was null before printing out the last_state output

ie

 }
    
	if (descLog) log.info "Found ${resp.data.results.size()} vehicles"
    resp.data.results.each { vehicle ->
       
     //lgk change vehicles can appear in acct without a valid vehicle id so skip thise
     if ((vehicle != null) && (vehicle.last_state.vehicle_id != null) && (vehicle.vin != null))
        {
         if (debug)
           {
            log.debug " found the vehicle = $vehicle"
            log.debug "last_state = ${vehicle.last_state}"
            log.debug "vehicle id= ${vehicle.last_state.vehicle_id}"
            log.debug "vehicle name = ${vehicle.last_state.vehicle_state.vehicle_name}"
            log.debug "vin = ${vehicle.vin}"
           }
        
        def id = vehicle.last_state.vehicle_id
        def vname = vehicle.last_state.vehicle_state.vehicle_name

Are you sure you installed the new code...

Freaking GitHub caching. Got me again.
Trying now.

BTW, you can utilize Groovy Safe Navigation + Groovy Truth for that check:

     if (vehicle?.last_state?.vehicle_id && vehicle.vin)
1 Like

It still fails because the vehicle.last_state is null in the if check.

The form I suggested fixes it as it has the save navigation on last_state. Another option would be adding another $$ vehicle.last_state != null.

ok changed it again to your line..

1 Like

Yay, making progress :slight_smile:

The car without the VIN is now skipped; I see only one car in the selection. Selecting it generates the device, but it is called by the ID (not the name, as it is supposed to be, I think?), and refreshing it logs "No data found for XXXX" (where XXXX is the car ID).

Should we go to the DMs to troubleshoot it further?

Just wondering... what has anyone found to be the best amount of Wait/Pause time without it becoming to long?

Screenshot 2024-01-17 075416

I.dont use any wakes. You dont
seem to need thrm with tessie.

2 Likes

Delete app and any children. Reinstall app wirh debug mode and send me a dm with entire logs as it us not creating child with correct vin or maybe you havent enabled commanda in tessie or tesla. Also check that commands work directly from the browser.

  • 1/17 Add attribute usableBattery.. may want to change rules to this as that is what tesla app appears to report for battery
  • also round the range as similiarly tesla app does this and when we get range for instance 250.62 tesla app reports 251,
  • we previously showed 250 as it was truncating.

A clean reinstall of today's version helped; thank you! Thanks for all your work!

1 Like

now available on package manager

4 Likes

Matched successfully!