Closed CM000n closed 8 months ago
The binary_sensor
s and device_tracker
s are now working again with the current status π:
I hope I can find some time next week to take care of the sensors. Then we could release a first version based on the new API endpoints. π The comments about the custom components no longer working are slowly piling up in Issue https://github.com/DurgNomis-drol/ha_toyota/issues/160
Hey, not sure if this is any help but I tried your latest commit and I'm still getting:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/toyota/__init__.py", line 54, in async_setup_entry
use_metric_values = entry.data[CONF_METRIC_VALUES]
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
KeyError: 'use_metric_values'
Hey, not sure if this is any help but I tried your latest commit and I'm still getting:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/toyota/__init__.py", line 54, in async_setup_entry use_metric_values = entry.data[CONF_METRIC_VALUES] ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ KeyError: 'use_metric_values'
It looks like the custom component is missing the information for use_metric_values
.
Did you also completely removed the integration before you copied the files from the last commit state?
The custom component must be completely set up and configured from scratch before you can use it.
At first I just replaced the files but this didn't work, so I removed the integration and just placed the folder in the custom_components folder, still the same error. I'm probably doing something wrong, could you tell me what is the correct way?
At first I just replaced the files but this didn't work, so I removed the integration and just placed the folder in the custom_components folder, still the same error. I'm probably doing something wrong, could you tell me what is the correct way?
That sounds valid at first. Have you also restarted in between after deleting the integration completely and manually copying the files from the development branch?
What does your UI dialog look like when you set up the integration again? Is the option for metric values available there? Do you have a screenshot?
I was able to get it to work by removing it completely from integrations as well as from custom_components and redoing credentials. It seems to be connecting fine, however, only car location is working for me at the moment.
I was able to get it to work by removing it completely from integrations as well as from custom_components and redoing credentials. It seems to be connecting fine, however, only car location is working for me at the moment.
That is the intention. It looks like your car (even via the official app) doesn't provide any information on the status of windows and doors, right? And more is not yet integrated in the current state of work.
That's actually correct π Let me know if I can be any help with testing other stuff.
Good evening, after I copy the files into the custom_component folder, how do I enter the user and password for the new app? Thank you
Good evening, after I copy the files into the custom_component folder, how do I enter the user and password for the new app? Thank you
You need to delete this integration from settings -> devices and re-add it.
Good evening, after I copy the files into the custom_component folder, how do I enter the user and password for the new app? Thank you
You need to delete this integration from settings -> devices and re-add it.
Forgive me I don't understand :-( I removed the "old" integration in HACS Toyota Connected Services Europe and deleted the Toyota directory under custom_components. I copied the new mytoyota (with all its contents) always under custom_components. At this point what steps should I follow? Thanks and sorry for the disturbance
Good evening, after I copy the files into the custom_component folder, how do I enter the user and password for the new app? Thank you
You need to delete this integration from settings -> devices and re-add it.
Forgive me I don't understand :-( I removed the "old" integration in HACS Toyota Connected Services Europe and deleted the Toyota directory under custom_components. I copied the new mytoyota (with all its contents) always under custom_components. At this point what steps should I follow? Thanks and sorry for the disturbance
Why are you talking about mytoyota
? mytoyota
is the python lib for the custom component and not a custom component itself.
Please guys, don't let this degenerate into a "how to install a custom component manually" discussion. The branch is under development and its contents may be incomplete or in the process of being changed at any time. So you should know what you are doing before you try to use this working state π
Good evening, after I copy the files into the custom_component folder, how do I enter the user and password for the new app? Thank you
You need to delete this integration from settings -> devices and re-add it.
Forgive me I don't understand :-( I removed the "old" integration in HACS Toyota Connected Services Europe and deleted the Toyota directory under custom_components. I copied the new mytoyota (with all its contents) always under custom_components. At this point what steps should I follow? Thanks and sorry for the disturbance
Why are you talking about
mytoyota
?mytoyota
is the python lib for the custom component and not a custom component itself. Please guys, don't let this degenerate into a "how to install a custom component manually" discussion. The branch is under development and its contents may be incomplete or in the process of being changed at any time. So you should know what you are doing before you try to use this working state π
Of course, I thought the installation was "simple" and within the reach of the average user. I'm waiting for the release, even in beta, to test it with my CHR. Thank you
Aaaand statistics sensors now also working again βΊοΈ
Hi @CM000n , Thank you for your amazing work updating this integration. I have applied your latest commits and the new sensors are now available in HA. I have noticed something weird in the current month/year sensor. I was expecting both of them to display the same value since this is the first month of 2024. However the current year stats display double kilometers compared to the current month stats.
Are you planning to update the sensors to include additional attributes like driver score, EV driving time, etc as it was the previous version of the integration?
Hi @CM000n , Thank you for your amazing work updating this integration. I have applied your latest commits and the new sensors are now available in HA. I have noticed something weird in the current month/year sensor. I was expecting both of them to display the same value since this is the first month of 2024. However the current year stats display double kilometers compared to the current month stats.
Are you planning to update the sensors to include additional attributes like driver score, EV driving time, etc as it was the previous version of the integration?
There is already an issue open for the inconsistent statistic summaries on the mytoyota
lib: https://github.com/DurgNomis-drol/mytoyota/issues/281#issue-2070810003 π
Additional information is currently no longer provided by the mytoyota lib. We will certainly expand this in the future. But the initial release will probably include any further informations.
Hi @CM000n to add my contribution to the effort I also install your last commit to help you test your new change.
As already explained in this MR I delete my integration and uninstal the int from hacs. Then I put manually the integration.
Setup flow seems to work correctly. But when int try to create entities it seems that some value required is not always send by toyota
2024-01-09 08:41:14.233 ERROR (MainThread) [custom_components.toyota] Unexpected error fetching toyota data: 2 validation errors for VehiclesResponseModel
payload -> 0 -> dcm
none is not an allowed value (type=type_error.none.not_allowed)
payload -> 0 -> electricalPlatformCode
none is not an allowed value (type=type_error.none.not_allowed)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/toyota/__init__.py", line 72, in async_get_vehicle_data
vehicles = await asyncio.wait_for(client.get_vehicles(metric=use_metric_values), 15)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 489, in wait_for
return fut.result()
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mytoyota/client.py", line 63, in get_vehicles
vehicles = await self._api.get_vehicles_endpoint()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mytoyota/api.py", line 75, in get_vehicles_endpoint
return await self._request_and_parse(VehiclesResponseModel, "GET", VEHICLE_GUID_ENDPOINT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/mytoyota/api.py", line 49, in _request_and_parse
return model(**response)
^^^^^^^^^^^^^^^^^
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 2 validation errors for VehiclesResponseModel
payload -> 0 -> dcm
none is not an allowed value (type=type_error.none.not_allowed)
payload -> 0 -> electricalPlatformCode
none is not an allowed value (type=type_error.none.not_allowed)
2024-01-09 08:41:14.237 DEBUG (MainThread) [custom_components.toyota] Finished fetching toyota data in 0.515 seconds (success: False)
I have a Toyota Corolla Touring 2021 I don't see all the payload of the message in the Log...
Hi @CM000n to add my contribution to the effort I also install your last commit to help you test your new change.
As already explained in this MR I delete my integration and uninstal the int from hacs. Then I put manually the integration.
Setup flow seems to work correctly. But when int try to create entities it seems that some value required is not always send by toyota I have a Toyota Corolla Touring 2021 I don't see all the payload of the message in the Log...
This is a problem with a model of the used mytoyota
python lib.
Please open a separate issue there for better tracking of the problem: https://github.com/DurgNomis-drol/mytoyota/issues
After loading the latest commit, I can see all info on VIM entity, but the statistics stopped working for me.
The errors I'm seeing are:
[140095905274688] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_year_statistics).attributes.EV_duration=11:11:06(<class 'datetime.timedelta'>
[140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_day_statistics).attributes.EV_duration=0:01:57(<class 'datetime.timedelta'>
[140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_week_statistics).attributes.EV_duration=0:40:14(<class 'datetime.timedelta'>
[140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_month_statistics).attributes.EV_duration=5:35:33(<class 'datetime.timedelta'>
[140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_year_statistics).attributes.EV_duration=11:11:06(<class 'datetime.timedelta'>
After loading the latest commit, I can see all info on VIM entity, but the statistics stopped working for me.
The errors I'm seeing are:
[140095905274688] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_year_statistics).attributes.EV_duration=11:11:06(<class 'datetime.timedelta'> [140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_day_statistics).attributes.EV_duration=0:01:57(<class 'datetime.timedelta'> [140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_week_statistics).attributes.EV_duration=0:40:14(<class 'datetime.timedelta'> [140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_month_statistics).attributes.EV_duration=5:35:33(<class 'datetime.timedelta'> [140095914808384] Unable to serialize to JSON. Bad data found at $(State: sensor.rav4_phev_current_year_statistics).attributes.EV_duration=11:11:06(<class 'datetime.timedelta'>
Thanks for reporting. Can you test it again?
Working back again, thanks!
The latest commit is working great for me. Any chance for the battery percentage sensor? π
The latest commit is working great for me. Any chance for the battery percentage sensor? π
The battery level sensor is already included. However, I only generate this if the vehicle returns battery_status = true
in its capabilities.
Maybe this assumption is wrong. It looks like you have a plug-in hybrid?
I only have a mild hybrid myself, which definitely doesn't return any status to its battery, so I can't try it out myself.
Could you please post the Features
and Extended capabilities
from the attributes of the Vin sensor for your vehicle here? We might be able to understand it better with that information. π
Yeah it's a plugin hybrid, so the app is providing info like battery state of charge in percentage and range in kilometres.
Actually, it's returning ev_vehicle: true above extended_capabilities
Thank you very much! π You should now see the battery level sensor
Thank you very much! π You should now see the battery level sensor
No, no, I'm the one thanking you! Thank You for making my Home Assistant instance better β€οΈ
Will confirm soon. My wife is driving the car right now and the API is refusing to work, even in the official app π€£
It's there but it seems to be pulling fuel level stat. The current battery state of charge is 88%
If I can be any help with testing other sensors related to EV (EV range etc), let me know.
Working now!
You are flying, all is working fine and matching the app.
Once again great work. Just letting you know that "fuel consumed" is the only attribute that is incorrect for all day/week/month/year sensors. I get 2lt fuel consumption for 256km travelled which is inconsistent with actual consumption provided by the myToyota app
Once again great work. Just letting you know that "fuel consumed" is the only attribute that is incorrect for all day/week/month/year sensors. I get 2lt fuel consumption for 256km travelled which is inconsistent with actual consumption provided by the myToyota app
This is a problem with the mytoyota lib. Please open a separate issue there: https://github.com/DurgNomis-drol/mytoyota/issues
Does it make sense to have the VIN as an attribute of the VIN sensor that already shows the VIN? Also masking it in the attribute doesn't provide much value as the sensor itself shows it complete.
Does it make sense to have the VIN as an attribute of the VIN sensor that already shows the VIN? Also masking it in the attribute doesn't provide much value as the sensor itself shows it complete.
The idea was simply to be able to copy and paste the content of the attributes of the VIN sensor somewhere for debugging purposes if required. But you are probably right and the redundant specification of the masked VIN number is not really necessary there.
I think we are good to go for a first release based on the new API @DurgNomis-drol π
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. :)
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:
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:
You seem to be a really nice person, and I have done my duty with pleasure if that's what makes you happy :)
You seem to be a really nice person, and I have done my duty with pleasure if that's what makes you happy :)
β€οΈ β€οΈ β€οΈ
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?
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?
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?
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
Should be fixed/adjusted now @DurgNomis-drol π
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?
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.
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.
('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
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. :wink: Shouldn't we move the search for your Odometer values to an issue in the mytoyota repo?
Just loaded the latest commit and all is working as expected for me πͺ
This MR uses a
mytoyota
version >= 1.0 and therefore also the newctpa-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 revisedmytoyota
lib version.