widewing / ha-toyota-na

Home Assistant integration for Toyota Motor (North America) connected services
75 stars 17 forks source link

"Not Logged In" message #52

Closed lunar-studio closed 2 months ago

lunar-studio commented 2 years ago

I don't know if I need an "active subscription" in order to at least be able to log in and get past this message or if something else might be incorrect.

I'm new to HA and just installed HACS - excited to actually see a smart integration for my car.

I used to have the Entune App (with username and pass) then upgraded to their newer plain "Toyota" app. Then Toyota pulled a switch and bait on my 2019 Prius Prime Advanced with Connected Services. Key FOB works still for remote start, but this actually seems much handier. I realize in order for it to work that I'd probably have to pay their ransom fees. I was able to log into their App just now, albeit I don't have a subscription (yet.)

Thanks!

Edit: If it is related to not having an Active Subscription, please consider adding a notice which states "Active Subscription Required" next to the "Not Logged In" message. My initial thought (just like the app) is at the very least I might be able to get past this log in screen but unable to see data until a subscription is purchased.

_Edit #2: Might be something actually wrong on Toyota's end with Connected Services suddenly not being shown on my account. Will be on the phone with them. Used to work but apparently doesn't even show up on their end now. Was told to call Toyota's "Brand Services" at 1-800-331-4331.

Update: @t0ny-peng may have found a HA solution: https://gist.github.com/t0ny-peng/f85b0a0dc3d46246ae17a9d7215e39da

cwwilson08 commented 1 year ago

I just wanted to say thanks to everyone posting on how to make this work again. Especially @brylee123 for the excellent write up. After screwing up my config entries file numerous times I finally made this work.

jgdf42 commented 1 year ago

Can anyone help me get this working? Got my json and replaced the contents, reboot HA, but HA throws an error in log. My integration was installed via HACS.

My HAS log:

Error setting up entry Toyota Corolla for toyota_na

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/toyota_na/__init__.py", line 38, in async_setup_entry
    client.auth.set_tokens(entry.data["tokens"])
  File "/usr/local/lib/python3.11/site-packages/toyota_na/auth.py", line 187, in set_tokens
    self._id_token = tokens["id_token"]
                     ~~~~~~^^^^^^^^^^^^
KeyError: 'id_token'

