[APP][Pro] Tesla Car & Energy - Zero emissions. Zero compromises

Setup the telemetry as you suggested and it works as expected. Thanks for you guidance!

Hello. I am trying to add my Energy Site and following all your instructions, i get stucked in the last step, Session initiate on the manufacturer website

In this step, the Tesla oAuth popup should be shown.

Can you try to hard-close the Homey app (Homey mobile app). This oAuth call is done by Homey/mobile app. Something stopped the GUI to open the html popup.

Thanks for your answer. But I fixed it, opening a private web session and adding the devices. It worked!

Hi Ronny,
I’m trying to add a Tesla Energy Site / Powerwall using Tesla Car & Energy v4.4.8 on a Homey Pro Early 2019.
I created the Tesla Fleet API application according to your instructions, with both allowed origins (athom.com and rwdevelopment.de), the Athom OAuth callback, Authorization Code + Machine-to-Machine, and all requested scopes.
Tesla OAuth completes successfully and redirects to callback.athom.com with “You can now close this window”.
Immediately afterwards Homey returns:
412 Precondition Failed – Account … must be registered in the current region https://fleet-api.prd.na.vn.cloud.tesla.com
Restarting the Homey app and repeating OAuth gives exactly the same result.
My Tesla energy installation/account is in Switzerland.
Could you please advise how the Partner Account should be registered for the NA region, or whether this is something the Homey app should perform automatically during pairing?
Thanks!

Hi, can you please show me a screenshot, where exactly the error is shown? In pair view or in device details? Or just try agian, then send me a diagnostics report. Thanks.

In the past, there have been user accounts in another reqion than the device region. But I’m not sure if that’s the case.

Hello, it is after the login Tesla (ok) and the “you can close this window” screen. Thank you!

I haven’t got a diagnostics report, but I think it won’t help as the error is shown in the html GUI.
I think it occours by reading devices.

The error looks like your device is registered is another region than your account.

There was an old issue where this happened and the only way to solve it was to change the account region. Can you please look at your account region?

Background: Your account is registered in a region and it also delivers the correct API url. The app is using this URL to access your devices via FleetAPI. So it seems as if either your device or your account is registred in a wrong region. (but that’s only a guess).

@RonnyW is it possible to add the FSD version? I log the software version but that doesn’t include FSD. Thanks!

Hi Ronny, I have the same I think, I fail at the Fleet API partner/domain registration stage.

Homey Pro 2023, Tesla Car & Energy v4.4.8, UK Tesla account, first-ever Tesla Developer application. The application is approved, OAuth succeeds, the app appears under Tesla Third Party Apps, and all 7 scopes are now granted including Profile Information.

Energy Site pairing still fails with:
412 Precondition Failed: Account must be registered in the current region https://fleet-api.prd.na.vn.cloud.tesla.com

Reproducing Car pairing in Homey Developer Tools gives:
422 Validation failed: Domain has already been taken
for both NA and EU domain registration.

Could the Homey-specific domain have been successfully/partially registered during the first attempt, with subsequent attempts then incorrectly trying to register it again? Is there a way to verify or reset the domain registration for this Client ID?

Diagnostics report: ca271ef2-4d70-49ef-93ae-dd3485647ca0

No, there is no way to reset the domain. It’s then bound to your clientID. So just use the client id you used for first login.
Tesla doesn’t offer an API for removing the domain. I requested that but never got an answer…

The domain is a virtual subdomain for your Homey cloud ID and that’s linked to your Tesla client ID.
If you start pairing again with the same client ID, the public certificate is re-used and domain registration is done again. You can force the generation of a new public certificate in client if form (the button below). Perhaps this could fix the domain registration (but I don’t think that’s the reason).

After some research in Tesla documention, the error http 412 error says that the app (client ID) is not yet registered for the Tesla region (NA or EU). In normal pairing, an error in domain registration should stop paiting. Were you able to proceed to oAuth and device list?

I’ll take a look at the Telemetry fields…