Closed mm98 closed 1 year ago
I haven't been able to reproduce this.
I can see why mileage_since_refuel
can become unavailable
, but I do not see why it would affect mileage_latest_month
.
Anyways, I have added some more error handling and rewritten the code for mileage_since_refuel
in an attempt to make it update faster. It previously used a feature in the API named totalTripStatistics
. It is quite convenient, but to my surprise it seems to update overnight only.
Instead I have made it find the odometer value at refuel time, and then subtract that from the current odometer value.
However, the odometer can take a while to update also, but do update faster than totalTripStatistics
.
I'll do some more testing tomorrow, and if satisfactory make an update of the preview version.
These error could actually be timeouts by api.connectedcars.io graphql .. Not a big thing for me, I just wanted to report it. Since it is a new one this time 😊
This error originated from a custom integration.
Logger: homeassistant.helpers.entity
Source: custom_components/connectedcars_io/minvw/minvw.py:68
Integration: Connectedcars.io (Min Volkswagen) (documentation, issues)
First occurred: 11:38:24 (1 occurrences)
Last logged: 11:38:24
Update for sensor.audi_a5_mileage_since_refuel fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 559, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in async_device_update
await self.async_update()
File "/config/custom_components/connectedcars_io/sensor.py", line 344, in async_update
) = await self._connectedcarsclient.get_mileage_since_refuel(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/connectedcars_io/minvw/minvw.py", line 140, in get_mileage_since_refuel
vehicle_data = await self.api_request(req_param)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/connectedcars_io/minvw/minvw.py", line 68, in api_request
ret = await response.json()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1104, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://api.connectedcars.io/graphql')
My test wasn't really conclusive as the API didn't detect the refuel event... maybe too little fuel was added. Apart from that it seems good and quicker than before, so I have published the latest changes now. If you want to update to it, redownload v1.1.0.
If you want to update to it, redownload v1.1.0.
Thanks @jnxxx !! I'll give it a tryand report back, if I find something :)
Hi,
I'm using the latest prerelease
v1.1.0
. Every time I refuel my car, I get an error onsensor.audi_a5_mileage_latest_month
. It almost looks like it can't read the value after the first few miles. It will start working the next day (sometimes) or if i travel like +50 miles. Currently traveled24km
since refuel.At the same time
sensor.audi_a5_mileage_since_refuel
has becomeunavailable
.(Note: The strange thing is, that the
Economy
sensor is read/loading correctly)