[APP][PRO] Tesla - Zero emissions. Zero compromises

The app is doing exactly this. But it’s only registration of the app URL (client_id), not your personal account.

The problem is, that your account reports e.g. region EU after oAuth.

The app is using this region to call the API (region based URL). But your car is in another region. That’s something, you can’t handle via API.

Only way is to force another URL is to set it manually (e.g. device settings). I’ll check next days what I can do.

ah I see. ok, then I misunderstood
Thanks for clarification

Im guessing youre thinking along the lines of a dropdown on login to the tesla dev site (within homey) where one could choose the URL?
Or, I think I saw a region check you could do via API - in theory I guess you could check the accounts region, and then get the correct URL and further the process

either way, thanks for checking it out :slight_smile:

Incidentally, as I dont know which region to choose in my settings (I tried United States) because I dont know which region my car is in - that method didnt work, or, entirely p[ossible I missed something

Are you using the same account for car and developer? If you are using a second account for dev access, make sure you are using the car account for oAuth login.

And yes, I thought about a region selection in car dehice settings, so the apo can use a fixed region (optional) instead of account region.

I dont know to be honest. I think no

Wife had tesla (its actually her agreement) she has her own account, she shared the car with me (this is why I think no)

We then had solar and powerwall installed, and the installer put it on my account, and then I shared that with wifes account

we both see the same car and the same powerwall/solar install in the tesla app

I’ll get her to try logging in with her account, that might get me past it

no, that didnt work either :frowning:

got her to create a dev account and everything also.

It doesn’t make a difference whether a car is shared. It depends on the contry where the car is registered (I think) - and which Tesla region the car uses to communicate.

When exactly do you get the error? OAuth is ok and car is found? And after adding on first data reading, the device gets unavailable with this error?

yes, oauth works, I go to add the car, no metrics. and the error

I just managed to get it working though

So yesterday I set the region to US - this didnt work, same error
I then went to put it back to UK

I then tried again, but it failed as before.

Just out of curiosity, I decided to remove and readd the ‘Application Details’ in tesla dev website
I tried the new device again

This seemed to make it work. I added the car, but this time its got all the metrics
I was also able to add solar/battery

So im not sure which part of my messing with it made it work?!

Thanks for your help though, pointed me in the right direction

Curious.

Just an idea… Did you add the car device again after changing the account region?

If I remember right, the app reads the region from account after oAuth login. Perhaps it also should have worked a remove/readd of car device.

No matter how—the main thing is that it works :grin:

And a last hint… activate Telemetty and deactivate polling in car settings :wink:

yeah when i changed region to US i removed and readded the car.
because im supposed to be set to UK, im not surprised this failed

I removed and readded the car after changing it back to UK also. There were a couple of Homey restarts also just in case it cached something

I have no idea what combination of events made it work :smiley:

why activate tel and deactivate polling?
will this stop it from staying awake all the time?

PS. Can this App set backup reserve setting on the powerwall?
That is only done via the Tesla cloud API (not fleet, and not locally)

Polling is done in intervals only and costs a lot of API credit. Telemetry is realtime and much cheaper. With a 5min interval your 10€ (or 10£, don’t know the exact amount fir UK) are used and you won’t have much free for commands. Using Telemetry, you only need a fraction of the costs. And you get realtime updates (e.g. coming home, start charging). Just try :wink:

Powerwall only supports data reading via FleetAPI.

There was a undocumented API for historical data used to make a virtual meter, but that’s bot working anymore. So you only get current energy usage.

Backup reserve is possible but not added yet. Other commands don’t seem to be really usefor for Homey (?).

The history data is a mess trying to get something like sum today or sum yesterday.

I can add backup support as flow action if this is enough.

New test version 4.2.0:

  • Added flow actions and capability for battery reserve.
    Capability is shown in Energy Site Battery.
    Flow actions are available for Energy Site or Energy Site Battery.

@Paul_H FYI and test :slight_smile:

absolute legend! I will update and report back once Ive had a chance to play with the automation!

Thank you!

This works a treat, I was able to stop the car sucking all the battery power in energy peak times. ie, the car should only charge off peak

One caveat. you cannot set battery reserve to more than 80%. the flow just fails
I think this is by design as I remember seeing this somewhere

Additional:

Would it be possible to put the ‘Battery becomes (less than/greater than) %’ in the ‘AND’ cards so that I can base some flows logic on battery %??
For example, car should only charge off peak, OR if battery is 80% AND time is 6pm

I think theres some metrics missing also, but I havent had a play with that yet. It could be a setting I havent enabled
Particularly, solar, energy produced today
battery dicharged/charged today

The app has only condition cards for ‘special’ conditions (dropdown). Please use standard Logic cards and device tags.

And “becomes less…” is a trigger, not a condition.

Like already said, the history API I used (an undocumented one) is broken since some months. I opened a ticked at Tesla support, but nothing got fixed. So currently, the app only has current/live data for energy site.

Any updates from Tesla?

Which API were you using for the historic metrics?