My core.config_entries snippet (redacted credentials, included another entry above it to show how indentation is spaced;)

      {
        "entry_id": "96e69890d09d2a2bb5cfe91b89307227",
        "version": 1,
        "domain": "homekit_controller",
        "title": "Roku 4670RW 51A1 (None)",
        "data": {
          "AccessoryIP": "192.168.1.185",
          "AccessoryPort": 45830
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "ignore",
        "unique_id": "19:d8:e5:b6:03:e3",
        "disabled_by": null
      },
      {
        "entry_id": "f38a8263a9434c598bfc9f7b6cb9e25d",
        "version": 1,
        "domain": "toyota_na",
        "title": "Toyota Corolla",
        "data": {
          "tokens": {
            "access_token": "copy and pasted my access token from my json",
            "refresh_token": "copy and pasted my refresh token from my json",
            "expires_at": 1692638805.182473,
            "updated_at": 1692637006.182488,
            "guid": "copy and pasted my guid from my json"
          },
          "email": "email my account is under",
          "username": "email my account is under (also tried phone number)",
          "password": "password for my account"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:email my account is under",
        "disabled_by": null
      },

Also, the syntax of @brylee123 core.config_entries example here; https://github.com/widewing/ha-toyota-na/issues/52#issuecomment-1540831221 is a different syntax from the one posted by @dannycohn here; https://github.com/widewing/ha-toyota-na/issues/52#issuecomment-1572328095 ??

jtaseff commented 1 year ago

tokens["id_token"]

your config file only has access_token and refresh_token...

jgdf42 commented 1 year ago

tokens["id_token"]

your config file only has access_token and refresh_token...

There is also no id_token in the above examples, so I overlooked this. Thank you.

Now I get this error in my logs;


Source: config_entries.py:432
First occurred: 10:49:09 PM (1 occurrences)
Last logged: 10:49:09 PM

Config entry 'Toyota Corolla' for toyota_na integration not ready yet: 500, message='Internal Server Error', url=URL('https://oneapi.telematicsct.com/v1/global/remote/status'); Retrying in background```
yankees5963 commented 1 year ago

same 500 error as @jgdf42

edit: just to add some info, when I use the command line with app.py I can get vehicle status, vin and all, but some pages such as "get_engine_status" give a 500 error on the URL. not sure if its because my vehicle doesn't have advanced options (Base model) but it shouldn't error.

android52 commented 1 year ago

Thanks @brylee123 for the writeup and @layuso for the auth.py - managed to get this working from never having installed the integration before.

Does anyone know if the Integration works in Canada as it appears the website, logins, and app (registration) might be different? I can't use the Toyota.com website to add my VIN, which is, I suspect why the vehicle added to my app (registered as Canada) isn't showing on the Toyota.com website, and why I get the error below (logs) and the integration is giving me "Failed setup, will retry" as there is no vehicle to pull information for?

Can anyone confirm?

`This error originated from a custom integration.

Logger: custom_components.toyota_na Source: custom_components/toyota_na/init.py:104 Integration: Toyota (North America) (documentation, issues) First occurred: 9:32:53 PM (3 occurrences) Last logged: 9:33:24 PM

Error fetching data Traceback (most recent call last): File "/config/custom_components/toyota_na/init.py", line 104, in update_vehicles_status raw_vehicles = await get_vehicles(client) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/vehicle/vehicle.py", line 36, in get_vehicles await vehicle.update() File "/usr/local/lib/python3.11/site-packages/toyota_na/vehicle/vehicle_generations/seventeen_cy_plus.py", line 77, in update vehicle_status = await self._client.get_vehicle_status(self._vin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 67, in get_vehicle_status return await self.get_vehicle_status_17cyplus(vin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 80, in get_vehicle_status_17cyplus return await self.api_get("v1/global/remote/status", {"VIN": vin}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 41, in api_get return await self.api_request("GET", endpoint, header_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 31, in api_request resp.raise_for_status() File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://oneapi.telematicsct.com/v1/global/remote/status') `

gitsbydill commented 1 year ago

I have read through the thread and seen the solutions folks have for the Code authentication but it looks a bit beyond my knowledge level. Is there any chance this will ever make it into the integration natively?

gokou340 commented 1 year ago

Any luck on a fix for this? I am newer to HA and can't figure out how to implement the above suggested code.

I believe you are able to do this all inside of Home Assistant but that was not the route I went with. I am using Ubuntu (WSL) Terminal. I installed toyota-na from PyPI linked here: https://pypi.org/project/toyota-na/

In my Ubuntu Terminal I ran: pip3 install toyota-na

Then you need to do the edits that JiDoan mentioned above. To find out where the toyota-na library lives, you can run pip3 show -f toyota-na

It'll show you where the Python scripts are stored. For reference, it was here: Location: /home/brylee123/.local/lib/python3.10/site-packages/toyota-na

Inside that directory, there is a file called auth.py. Inside auth.py on approximately line 40, there is this for-loop. for cb in data["callbacks"]:

You will need to replace the contents of this for-loop with the code snippet mentioned above (linked here: #52 (comment))

Make sure you save and close auth.py. Now you may run this command which will now prompt you for a OTP sent to your email/phone. python3 -m toyota_na.app authorize <username> <passworde>

Type in your OTP and then it should finish.

Remember the location of auth.py? There is now a hidden file there called .toyota_na_tokens.json If you're in the terminal and in the directory where auth.py lives, you can run cat .toyota_na_tokens.json and it'll display all the values you need to copy over to .storage/core.config_entries in Home Assistant. NOTE: I believe if you try to run this twice, .toyota_na_tokens.json does not overwrite itself. So make sure you delete the file if you plan on re-authorizing.

Back to Home Assistant: Copy the contents of .toyota_na_tokens.json to .storage/core.config_entries in Home Assistant. If you do not see .storage in the File Editor, go here and change the setting: Addons > FIle Editor > Configuration > Press X on .storage You may need to reboot File Editor.

EDIT: Within /config/.storage/core.config_entries, you should have a Toyota entry for your vehicle if you installed this integration before, otherwise, I believe you can manually fill it out like so.

      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin paste-block .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

Make sure you have the YAML indentation spacing correct. Save in the File Editor. Dev Tools > YAML > Check Configuration & Restart.

This should solve the problem!

Can confirm this solution still works. Did it today without ever having used the integration before.

tmorris0221 commented 1 year ago

Any luck on a fix for this? I am newer to HA and can't figure out how to implement the above suggested code.

I believe you are able to do this all inside of Home Assistant but that was not the route I went with. I am using Ubuntu (WSL) Terminal. I installed toyota-na from PyPI linked here: https://pypi.org/project/toyota-na/ In my Ubuntu Terminal I ran: pip3 install toyota-na Then you need to do the edits that JiDoan mentioned above. To find out where the toyota-na library lives, you can run pip3 show -f toyota-na It'll show you where the Python scripts are stored. For reference, it was here: Location: /home/brylee123/.local/lib/python3.10/site-packages/toyota-na Inside that directory, there is a file called auth.py. Inside auth.py on approximately line 40, there is this for-loop. for cb in data["callbacks"]: You will need to replace the contents of this for-loop with the code snippet mentioned above (linked here: #52 (comment)) Make sure you save and close auth.py. Now you may run this command which will now prompt you for a OTP sent to your email/phone. python3 -m toyota_na.app authorize <username> <passworde> Type in your OTP and then it should finish. Remember the location of auth.py? There is now a hidden file there called .toyota_na_tokens.json If you're in the terminal and in the directory where auth.py lives, you can run cat .toyota_na_tokens.json and it'll display all the values you need to copy over to .storage/core.config_entries in Home Assistant. NOTE: I believe if you try to run this twice, .toyota_na_tokens.json does not overwrite itself. So make sure you delete the file if you plan on re-authorizing. Back to Home Assistant: Copy the contents of .toyota_na_tokens.json to .storage/core.config_entries in Home Assistant. If you do not see .storage in the File Editor, go here and change the setting: Addons > FIle Editor > Configuration > Press X on .storage You may need to reboot File Editor. EDIT: Within /config/.storage/core.config_entries, you should have a Toyota entry for your vehicle if you installed this integration before, otherwise, I believe you can manually fill it out like so.

      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin paste-block .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

Make sure you have the YAML indentation spacing correct. Save in the File Editor. Dev Tools > YAML > Check Configuration & Restart. This should solve the problem!

Can confirm this solution still works. Did it today without ever having used the integration before.

Which solution? The long thread and/or the YAML above? I just updated my auth.py with the #53 solution, but get syntax error with all of the elif(s). I'm using VSCode and running using the python client built in.

memphis2k commented 1 year ago

Does anyone have any advice for getting plugin with 2FA? I don't have an auth.py file when installed through HACS.

Thanks,

dlreynolds562 commented 1 year ago

I have tried this fix from May 8 several times and am able to generate a token, but whenever I update /config/.storage/core.config_entries and then restart HA it crashes and I am unable to load the UI. If I unplug my server and plug it back then HA will start but ALL data in core.config_entries is deleted and a file called core.config_entries.corruputed (which is empty) is generated. Nothing is saved in the logs when I do this. I am also being very careful to ensure that all the syntax and indentation is correct. Any ideas?

tmorris0221 commented 1 year ago

I have tried this fix from May 8 several times and am able to generate a token, but whenever I update /config/.storage/core.config_entries and then restart HA it crashes and I am unable to load the UI. If I unplug my server and plug it back then HA will start but ALL data in core.config_entries is deleted and a file called core.config_entries.corruputed (which is empty) is generated. Nothing is saved in the logs when I do this. I am also being very careful to ensure that all the syntax and indentation is correct. Any ideas?

I just had the same happen to me yesterday! Basically reset my whole HA system. I was able to generate all the needed data, but can't add the config to the core.config entries manually... that seems to be where the issue is for me. And with not being able to add the integration, can't get an entry there correctly.

tmorris0221 commented 1 year ago
      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin PASTE .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

It looks like you found a solution already. I've bolded the portion of the code that should be copied over from .toyota_na_token.json. I will also update my previous post to include this snippet too.

Is the Entity ID the GUID or the ID_TOKEN? yesterday when I manually added this to my core.config file its killed my HA. I know I was missing this attribute but need to know which is the correct ID to insert there...

jtaseff-gfms commented 1 year ago

Is the Entity ID the GUID or the ID_TOKEN? yesterday when I manually added this to my core.config file its killed my HA. I know I was missing this attribute but need to know which is the correct ID to insert there...

I used the GUID as the "entry_id" and it worked. I don't think it even matters, only needs to be unique.

tmorris0221 commented 1 year ago

Is the Entity ID the GUID or the ID_TOKEN? yesterday when I manually added this to my core.config file its killed my HA. I know I was missing this attribute but need to know which is the correct ID to insert there...

I used the GUID as the "entry_id" and it worked. I don't think it even matters, only needs to be unique.

Did you already have the integration added or just added the entry manually and restarted?

jtaseff-gfms commented 1 year ago

I never had the integration working until adding it manually with the method above.

The code block you have is also missing a 3rd token, id_token, that also showed up in the generated token file.

tmorris0221 commented 1 year ago

I never had the integration working until adding it manually with the method above.

The code block you have is also missing a 3rd token, id_token, that also showed up in the generated token file.

Thanks! I seemed to have killed my HA again when adding this manually... The copy/paste of the code block seemed to match the other entries in there, so I don't think it is formatting. I did have the ID_Token included in the clipboard... Not sure why this seems to be killing HA upon a restart... Guess I'll be recovering this afternoon and giving it another go around.

dlreynolds562 commented 1 year ago

Let me know if you have had any success. I made another attempt last night and ran into the same issue. I have given up for now.

tmorris0221 commented 1 year ago

No success for me either... every time I edit that core config entries file, my HA crashes and I have to restore from backup. I'm holding out as well... not sure if it's formatting or something different.

cwwilson08 commented 1 year ago

When I initially tried this I had the same corrupt config errors. I was trying to insert the config at the top of the list and got repeated errors. I then added it to the bottom of the config list and it worked first try. I don't know if that'll help anyone else but it worked for me.

tmorris0221 commented 1 year ago

I was trying to add it second entry from the end, so that could've been my issue as well. I'll give it a shot at the bottom and see what happens. Couldn't hurt🤪🤪 I have a good full backup available

tmorris0221 commented 1 year ago

I tried adding it to the end of the file, making sure the formatting matched the entry above. It killed my HA system, so had to restore... Not sure where to go from here...

dlreynolds562 commented 1 year ago

@tmorris0221

I added the JSON code that I was pasting into the core config entries file to an online JSON editor and discovered that it did not like the "//" comments (which I was not removing). This fixed my issue and I was able to get the integration running. Hope this helps!

maxshcherbina commented 1 year ago

As someone who has just uncovered this issue, what is the current state of the project? Do we need to manually install the other plugin and modify files locally in order to get everything working? Is there a guide that someone would be kind enough to compile?

jimmycunny commented 1 year ago

Worked for me, the only thing I needed to do differently was to use a phone number rather than an email for the OTA

python3 -m toyota_na.app authorize <phone#> format for the phone number was no dash or space. 5555551234

jgdf42 commented 1 year ago

same 500 error as @jgdf42

edit: just to add some info, when I use the command line with app.py I can get vehicle status, vin and all, but some pages such as "get_engine_status" give a 500 error on the URL. not sure if its because my vehicle doesn't have advanced options (Base model) but it shouldn't error.

Did you ever get this resolved?

image

Debug log if anyone can make sense of this. Maybe I didn't update something? I'm just downloading newest version of integration from integration store via search in Home Assistant and adding my auth token contents to my config file. The python commands about my vehicle work on Windows when I run the commands for the script, just not in Home Assistant.

2023-10-28 00:22:54.284 DEBUG (MainThread) [custom_components.toyota_na] Updating vehicle status 2023-10-28 00:23:02.845 ERROR (MainThread) [custom_components.toyota_na] Error fetching data Traceback (most recent call last): File "/config/custom_components/toyota_na/init.py", line 104, in update_vehicles_status raw_vehicles = await get_vehicles(client) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/vehicle/vehicle.py", line 36, in get_vehicles await vehicle.update() File "/usr/local/lib/python3.11/site-packages/toyota_na/vehicle/vehicle_generations/seventeen_cy_plus.py", line 77, in update vehicle_status = await self._client.get_vehicle_status(self._vin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 67, in get_vehicle_status return await self.get_vehicle_status_17cyplus(vin) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 80, in get_vehicle_status_17cyplus return await self.api_get("v1/global/remote/status", {"VIN": vin}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 41, in api_get return await self.api_request("GET", endpoint, header_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/toyota_na/client.py", line 31, in api_request resp.raise_for_status() File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 500, message='Internal Server Error', url=URL('https://oneapi.telematicsct.com/v1/global/remote/status') 2023-10-28 00:23:02.860 DEBUG (MainThread) [custom_components.toyota_na] Finished fetching toyota_na data in 8.576 seconds (success: False)

gitsbydill commented 1 year ago

As someone who has just uncovered this issue, what is the current state of the project? Do we need to manually install the other plugin and modify files locally in order to get everything working? Is there a guide that someone would be kind enough to compile?

I would also be appreciative of some kind of guide to get this working inside go HA. I'm not advanced enough to go through Ubuntu so anything that is doable with studio-code-server or the HA terminal would be awesome

tmorris0221 commented 1 year ago

As someone who has just uncovered this issue, what is the current state of the project? Do we need to manually install the other plugin and modify files locally in order to get everything working? Is there a guide that someone would be kind enough to compile?

I would also be appreciative of some kind of guide to get this working inside go HA. I'm not advanced enough to go through Ubuntu so anything that is doable with studio-code-server or the HA terminal would be awesome

I would be appreciative of something like this as well... I've quit trying as every time I make manual changes trying to get this working, I lose my HA and have to restore.

t0ny-peng commented 1 year ago

Update to all: I have managed to automate the process of getting OTP and it's been working for me for several days. I'll do more verification and share the setup in this repo.


gist created: https://gist.github.com/t0ny-peng/f85b0a0dc3d46246ae17a9d7215e39da

@lunar-studio Do you mind add this gist to the description of this issue to help other people?

willheineman commented 11 months ago

The method posted by @t0ny-peng is working for me too. I don't love the IMAP solution, but understand why it's necessary. It's just too bad we cannot get a developer key for the Toyota API to avoid this workaround.

t0ny-peng commented 11 months ago

@willheineman Well, you can't hope a 20th century company to embrace new technology. With that being said, the AWS solution is more reliable to can even work with all other services where a email verification code is needed.

lunar-studio commented 11 months ago

@t0ny-peng Thank you and please let me know if this is what you wanted me to add. There’s so many admittedly unexpected replies to this issue that I’ve only loosely followed my original post. I might have to give this another shot now.

jgdf42 commented 10 months ago

same 500 error as @jgdf42

edit: just to add some info, when I use the command line with app.py I can get vehicle status, vin and all, but some pages such as "get_engine_status" give a 500 error on the URL. not sure if its because my vehicle doesn't have advanced options (Base model) but it shouldn't error.

@yankees5963 I finally fixed this today..by signing up for the Toyota trial. Why this isn't mentioned in any of the instructions? I don't know. Huge oversight. If you don't activate the trial, the car doesn't communicate any of the data into Toyota's cloud. Turns out you get the trial for free from the day you bought the car (if brand new and you never activate it then you just lose your trial time).

Mhokie commented 10 months ago
      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin PASTE .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

It looks like you found a solution already. I've bolded the portion of the code that should be copied over from .toyota_na_token.json. I will also update my previous post to include this snippet too.

Can confirm that adding the above to the middle of config_entries crashed my HAS but adding it to the end did not. Also needed to add "id_token" for the integration to work

brylee123 commented 10 months ago

Hmm, I am unable to generate a token. I have canceled my Toyota connection for the last 6 months and I just reactivated it last week. I made the changes to my auth.py file but I am unable to generate a token. Am I missing a step?

      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin PASTE .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

It looks like you found a solution already. I've bolded the portion of the code that should be copied over from .toyota_na_token.json. I will also update my previous post to include this snippet too.

Can confirm that adding the above to the middle of config_entries crashed my HAS but adding it to the end did not. Also needed to add "id_token" for the integration to work

gitsbydill commented 10 months ago

Getting this error today. Had everything working fine for months. Integration will not load.

image

gitsbydill commented 10 months ago

I see the DMCA takedown notice now. sad days

Mhokie commented 10 months ago

Getting this error today. Had everything working fine for months. Integration will not load.

image

I think this is caused by @t0ny-peng taking down toyota-na-custom from pypi

image

Mhokie commented 10 months ago

Hmm, I am unable to generate a token. I have canceled my Toyota connection for the last 6 months and I just reactivated it last week. I made the changes to my auth.py file but I am unable to generate a token. Am I missing a step?

      {
        "entry_id": "[ENTITY_ID]",
        "version": 1,
        "domain": "toyota_na",
        "title": "Prius Prime LE",
        "data": {
          "tokens": {                    // Begin PASTE .toyota_na_token.json contents here
            "access_token": "[ACCESS_TOKEN]", 
            "refresh_token": "[REFRESH_TOKEN]",
            "expires_at": [EXPIRES_AT], 
            "updated_at": [UPDATED_AT], 
            "guid": "[GUID]"                                               
          },                             // End paste-block (make sure there is a comma after JSON content)
          "email": "[EMAIL]",
          "username": "[EMAIL]",
          "password": "[PASSWORD]"
        },
        "options": {},
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": "toyota_na:[EMAIL]",
        "disabled_by": null
      },

It looks like you found a solution already. I've bolded the portion of the code that should be copied over from .toyota_na_token.json. I will also update my previous post to include this snippet too.

Can confirm that adding the above to the middle of config_entries crashed my HAS but adding it to the end did not. Also needed to add "id_token" for the integration to work

Share a screenshot of the section of auth.py you modified

memphis2k commented 9 months ago

So this is completely dead? Still working for anyone?

CykloneFij commented 9 months ago

So this is completely dead? Still working for anyone?

Yes, still works fine. Once in a while I have to simply reload the integration; maybe because Toyota web services momentarily went poof. Still using the token generated from over a year ago.

memphis2k commented 9 months ago

Finally got it working. But I don't see an option for Remote Start. I could have sworn I had this before the 2FA / Token setup? Anyone. Thanks for all the posts & help, it was a pain. I checked the issues section and saw someone else said something about the library. Can remote start it from the Toyota App.

2022 Toyota Tundra for reference

Thanks,

omar10wahab commented 9 months ago

Finally got it working. But I don't see an option for Remote Start. I could have sworn I had this before the 2FA / Token setup? Anyone. Thanks for all the posts & help, it was a pain. I checked the issues section and saw someone else said something about the library. Can remote start it from the Toyota App.

2022 Toyota Tundra for reference

Thanks,

Bump please. I thought the same thing but I never used the function. I originally thought I might've mistaken that function for the lock and unlock feature

gitsbydill commented 9 months ago

So this is completely dead? Still working for anyone?

Yes, still works fine. Once in a while I have to simply reload the integration; maybe because Toyota web services momentarily went poof. Still using the token generated from over a year ago.

Could you share your setup? my integration stopped working with the DMCA takedown

dannycohn commented 8 months ago

Anyone have a distro of toyota-na-custom? Where can it be found?

desigi commented 8 months ago

Has something else changed with their API? When I make the changes to auth.py and run it, I get an error mentioning:

"output": [{"name": "value", "value": "3"}, {"name": "id", "value": "USER_BLOCKED_REMAIN_MINUTES"}], "input": [{"name": "IDToken1", "value": "USER_BLOCKED_REMAIN_MINUTES"}]}, {"type": "HiddenValueCallback", "output": [{"name": "value", "value": "5"}, {"name": "id", "value": "USER_BLOCKED_TIME"}], "input": [{"name": "IDToken2", "value": "USER_BLOCKED_TIME"}]

I seem to get blocked for 5 minutes and once the remaining time runs out, it starts back up to 5. Is this happening to anyone else?

Update: Found the problem. Had to use my phone number instead of my email as mentioned in https://github.com/widewing/ha-toyota-na/issues/52#issuecomment-1781869398 . I also had to disable the biometrics on the phone app.

memphis2k commented 8 months ago

Had anyone tried the 2.2 update released on HACS? Especially for the ones that got it working by manually adding the 2 factor auth.

ACiDGRiM commented 8 months ago

Had anyone tried the 2.2 update released on HACS? Especially for the ones that got it working by manually adding the 2 factor auth.

It's working on my already logged in install. Not going to try logging out

widewing commented 8 months ago

Had anyone tried the 2.2 update released on HACS? Especially for the ones that got it working by manually adding the 2 factor auth.

It works for me, so I built the new release.

Nooka6845 commented 8 months ago

Finally got it working. But I don't see an option for Remote Start. I could have sworn I had this before the 2FA / Token setup? Anyone. Thanks for all the posts & help, it was a pain. I checked the issues section and saw someone else said something about the library. Can remote start it from the Toyota App.

2022 Toyota Tundra for reference

Thanks,

Not sure if you found this or not. Took me a little digging to find it. Use the "Service" Toyota (North America): engine_start. Just got mine up and going after feeling defeated for about a week, took another stab at it and got it going today.