Giter VIP home page Giter VIP logo

ha_toyota's People

Contributors

cm000n avatar dependabot[bot] avatar durgnomis-drol avatar molusk avatar pbe-axelor avatar pierrebelloy avatar renewoensdregt avatar rfvermut avatar skgsergio avatar uphillbattle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha_toyota's Issues

HA 2022.6 brakes Toyota

Describe the bug
Setup failed for custom integration toyota: Requirements for toyota not found: ['mytoyota==0.7.7'].

To Reproduce
Upgrade HA to 2022.6

New version with newer binary sensors failed with message AttributeError: 'NoneType' object has no attribute 'passengerseat'

Describe the bug
New version with newer binary sensors failed with message
AttributeError: 'NoneType' object has no attribute 'passengerseat'

To Reproduce
Initiating costom component after upgrade to latest version failed with message
previos version without binary sensors worked ok.

Expected behavior
Finish initialization as previous version.

Screenshots
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/toyota/binary_sensor.py:72
Integration: Toyota Connected Services (documentation, issues)
First occurred: 6:30:55 PM (7 occurrences)
Last logged: 6:40:07 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
state = self.state
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/init.py", line 178, in state
return STATE_ON if self.is_on else STATE_OFF
File "/config/custom_components/toyota/binary_sensor.py", line 72, in is_on
window = getattr(
AttributeError: 'NoneType' object has no attribute 'passengerseat'

Additional context
Add any other context about the problem here.

Currently only one sensor is generated with limited information content

Describe the bug
Hi, I just tested your Python library and your HA integration. I must say I am impressed with what you have done in such a short time! You even have an integration flow for the frontend already included.

With that Integration flow I added my Toyota Corolla earlier. Adding works without any problems, unfortunately only one sensor with limited information content is generated afterwards:
7686annt

If I understand the code correctly, at least the ODO and the current tank level should already be provided, right? In the HA log, I see unfortunately no error messages

::Edit:: I was wrong. In fact there is the following error message in the HA log:
2021-03-15 09:11:05 ERROR (MainThread) [custom_components.toyota.api] An unknown error occurred: 400, message='invalid character in header', url=URL('https://myt-agg.toyota-europe.com/cma/api/vehicle/MYCOROLLAVIN/addtionalInfo') 2021-03-15 09:16:07 ERROR (MainThread) [custom_components.toyota.api] An unknown error occurred: 400, message='invalid character in header', url=URL('https://myt-agg.toyota-europe.com/cma/api/vehicle/MYCOROLLAVIN/addtionalInfo')

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Settings'
  2. Go to 'Integrations'
  3. Click on '+ Add Integration'
  4. Add your MyT User Credentials
  5. Only one sensor with limited information will be created

Expected behavior
Several sensors should be created, e.g. with current ODO and tank content.

Got error at initial restart. I had this previously too, so not likely related to this release, but maybe worth looking at. It resolves when removing the integration and install again (it´ll generate same sensors)

Got error at initial restart. I had this previously too, so not likely related to this release, but maybe worth looking at. It resolves when removing the integration and install again (it´ll generate same sensors)

Logger: homeassistant.config_entries
Source: custom_components/toyota/__init__.py:57
Integration: Toyota Connected Services (documentation, issues)
First occurred: 09:10:46 (1 occurrences)
Last logged: 09:10:46

Error setting up entry [email protected] for toyota
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 61, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 281, in handle_async_request
    ) = await self._pool.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 136, in handle_async_request
    self.socket = await self._open_socket(timeout)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 163, in _open_socket
    return await self._backend.open_tcp_stream(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream
    return await self.backend.open_tcp_stream(
  File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 154, in open_tcp_stream
    stream = await TLSStream.wrap(
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore.ConnectTimeout


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/toyota/__init__.py", line 57, in async_setup_entry
    await client.login()
  File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 75, in login
    await self.api.get_new_token()
  File "/usr/local/lib/python3.9/site-packages/mytoyota/api.py", line 117, in get_new_token
    response = await client.post(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1825, in post
    return await self.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1494, in request
    response = await self.send(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1586, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1616, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1655, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1699, in _send_single_request
    ) = await transport.handle_async_request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 276, in handle_async_request
    (
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 78, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectTimeout

Rest of install has gone fine and new sensors are generated. Will need to open the windows later today to see if all works as planned!

Originally posted by @renewoensdregt in #38 (comment)

Integration not found

Hi, congrats for this great work.
I download the zip file and extract it, then copy the "toyota" folder from ha_toyota-master\ha_toyota-master\custom_components\toyota and paste it to my custom_components folder in HA.

Restart Home Assistant

If I go to configuration - Integrations - Add Integration and search for “Toyota Connected Services” I found "Mazda Connected Services”"

image

Tks a lot

Raffaele

TypeError when updating

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

2021-09-15 10:00:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 109, in state
    if self.latitude is not None and self.longitude is not None:
  File "/config/custom_components/toyota/device_tracker.py", line 33, in latitude
    return self.coordinator.data[self.index].parking.latitude
TypeError: 'NoneType' object is not subscriptable
2021-09-15 10:02:20 ERROR (Recorder) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 109, in state
    if self.latitude is not None and self.longitude is not None:
  File "/config/custom_components/toyota/device_tracker.py", line 33, in latitude
    return self.coordinator.data[self.index].parking.latitude
TypeError: 'NoneType' object is not subscriptable
2021-09-15 10:03:47 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
    state = self.state
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 109, in state
    if self.latitude is not None and self.longitude is not None:
  File "/config/custom_components/toyota/device_tracker.py", line 33, in latitude
    return self.coordinator.data[self.index].parking.latitude
TypeError: 'NoneType' object is not subscriptable

Error while setting up toyota platform for device_tracker

Logger: homeassistant.components.sensor
Source: custom_components/toyota/sensor.py:41
Integration: Senzor (documentation, issues)
First occurred: 24. března 2022 16:23:45 (2 occurrences)
Last logged: 06:52:30

Error while setting up toyota platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/toyota/sensor.py", line 41, in async_setup_entry
for index, _ in enumerate(coordinator.data):
TypeError: 'NoneType' object is not iterable

Toyota Corolla hybrid, not all sensors created.

It is an hybrid, By previous posts it seems to be the same model of car, Corolla Hybrid 1.8L

2021-07-31 14:10:57 DEBUG (MainThread) [custom_components.toyota] [{'alias': 'Corolla HB/TS', 'vin': 'xxxxxxxxxxxxxxxx', 'details': {'brand': 'TOYOTA', 'deviceAddedOn': '2021-06-22T09:20:37.179Z', 'deviceId': 'xxxxxxxxxxxxxxxxx', 'deviceTypeName': 'HARMANMM19RETROTOY', 'engine': '1.8L (HEV special)', 'entitledBy': 'CUSTOMER', 'entitledOn': '2021-07-29T09:11:45.824Z', 'exteriorColour': '1J6 ', 'fuel': 'PETROL', 'generation': 'MM19RETRO', 'grade': 'High', 'horsePower': 98, 'hybrid': True, 'id': 2236013, 'imageUrl': 'https://dj3z27z47basa.cloudfront.net/b64f874c-0519-466f-a9bd-4007c3f8cc62', 'interiorColour': '20', 'isEntitled': True, 'isNC': False, 'licensePlate': '-UK0972xxxx', 'modelCode': 'CR', 'modelDescription': 'Corolla HB/TS', 'modelDocumentId': '12345', 'modelName': 'Corolla HB/TS', 'navSubType': 'Low', 'navType': 'TOY', 'owner': False, 'ownerFlag': False, 'productionYear': '2019', 'source': 'NMSC', 'transmission': 'Continuously Variable Transmission', 'transmissionType': 'CVT', 'vehicleAddedOn': '2021-07-29T09:10:59.751Z'}, 'status': {'battery': None, 'hvac': None, 'odometer': {'mileage': 21752, 'mileage_unit': 'km'}, 'parking': {'event': {'lat': '59.40128472', 'lon': '24.79218611', 'timestamp': '1627722107000'}, 'tripStatus': '0'}}, 'servicesEnabled': {'connectedServices': True}}]

By the log output it seems that that is all i get from Toyota Services. Hoped for Fuel level also.

Originally posted by @Joonaskaru in #10 (comment)

Tracking this here instead.

Toyota integration is no more working

Describe the bug

Logger: homeassistant.components.device_tracker
Source: custom_components/toyota/device_tracker.py:19
Integration: Device tracker (documentation, issues)
First occurred: December 2, 2021, 1:23:40 AM (4 occurrences)
Last logged: December 2, 2021, 1:31:48 AM

Error while setting up toyota platform for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/toyota/device_tracker.py", line 19, in async_setup_entry
    for index, _ in enumerate(coordinator.data):
TypeError: 'NoneType' object is not iterable

HA installed on RPI4 8GB over docker, having buster version of Debian SO.
Suddenly stopped to work a week ago.

Add (better) support for Home Assistant Long-Term Statistics

Screenshot 2023-02-28 193033
Long-term statistics for sensor values have been available in Home Assistant for some time. These long-term statistics are not affected by database purges, take up little space and are very useful for long-term analyses: https://data.home-assistant.io/docs/statistics/

It would be cool if the sensor values of the ha_toyota custom component were also included in these long-term statistics. As you can see in my screenshot from the "Developer Tools -> Statistics" section, only the current weekly, monthly and yearly statistics for my Corolla are currently included in the long-term statistics.
By the way, the "reichweite_corolla" sensor here is a self-made template sensor that determines the current remaining range based on the tank level according to the ha_toyota custom component ;-)

The inclusion of further ha_toyota senor values in these long-term statistics should not be a problem. All that needs to be done is to provide the sensors with a valid device_class, state_class and unit_of_measurement.

An overview of the valid device_class options can be found here: https://developers.home-assistant.io/docs/core/entity/sensor/#available-device-classes
An explanation of the state_class can be found here: https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

I'll see if I can find the time to get back into ha_toyota to create a pull request. In any case, I wanted to record it here in case I don't get around to it. Are there any other opinions or ideas?

Language code invalid upon installing, but field is not available for editing...

Describe the bug
Hi there. I got an error and re-installed the add-on through HACS in home assistant. When putting user and password, the

Version installed is v1.2.3 on HACS 1.17.0

To Reproduce
Steps to reproduce the behavior:

  1. Go to configuration - Integrations
  2. Click on add integration and then find Toyota connected services
  3. enter user an password and click submit.
  4. I then get the error language code is not valid

image

Expected behavior
Either language code is automatically - and correctly selected or should be entered manually... .

Additional context
Add any other context about the problem here.

Integration stop working after host machine restart

Describe the bug
I use HA on RPi and when I restart RPi then the integration isn't working anymore. I have to delete integration and add it again. Then the integration work until next restart.

To Reproduce

  1. Restart RPi via 'sudo reboot'
  2. Check integration status in HA configuration

Expected behavior
I would expect that the integration will work also after restart.

Log findinfs
2021-09-20 15:45:30 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for toyota Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 61, in map_httpcore_exceptions yield File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 281, in handle_async_request ) = await self._pool.handle_async_request( File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 234, in handle_async_request response = await connection.handle_async_request( File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 136, in handle_async_request self.socket = await self._open_socket(timeout) File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 163, in _open_socket return await self._backend.open_tcp_stream( File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/auto.py", line 44, in open_tcp_stream return await self.backend.open_tcp_stream( File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 154, in open_tcp_stream stream = await TLSStream.wrap( File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions raise to_exc(exc) from None httpcore.ConnectTimeout The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/toyota/__init__.py", line 69, in async_setup_entry await client.login() File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 81, in login await self.api.controller.first_login() File "/usr/local/lib/python3.9/site-packages/mytoyota/controller.py", line 70, in first_login await self._update_token() File "/usr/local/lib/python3.9/site-packages/mytoyota/controller.py", line 83, in _update_token response = await client.post( File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1825, in post return await self.request( File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1494, in request response = await self.send( File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1586, in send response = await self._send_handling_auth( File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1616, in _send_handling_auth response = await self._send_handling_redirects( File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1655, in _send_handling_redirects response = await self._send_single_request(request, timeout) File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1699, in _send_single_request ) = await transport.handle_async_request( File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 276, in handle_async_request ( File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 78, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout

RAV4 PHEV missing petrol range and EV battery information

Firstly, I would like to Thank You for making this integration! How can I buy you a coffee?

I just got RAV4 PHEV and I spotted two issues with entities showing wrong or no information.

  1. EV battery entity (sensor.rav4_phev_ev_battery) is showing none instead of the charge percentage.
  2. Range (sensor.rav4_phev_range) is showing EV battery range, I guess we need another sensor showing petrol range.

Here are the screenshoots:
CleanShot 2022-01-10 at 18 41 03
IMG_4876
IMG_4877

Data availability is unstable

Describe the bug
I'm pretty sure the issue is not from this side, but I don't know where to look for help
In nearly half the day, the service is reported unavailable and asking for configuration verification.
Before using the integration, I never noticed unavailable data in MyT application, but I guess I paid not the same attention as my HA dashboard. Now, service is often unavailable, even in the app/the website, even if they say my vehicule is connected.

Here is what I find in the logs:

2022-06-21 21:19:53 ERROR (MainThread) [custom_components.toyota] Unexpected error fetching toyota data: can only concatenate str (not "dict") to str
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
return await self.update_method()
File "/config/custom_components/toyota/init.py", line 105, in async_update_data
data = await asyncio.gather(
File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 419, in get_driving_statistics
raw_statistics = await self.api.get_driving_statistics_endpoint(
File "/usr/local/lib/python3.9/site-packages/mytoyota/api.py", line 96, in get_driving_statistics_endpoint
return await self.controller.request(
File "/usr/local/lib/python3.9/site-packages/mytoyota/controller.py", line 219, in request
"Internal server error occurred! - " + response
TypeError: can only concatenate str (not "dict") to str
2022-06-21 21:19:53 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 6.332 seconds (success: False)

And these:

2022-06-21 21:26:09 ERROR (MainThread) [custom_components.toyota] Error fetching toyota data: Update canceled! Toyota's API was too slow to respond. Will try again later...
2022-06-21 21:26:09 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 16.145 seconds (success: False)

To Reproduce
I followed the instructions on the readme.
My setup is a Docker image on a Ubuntu server 22.04 VM on a Qnap server.

Expected behavior
Well, more data, I guess?

Screenshots
image
image

Additional context
Europe, France.
I check data in the MyT app and https://www.toyota.fr/apps/customerportal#/

Entities not available

Intro
After installing this integration it worked perfectly. Until one day it did not. I cannot say what exactly i have done: I updated various parts of HA and i installed other add-ons and integrations.
To solve i re-installed the extension... without any visible improvement.

Bug
Instead of the name and the value of the sensors i get: Entity not available: binary_sensor.rav4_xxxxx
After writing this i tried to create a new card. And could not find any RAV4 sensor anymore!!

To Reproduce
Create a card with multiple entities, select any from the pulldown list.

Captura 2021-11-14 a las 9 17 55
Captura 2021-11-14 a las 9 18 07
Captura 2021-11-14 a las 9 27 06
Captura 2021-11-14 a las 9 28 18
Captura 2021-11-14 a las 9 27 38

Entities Unavailable after a few hours

Hi,

I configured my account, and everything works fine when the Integration starts (or is reloaded). But, after a while, all the metrics are gone (unavailable). It works again only if I Reload the integration.

I see in the Logs that I get this error message:

_**Logger: mytoyota
Source: /usr/local/lib/python3.9/site-packages/mytoyota/vehicle.py:161
First occurred: 06:21:39 (1 occurrences)
Last logged: 06:21:39

Your vehicle does not support Connected services (). You can find out if your vehicle is compatible by checking the manual that comes with your car.**_

It's strange because it always works when it's started, and fails after a while...

Btw, it's a super Intgeration! thanks a lot

Only create a battery health sensor if there is information available for it

Describe the bug
With the latest version of HA Toyota it generates a battery health sensor although, as far as I know, in the case of my vehicle Toyota does not provide any information for it.

To Reproduce
You must own a Toyota Corolla and set up the latest version (2.0) of HA Toyota ;-)

Expected behavior
Only create sensors for which information is also provided by the vehicle. If the vehicle does not provide the information, do not create a sensor for it.

Screenshots
094732094732nt

Feedback: Unreliable synchronization of longer track recordings

Hi, this is not so much a bug but an observation I made during our Italy vacation. During the vacation, I noticed that some routes and information such as current fuel level are simply no longer synchronized with Toyota Connected Services.
After some searching, I found out that I am not alone in this. There is a discussion about this in a German Corolla forum, where users describe that on longer routes (about 300km) the synchronization becomes unreliable.

Here ist the Link to the corresponding forum Thread:
https://www.toyota-corolla-forum.de/forum/thread/338-myt-app-synchronisation/?pageNo=1

In this discussion the assumption was made that the vehicle data is probably cached in the on-board computer while driving and only transferred after the vehicle has come to a standstill. If the vehicle data has not been transferred by the next trip, it will probably be discarded.
Interestingly, after a user contacted Toyota Germany, it emerged that 3G SIM cards from Vodafone are installed in our vehicles. Since the 3G network has already been abolished in many countries, the vehicles have to fall back on the 2G network in these cases. This makes it clear that larger data volumes can only be transmitted very poorly or not at all.

Since this synchronization behavior could possibly also result in bug reports for this custom component, I thought I would write it here as information. So please check if the data is available in your MyT app before you open a bug here. If not, you have to open one at Toyota itself ;-)

TypeError: 'NoneType' object is not subscriptable

Describe the bug
error TypeError: 'NoneType' object is not subscriptable

To Reproduce
Steps to reproduce the behavior:

first setup, just setup my toyota 30mn ago and tried to setup the integration

restart the HA server, HA multiple times, but no luck

no identities are created

with the debug logging this is what i'm getting:

2022-03-22 21:57:07 INFO (MainThread) [custom_components.toyota]

Toyota Connected Services
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/DurgNomis-drol/ha_toyota/issues

2022-03-22 21:57:07 DEBUG (MainThread) [mytoyota] Performing first login
2022-03-22 21:57:07 DEBUG (MainThread) [mytoyota] Getting new token...
2022-03-22 21:57:09 INFO (MainThread) [pyipma.location] Using Lisboa (G.Coutinho) as weather station for Lisboa
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Extracting token from result
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Token is the correct format
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Saving token and uuid
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Getting list of vehicles associated with the account
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '7*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=7*****************************************************************************************************************', 'uuid': 'c***********************************'}
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Creating client...
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-03-22 21:57:09 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Getting status for vehicle - ...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '7
*********************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=7*****************************************************************************************************************', 'uuid': 'c***********************************'}
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Creating client...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '7*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=7*****************************************************************************************************************', 'uuid': 'c***********************************'}
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Creating client...
2022-03-22 21:57:10 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '7*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=7*****************************************************************************************************************', 'uuid': 'c***********************************'}
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Creating client...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '7*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=7*****************************************************************************************************************', 'uuid': 'c***********************************'}
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Creating client...
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-03-22 21:57:11 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-03-22 21:57:11 DEBUG (MainThread) [custom_components.toyota] HTTP: 400 - {"timestamp":1647986231648,"status":400,"error":"Bad Request","message":"X-TME-APP-VERSION not provided","errorCode":"CMA400"}
2022-03-22 21:57:11 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 2.021 seconds (success: True)

Problem with concatenate str

Describe the bug
While checking the logs I found this error:

This error originated from a custom integration.

Logger: custom_components.toyota
Source: custom_components/toyota/__init__.py:105
Integration: Toyota Connected Services (documentation, issues)
First occurred: 12:36:01 PM (1 occurrences)
Last logged: 12:36:01 PM

Unexpected error fetching toyota data: can only concatenate str (not "dict") to str
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/toyota/__init__.py", line 105, in async_update_data
    data = await asyncio.gather(
  File "/usr/local/lib/python3.10/site-packages/mytoyota/client.py", line 419, in get_driving_statistics
    raw_statistics = await self.api.get_driving_statistics_endpoint(
  File "/usr/local/lib/python3.10/site-packages/mytoyota/api.py", line 96, in get_driving_statistics_endpoint
    return await self.controller.request(
  File "/usr/local/lib/python3.10/site-packages/mytoyota/controller.py", line 219, in request
    "Internal server error occurred! - " + response
TypeError: can only concatenate str (not "dict") to str

I'm not sure when this happend and how to reproduce it.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

The integration dont load the sensors

Logger: homeassistant.components.sensor
Source: custom_components/toyota/sensor.py:41
Integration: Sensor (documentation, issues)
First occurred: 9:21:02 PM (2 occurrences)
Last logged: 9:30:03 PM

Error while setting up toyota platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/toyota/sensor.py", line 41, in async_setup_entry
for index, _ in enumerate(coordinator.data):
TypeError: 'NoneType' object is not iterable

Feature Request: Add driving statistics

As a continuation to this discussion: #10 (comment), here is a feature request to implement driving statistics for the current year, week, day.

Currently, the following statistics are already supported in Calmjm Python Script (https://github.com/calmjm/tojota/blob/master/statistics.py), for which it would also be great to have them available in Home Assistant as (optional) sensors:

  • Average fuel consumption
  • EV Distiance in km/mi
  • EV Distance in %
  • Total Distance
  • Average Speed
  • Maximum Speed
  • Total Trips
  • Amount of Night Trips

Perhaps other metrics and time units are also possible, but they need to be found out first.
Feel free to split the ticket into individual requests per sensor if helpful.

Best regards and thank you very much

Can't update credentials in integration

Describe the bug
If you change your Toyota credentials, the integration errors with

Failed to set up: Login failed, check your credentials! 401 - {"httpErrorCode":401,"message":"Couldn't authenticate with given username/password"}

.. but doesn't provide a way to supply the updated ones.

To Reproduce

  1. Update MyT password
  2. Refresh integration
  3. Error will be display

Expected behavior
Probably fine to display an error, but the UI should allow you to update the stored credentials

ValueError: entity_category must be a valid EntityCategory instance

Describe the bug
I can see only a subset of data, which was available before:

Sensors:

  • Current month statistics
  • Current week statistics
  • Current year statistics
  • Fuel Tank
  • Odometer
  • Over all status

Diagnostics:

  • Parking location

All others are not available and the log shows the following errors:

To Reproduce
Steps to reproduce the behavior:

Just stopped working after the update.

Expected behavior
Integration works.

Additional context
Here's the error I see in the log:
Logger: homeassistant.components.sensor
Source: helpers/entity_registry.py:383
Integration: Sensor (documentation, issues)
First occurred: 3:45:29 PM (4 occurrences)
Last logged: 3:45:51 PM

Error adding entities for domain sensor with platform toyota
Error while setting up toyota platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
entry = entity_registry.async_get_or_create(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_registry.py:383
Integration: Binary sensor (documentation, issues)
First occurred: 3:45:29 PM (4 occurrences)
Last logged: 3:45:51 PM

Error adding entities for domain binary_sensor with platform toyota
Error while setting up toyota platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 510, in _async_add_entity
entry = entity_registry.async_get_or_create(
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 383, in async_get_or_create
raise ValueError("entity_category must be a valid EntityCategory instance")
ValueError: entity_category must be a valid EntityCategory instance

HA 2023.3 deprecation warning: async_setup_platforms instead of async_forward_entry_setups

Describe the bug

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for toyota using this method at custom_components/toyota/init.py, line 165: hass.config_entries.async_setup_platforms(entry, PLATFORMS)

To Reproduce
Steps to reproduce the behavior:

  1. Install HA 2023.2.1
  2. Setup this custom integration
  3. Check the HA Logs

Impossible to fetch data when multiple cars

Describe the bug
Since lates update, it is impossible to fetch any data as the component is constantly failing.
I'm assuming, this is due to my account having two cars, one without the connectivity.

To Reproduce
Steps to reproduce the behavior:

  1. Have two cars linked to your account
  2. One without connectivity (Aygo '2019)
  3. On with connectivity (Corolla '2020)
  4. See errors
2021-10-20 18:38:00 ERROR (MainThread) [mytoyota] Your vehicle does not support Connected services (None). You can find out if your vehicle is compatible by checking the manual that comes with your car.
2021-10-20 18:38:00 ERROR (MainThread) [custom_components.toyota] Unexpected error fetching toyota data: 'NoneType' object has no attribute 'unit'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/toyota/__init__.py", line 90, in async_update_data
    if vehicle.odometer.unit == LENGTH_MILES:
AttributeError: 'NoneType' object has no attribute 'unit'

Expected behavior
I'd love to see the component running again, ignoring the errors about car being unsupported and refresh the entities that are supported. I really do not want to unlink the aygo from my account as it helps me keeping servicing on schedule.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

not starting after update to core-2021.11.3

Today after updating the core of home assistant to core-2021.11.3 the toyota integration does not start anymore.
This occurs even after restarting the server, rebooting the host or reinstalling the integration.

Following errors are logged:

Logger: homeassistant.config_entries
Source: custom_components/toyota/init.py:62
Integration: Toyota Connected Services (documentation, issues)
First occurred: 14:33:03 (1 occurrences)
Last logged: 14:33:03

Error setting up entry [email protected] for toyota
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/toyota/init.py", line 62, in async_setup_entry
client = MyT(
File "/usr/local/lib/python3.9/site-packages/mytoyota/client.py", line 55, in init
raise ToyotaLocaleNotValid(
mytoyota.exceptions.ToyotaLocaleNotValid: Please provide a valid locale string! Valid format is: en-gb.

Kind regards
Kapa

Fuel tank and Numberplate entity broken

Describe the bug
The update to 1.0.1 breaks the Fuel tank and Numberplate entity

To Reproduce
Update from 1.0.0 to 1.0.1

Logfile
Logger: homeassistant.components.sensor
Source: custom_components/toyota/sensor.py:135
Integration: Sensor (documentation, issues)
First occurred: 23:05:37 (3 occurrences)
Last logged: 23:05:40

Error adding entities for domain sensor with platform toyota
Error while setting up toyota platform for sensor
toyota: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 587, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 698, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 498, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in _stringify_state
state = self.state
File "/config/custom_components/toyota/sensor.py", line 135, in state
return self.coordinator.data[self.index][STATUS].odometer.fuel
TypeError: 'Vehicle' object is not subscriptable

Auto-detect languagecode

Describe the solution you'd like
Instead of manually inputting language code, we need a way to auto detect it. If possible.

Can't add integration

Describe the bug
When I try to setup the account, I get "Language code is not valid."

To Reproduce
Steps to reproduce the behavior:

I've installed the "Toyota Connected Services" via HACS
Then I try to add and integration normally (via Settings -> Integration -> Add Integration, the lookup for toyota)

I'll put email account (working on MYT), password and select "Europe"

Then click on "submit"

Expected behavior
connection to MYT :D

Additional context

System Health

version core-2021.8.5
installation_type Home Assistant Core
dev false
hassio false
docker false
user homeassist
virtualenv true
python_version 3.8.11
os_name Linux
os_version 4.19.0-17-amd64
arch x86_64
timezone Europe/Brussels
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4978
Installed Version 1.15.2
Stage running
Available Repositories 887
Installed Repositories 2
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 5
resources 2
views 9
mode storage

Language Code is not valid

Describe the bug
Language Code not working anymore

To Reproduce
Steps to reproduce the behavior:

Re-Add the integration, sign up
I have to enter de-de. But it says
"Language code is not valid."
Even the "da-dk" language-code is not working

Expected behavior
works since last month

Screenshots
https://imgur.com/a/ZbnMNVj

Additional context

Receiving HTTP 429 errors

Describe the bug
Unable to update any of the sensors, all sensors showing up as unavailable.
Started receiveing HTTP 429 errors since 12 hours ago.

To Reproduce
-

Expected behavior
The sensors updates at interval.

Screenshots
image

image

Additional context
Log ouput:

This error originated from a custom integration.

Logger: custom_components.toyota
Source: helpers/update_coordinator.py:223
Integration: Toyota Connected Services (documentation, issues)
First occurred: 9:13:20 PM (5 occurrences)
Last logged: 9:15:07 PM

Error fetching toyota data: HTTP: 429 - Too Many Requests. Please try again later.

Add Energy sensors

Discussed in #66

Originally posted by tchicken September 19, 2021
I know this isn't the most common of cars, but I've just taken delivery of a new Toyota Mirai hydrogen fuel cell car and have connected it into Home Assistant using this integration.

There are a few additional sensors that I would love to see working, namely range remaining and level %, and also the HVAC information.

Using the code in the RAV4 thread I've gathered the following:

DEBUG:mytoyota:Raw status data: {'VehicleInfo': {'AcquisitionDatetime': '2021-09-19T14:03:47Z', 'RemoteHvacInfo': {'InsideTemperature': 26, 'RemoteHvacMode': 0, 'RemoteHvacProhibitionSignal': 1, 'Temperaturelevel': 33, 'SettingTemperature': 20.0, 'BlowerStatus': 0, 'FrontDefoggerStatus': 0, 'RearDefoggerStatus': 0, 'FrontSeatHeaterStatus': 1, 'RearSeatHeaterStatus': 0, 'SteeringHeaterStatus': 0, 'FunctionInfoFixedStatus': 1, 'LatestAcStartTime': '2021-09-17T20:04:17Z', 'TemperatureDisplayFlag': 1}, 'ChargeInfo': {'GasolineTravelableDistanceUnit': 2, 'GasolineTravelableDistance': 183, 'EvDistanceInKm': 0.0, 'EvTravelableDistance': 0.0}}, 'ReturnCode': '000000'}
DEBUG:httpx._client:HTTP Request: GET https://myt-agg.toyota-europe.com/cma/api/users/ecd0a9cf-21fa-47c9-ab0f-5bf0f1eb69b1/vehicles/XXXXXXXXXXXXXX/vehicleStatus "HTTP/1.1 200 OK"
{'event': {'lat': 'XXXXXXXXX', 'lon': 'XXXXXXXXX', 'timestamp': '1632060096000'}, 'tripStatus': '0', 'energy': [{'timestamp': '2021-09-19T14:02:37Z', 'type': 'HYDROGEN', 'level': 58.8, 'remainingRange': 295}], 'protectionState': {'overallStatus': 'OK', 'timestamp': '2021-09-19T14:06:55Z', 'doors': {'warning': False, 'driverSeatDoor': {'warning': False, 'closed': True, 'locked': True}, 'passengerSeatDoor': {'warning': False, 'closed': True, 'locked': True}, 'rearRightSeatDoor': {'warning': False, 'closed': True, 'locked': True}, 'rearLeftSeatDoor': {'warning': False, 'closed': True, 'locked': True}}, 'hood': {'closed': True, 'warning': False}, 'lamps': {'warning': False, 'headLamp': {'warning': False, 'off': True}, 'tailLamp': {'warning': False, 'off': True}, 'hazardLamp': {'warning': False, 'off': True}}, 'windows': {'warning': False, 'driverSeatWindow': {'warning': False, 'state': 'close'}, 'passengerSeatWindow': {'warning': False, 'state': 'close'}, 'rearRightSeatWindow': {'warning': False, 'state': 'close'}, 'rearLeftSeatWindow': {'warning': False, 'state': 'close'}}, 'key': {'warning': False, 'inCar': False}, 'lock': {'lockState': 'locked', 'source': 'key', 'failedUnlockPreconditions': ['alarmLocked']}}}

The part I'm most interested in is this:
'energy': [{'timestamp': '2021-09-19T14:02:37Z', 'type': 'HYDROGEN', 'level': 58.8, 'remainingRange': 295}]

level is % and range is km.

I may be able to contribute in the future, but I don't have the time at the moment. If you're able to add the information that would be great. I'm assuming that some of the information will also be used in future Toyota cars so will probably be of use for others.

Thanks,

mytoyota issue DurgNomis-drol/mytoyota#59

Unreliable sensor collection, missing sensors

Describe the bug
Sensors are not always updated and there is a limited set of sensors
ha_toyota v1.2.7
Home Assistant 2022.2.3
Car : Yaris 2021, hybrid

Error Message :
Retrying setup: None
Capture d’écran 2022-02-08 à 09 56 57

Don't know why, but it's now working...

Capture d’écran 2022-02-08 à 09 59 28

Logs in debug
2022-02-08 09:29:48 DEBUG (MainThread) [mytoyota] Performing first login
2022-02-08 09:29:48 DEBUG (MainThread) [mytoyota] Getting new token...
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Extracting token from result
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Token is the correct format
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Saving token and uuid
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Getting list of vehicles associated with the account
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:53 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Getting status for vehicle - VNKKBAC35********...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:57 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Presenting information as an object...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Using legacy odometer data: [{'type': 'mileage', 'value': 1204, 'unit': 'km'}, {'type': 'Fuel', 'value': 27.0}]
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Raw sensor data: {}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Getting statistics for VNKKBAC35********...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Interval: isoweek - from_date: None - unit: metric
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Additional headers: {'vin': 'VNKKBAC35********', 'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Body: None - Parameters: {'from': '2022-02-07', 'calendarInterval': 'day'}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Getting statistics for VNKKBAC35********...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Interval: month - from_date: None - unit: metric
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Additional headers: {'vin': 'VNKKBAC35********', 'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Body: None - Parameters: {'from': '2022-02-01', 'calendarInterval': 'month'}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Getting statistics for VNKKBAC35********...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Interval: year - from_date: None - unit: metric
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Additional headers: {'vin': 'VNKKBAC35********', 'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': '6*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=6*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:29:58 DEBUG (MainThread) [mytoyota] Body: None - Parameters: {'from': '2022-01-01', 'calendarInterval': 'month'}
2022-02-08 09:29:59 DEBUG (MainThread) [mytoyota] Parse statistics into the statistics object for formatting...
2022-02-08 09:29:59 DEBUG (MainThread) [mytoyota] Updating bucket for statistics....
2022-02-08 09:30:00 DEBUG (MainThread) [mytoyota] Parse statistics into the statistics object for formatting...
2022-02-08 09:30:00 DEBUG (MainThread) [mytoyota] Updating bucket for statistics....
2022-02-08 09:30:15 DEBUG (MainThread) [mytoyota] Performing first login
2022-02-08 09:30:15 DEBUG (MainThread) [mytoyota] Getting new token...
2022-02-08 09:30:33 DEBUG (MainThread) [mytoyota] Performing first login
2022-02-08 09:30:33 DEBUG (MainThread) [mytoyota] Getting new token...
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Extracting token from result
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Token is the correct format
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Saving token and uuid
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Getting list of vehicles associated with the account
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:34 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Getting status for vehicle - VNKKBAC35********...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Additional headers: {'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:35 DEBUG (MainThread) [mytoyota] Body: None - Parameters: None
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Presenting information as an object...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Using legacy odometer data: [{'type': 'mileage', 'value': 1204, 'unit': 'km'}, {'type': 'Fuel', 'value': 27.0}]
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Raw sensor data: {}
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Getting statistics for VNKKBAC35********...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Interval: isoweek - from_date: None - unit: metric
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Additional headers: {'vin': 'VNKKBAC35********', 'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Body: None - Parameters: {'from': '2022-02-07', 'calendarInterval': 'day'}
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Getting statistics for VNKKBAC35********...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Interval: month - from_date: None - unit: metric
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Checking if token has expired...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Constructing additional headers...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Additional headers: {'vin': 'VNKKBAC35********', 'X-TME-LC': 'en-gb', 'X-TME-LOCALE': 'en-gb', 'X-TME-TOKEN': 'q*****************************************************************************************************************', 'Cookie': 'iPlanetDirectoryPro=q*****************************************************************************************************************', 'uuid': '8***********************************'}
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Creating client...
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Base headers: {'Content-Type': 'application/json;charset=UTF-8', 'Accept': 'application/json, text/plain, /', 'Sec-Fetch-Dest': 'empty', 'X-TME-BRAND': 'TOYOTA'} - Timeout: 15
2022-02-08 09:30:40 DEBUG (MainThread) [mytoyota] Body: None - Parameters: {'from': '2022-02-01', 'calendarInterval': 'month'}
2

mixed units of measurement

Describe the bug
the attributes of the sensors have mixed up units: miles and km - I have RAV4 registered in UK (so Europe)
setup of my toyota is in miles
but the sensors from this integration are mixed up - sometimes km sometimes miles

To Reproduce
check the sensor: sensor.rav4_YOUR-PLATE_current_year_statistics

1: the sensor output is: amount of km in current year but the unit of measurements is "mi" - so wrong

2: some attributes are in miles some in km
example:
Average_fuel_consumed: 5.40 - that is in liters/100km
but another one is in miles:
Max_speed: 135 - that is in miles/h
unit_of_measurement: mi - miles
Average_speed: 26.4 - miles

Expected behaviour
the sensors should be consistent and either all in miles or all in km
I checked with MyToyota web page - all there is correct - in miles
Screenshot 2021-09-13 at 22 27 07
Screenshot 2021-09-13 at 22 31 58

fuel tank status - too many digits

Hi there,

After last upgrade of the integration the fuel tank status is not rounded to 2 places - do you think this could be changed in the integration or I should use some templates in HA?
Please have a look and advice

Screenshot 2021-12-02 at 21 54 20

Thank you

Email/Password is incorrect.

Describe the bug
I always get the message "Email/Password is incorrect." but E-Mail and Password are correct.

To Reproduce
Steps to reproduce the behavior:

  1. I start the integration
  2. fill in all my data
  3. klick on login
  4. Email/Password is incorrect.

Expected behavior
I always get the message "Email/Password is incorrect." but E-Mail and Password are correct.
Unbenannt

Add typing

Describe the solution you'd like
Use typing in code everywhere.

Right now it is not implement every where

Lack of set up window after install

Describe the bug
I've just installed this integration in HA 2022.7.0 with HACS 1.25.5.
Installation went fine but according to documentation I should get instruction on screen to complete the set-up.
Nothing showed up and I don't see any other way to provide details needed for this integration.
What am I missing?

To Reproduce
Steps to reproduce the behavior:
Simply follow install steps. Everything goes as expected. You'll end up with Toyota Connected Services in integrations tab of HACS but there's no way to configure it.

Expected behavior
Some extra set up window to provide credentials?

No idea what else can I provide here. Logs aren't helpful:
2022-07-07 17:36:24 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-07-07 17:36:24 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration toyota which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

vehicle without vin

client.get_vehicles() can return vehicles that don't have any vin

This is associated to a multimedia system Touch & Go. Here is an example of the data :

{
    'vin': '',
    'brand': 'TOYOTA',
    'deviceId': '[REDACTED]',
    'generation': '[REDACTED]'',
    'deviceTypeName': '[REDACTED]'',
    'navType': 'TOY',
    'navSubType': 'Low',
    'source': 'NMSC'
  }

This cause 404 Not Found issues when trying to fetch the vehicle status from client.get_vehicle_status(car) and integration fail to setup.

ERROR (MainThread) [custom_components.toyota] Error fetching toyota data: HTTP: 400 - {"timestamp":1677989012440,"status":400,"error":"Bad Request","message":"INVALID VIN FORMAT","errorCode":"CMA400"}
ERROR (MainThread) [custom_components.toyota] Error fetching toyota data: HTTP: 404 - <!DOCTYPE html>
 <html lang="en">
 <head>
 <meta charset="utf-8">
 <title>Error</title>
 </head>
 <body>
 <pre>Cannot GET /vehicle/user/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/vehicle/</pre>
 </body>
 </html>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.