Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new mytoyota api endpoints #198

Merged
merged 71 commits into from
Jan 14, 2024
Merged

Conversation

CM000n
Copy link
Collaborator

@CM000n CM000n commented Jan 1, 2024

This MR uses a mytoyota version >= 1.0 and therefore also the new ctpa-oneapi API version from Toyota for the Home Assistant toyota Custom Component.
Some of the previous functionalities of the custom component have been removed as they are not (yet) supported by the revised mytoyota lib version.

@CM000n CM000n requested review from DurgNomis-drol and removed request for DurgNomis-drol January 3, 2024 15:07
DurgNomis-drol
DurgNomis-drol previously approved these changes Jan 3, 2024
Copy link
Owner

@DurgNomis-drol DurgNomis-drol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

@MaximeNagel
Copy link

Awesome work man. So much effort during the last few weeks!

Maybe you have a community shared coffee machine or beer tap as a German ;) ?
I would be happy to contribute. :)

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

Awesome work man. So much effort during the last few weeks!

Maybe you have a community shared coffee machine or beer tap as a German ;) ? I would be happy to contribute. :)

Thank you, that's nice of you 😗 But if you have money to spare, spend it on someone who can really use it:

@MaximeNagel
Copy link

Awesome work man. So much effort during the last few weeks!
Maybe you have a community shared coffee machine or beer tap as a German ;) ? I would be happy to contribute. :)

Thank you, that's nice of you 😗 But if you have money to spare, spend it on someone who can really use it:

image

You seem to be a really nice person, and I have done my duty with pleasure if that's what makes you happy :)

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

image

You seem to be a really nice person, and I have done my duty with pleasure if that's what makes you happy :)

❤️ ❤️ ❤️

@DurgNomis-drol
Copy link
Owner

DurgNomis-drol commented Jan 11, 2024

image

Just tested your amazing work.

My car is not an electric or a hybrid, but I still get these sensors?

Also it says T instead of Toyota

We can still merge it, only posted for info

Also why can't i get statistical information anymore, it was available before?

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

image

Just tested your amazing work.

My car is not an electric or a hybrid, but I still get these sensors?

Also it says T instead of Toyota

The T is the oficial brand description from the API.
Maybe we can add a additional mapping on our side to full names.

Regarding the sensors it seems we have to investigate further to find the correct conditions.
Can you pls paste the content from the attributes of the vin sensor here?

@DurgNomis-drol
Copy link
Owner

Contract_id: "**********52458"
IMEI: "*************34103"
Katashiki_code: KGB40L-AHMGKW
ASI_code: FC
Brand: T
Car_line_name: Aygo
Car_model_year: "2018"
Car_model_name: Aygo - MC '18
Color: Dark Grey Mica
Generation: 17CYPLUS
Manufactured_date: "2021-03-01"
Date_of_first_use: null
Transmission_type: M
Fuel_type: G
Electrical_platform_code: null
EV_vehicle: false
Features:
  crash_notification: true
  dealer_appointment: true
  drive_pulse: true
  emergency_assist: true
  last_parked: true
  privacy: true
  service_history: true
Extended_capabilities:
  battery_status: true
  bump_collisions: true
  drive_pulse: true
  emergency_assist: true
Remote_service_capabilities: {}

Remote service should be enabled in the app, maybe there lays the problem?

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

Remote service should be enabled in the app, maybe there lays the problem?

No, the problem is rather that I thought batery_status stood for the battery information of EV cars. But that probably refers more to the starter battery

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

Should be fixed/adjusted now @DurgNomis-drol 😊

@DurgNomis-drol
Copy link
Owner

DurgNomis-drol commented Jan 11, 2024

Can confirm it fixes it

It's probably a replacement for the old starter battery sensor.

Any clues why odometer and statistics does not work for me?

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

Can confirm it fixes it

It's probably a replacement for the old starter battery sensor.

Any clues why odometer and statistics does not work for me?

The condition for statistics is currently that the vehicle is telemetry-capable.
I have not yet found a better indication in the capabilities or features of a vehicle that point to the generation of trip statistics.
I saw in your screenshot that the odometer was created for you but displayed "unknown". I then also applied the telemetry condition for the odometer.

However, this might be something that we should investigate with the actual mytoyota lib to see if and where the odometer information for your vehicle comes from and if the statistic information is available there.

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

The statistics sensors should now be available @DurgNomis-drol.
In the mytoyota lib we also do not yet have a condition for retrieving the trip and statistics data.

@DurgNomis-drol
Copy link
Owner

('Dashboard: odometer=None fuel_level=None battery_level=None fuel_range=None '
 'battery_range=None battery_range_with_ac=None range=None '
 'charging_status=None remaining_charge_time=None warning_lights=[]')
('Location: latitude=00.00000 longitude=0.00000 timestamp=2024-01-11 '
 '15:42:03+00:00 state=Last Parked')
'Lock Status: last_updated=None doors=None windows=None hood=None'
'Notifications: []'
("Summary: [[average_speed=52.53 countries=['DK'] duration=5:25:28 "
 'distance=284.928 ev_duration=None ev_distance=None from_date=2023-07-15 '
 'to_date=2023-07-31 fuel_consumed=0.0 average_fuel_consumed=0.0], '
 "[average_speed=49.05 countries=['DK'] duration=12:50:35 distance=629.954 "
 'ev_duration=None ev_distance=None from_date=2023-08-01 to_date=2023-08-31 '
 'fuel_consumed=0.0 average_fuel_consumed=0.0], [average_speed=57.26 '
 "countries=['DK'] duration=20:38:22 distance=1181.861 ev_duration=None "
 'ev_distance=None from_date=2023-09-01 to_date=2023-09-30 fuel_consumed=0.0 '
 "average_fuel_consumed=0.0], [average_speed=63.33 countries=['DK'] duration=1 "
 'day, 3:17:51 distance=1728.835 ev_duration=None ev_distance=None '
 'from_date=2023-10-01 to_date=2023-10-31 fuel_consumed=0.0 '
 "average_fuel_consumed=0.0], [average_speed=49.73 countries=['DK'] "
 'duration=20:07:04 distance=1000.43 ev_duration=None ev_distance=None '
 'from_date=2023-11-01 to_date=2023-11-30 fuel_consumed=0.0 '
 "average_fuel_consumed=0.0], [average_speed=53.63 countries=['DK'] duration=1 "
 'day, 3:19:18 distance=1465.188 ev_duration=None ev_distance=None '
 'from_date=2023-12-01 to_date=2023-12-31 fuel_consumed=0.0 '
 "average_fuel_consumed=0.0], [average_speed=36.97 countries=['DK'] "
 'duration=12:12:12 distance=451.131 ev_duration=None ev_distance=None '
 'from_date=2024-01-01 to_date=2024-01-11 fuel_consumed=0.0 '
 'average_fuel_consumed=0.0]]')

output from mytoyota

@CM000n
Copy link
Collaborator Author

CM000n commented Jan 11, 2024

output from mytoyota

So there are also no values for odometer etc. because your vehicle does not support telemetry (https://github.com/DurgNomis-drol/mytoyota/blob/master/mytoyota/models/vehicle.py#L64).
Perhaps the information still arrives via one of the other end points?

Have you looked at what comes back from the endpoint if you bypass the conditions in the vehicle model or address the endpoint directly?

By the way, I think this is getting a bit off topic here. 😉 Shouldn't we move the search for your Odometer values to an issue in the mytoyota repo?

@lkucytowski
Copy link

Just loaded the latest commit and all is working as expected for me 💪

@DurgNomis-drol
Copy link
Owner

DurgNomis-drol commented Jan 14, 2024

@CM000n Yes we should, will open an issue over there.

DurgNomis-drol/mytoyota#301

Copy link
Owner

@DurgNomis-drol DurgNomis-drol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Love your hard work on this!

@CM000n CM000n merged commit 8f7909a into master Jan 14, 2024
5 checks passed
@CM000n CM000n deleted the enhancement/use_new_mytoyota_api branch January 14, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants