audi_connect_ha icon indicating copy to clipboard operation
audi_connect_ha copied to clipboard

Regular errors in logs

Open brettonw opened this issue 3 years ago • 9 comments

2022-07-08 16:13:41 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle longTerm tripdata of XXXXXX: 'NoneType' object is not subscriptable 2022-07-08 16:13:42 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] support_preheater set to False: 502

brettonw avatar Jul 08 '22 20:07 brettonw

@arjenvrh I have two Audis connected. I get this error as well. Additionally I get short-term data errors, which are continuous and are spamming the logs. Is it possible for you to fix that? I am running HA 2022.07 but theses errors were there before as well.

Kind regards

2022-07-09 07:05:57 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle longTerm tripdata of WAUZZZZZZZZZZZZZZ: 'NoneType' object is not subscriptable
2022-07-09 07:05:57 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] support_preheater set to False: 502
2022-07-09 07:05:58 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] Unable to obtain the vehicle longTerm tripdata of WAUZZZXXXXXXXXXXX: 'NoneType' object is not subscriptable
2022-07-09 07:05:58 ERROR (MainThread) [custom_components.audiconnect.audi_connect_account] support_preheater set to False: 502
2022-07-09 07:05:59 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform audiconnect
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 397, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 641, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 646, in _async_write_ha_state
    self.hass.states.async_set(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1438, in async_set
    state = State(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1099, in __init__
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.audi_e_tron_gt_shortterm_trip_data. State max length is 255 characters.

2022-07-09 07:07:03 ERROR (MainThread) [homeassistant.util.logging] Exception in async_schedule_update_ha_state when dispatching 'audiconnect.updated': ()
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 677, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 646, in _async_write_ha_state
    self.hass.states.async_set(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1438, in async_set
    state = State(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1099, in __init__
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.audi_a3_sportback_tfsi_e_shortterm_trip_data. State max length is 255 characters.

2022-07-09 07:14:27 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 128, in _async_init
    await self.initialize()
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 98, in initialize
    await self.update_settings()
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 202, in update_settings
    self._settings = await self.http_request("get", "settings")
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 234, in http_request
    resp_json = await resp.json()
  File "/usr/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1098, in json
    await self.read()
  File "/usr/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1036, in read
    self._body = await self.content.read()
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 375, in read
    block = await self.readany()
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 397, in readany
    await self._wait("readany")
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 304, in _wait
    await waiter
aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed
2022-07-09 07:14:33 ERROR (MainThread) [homeassistant.util.logging] Exception in async_schedule_update_ha_state when dispatching 'audiconnect.updated': ()
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 677, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 646, in _async_write_ha_state
    self.hass.states.async_set(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1438, in async_set
    state = State(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1099, in __init__
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.audi_e_tron_gt_shortterm_trip_data. State max length is 255 characters.

2022-07-09 07:14:41 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 128, in _async_init
    await self.initialize()
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 98, in initialize
    await self.update_settings()
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 202, in update_settings
    self._settings = await self.http_request("get", "settings")
  File "/usr/lib/python3.10/site-packages/aioshelly/block_device.py", line 234, in http_request
    resp_json = await resp.json()
  File "/usr/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1098, in json
    await self.read()
  File "/usr/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1036, in read
    self._body = await self.content.read()
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 375, in read
    block = await self.readany()
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 397, in readany
    await self._wait("readany")
  File "/usr/lib/python3.10/site-packages/aiohttp/streams.py", line 304, in _wait
    await waiter
aiohttp.client_exceptions.ClientPayloadError: Response payload is not completed
2022-07-09 07:15:37 ERROR (MainThread) [homeassistant.util.logging] Exception in async_schedule_update_ha_state when dispatching 'audiconnect.updated': ()
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 677, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/entity.py", line 646, in _async_write_ha_state
    self.hass.states.async_set(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1438, in async_set
    state = State(
  File "/usr/lib/python3.10/site-packages/homeassistant/core.py", line 1099, in __init__
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.audi_e_tron_gt_shortterm_trip_data. State max length is 255 characters.

florie1706 avatar Jul 09 '22 05:07 florie1706

Seems to be a Python 3.10 Problem.

Got the Error after upgrading my HomeAssistant to use python 3.10

homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.audi_e_tron_gt_shortterm_trip_data. State max length is 255 characters.

bbr111 avatar Aug 10 '22 12:08 bbr111

I think I got it even before python 3.10

florie1706 avatar Aug 10 '22 12:08 florie1706

You're right!

I switch back to python 3.9 and the error is still present. Have the same problem.

bbr111 avatar Aug 10 '22 13:08 bbr111

Any update on this issue? I have the message about every minute in my logs

2022-09-20 11:57:09.874 ERROR (MainThread) [homeassistant.util.logging] Exception in async_schedule_update_ha_state when dispatching 'audiconnect.updated': () Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 678, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 647, in _async_write_ha_state self.hass.states.async_set( File "/usr/src/homeassistant/homeassistant/core.py", line 1463, in async_set state = State( File "/usr/src/homeassistant/homeassistant/core.py", line 1124, in init raise InvalidStateError( homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity ID: sensor.q5_shortterm_trip_data. State max length is 255 characters.

jfournierphoto avatar Sep 20 '22 16:09 jfournierphoto

Same here

JBO-Home22 avatar Nov 17 '22 05:11 JBO-Home22

same here

thorsten avatar Jan 08 '23 11:01 thorsten

I digged a bit into this issue. The error pops up because the trip data is returned as a long JSON string with the multiple attributes combined in one sensor. The result is too long since HA limited the sensor state length to max. 255 chars.

Since there is no maintainer for this project anymore, you can fix it yourself doing the following changes: In homeassistant\custom_components\audiconnect\audi_connect_account.py search for async def update_vehicle_tripdata(self, kind: str): (around line 700) comment out some of the following lines where all the attributes are mentioned. Mine looks like this now: (I added some more coding since I had another bug regarding the reset trip data sensor, you just need to add some # at the beginning of the lines you don't care about)

            if td_cur is not None:
                self._vehicle.state[kind.lower() + "_current"] = {
                    "tripID": td_cur.tripID,
#                    "averageElectricEngineConsumption": td_cur.averageElectricEngineConsumption,
#                    "averageFuelConsumption": td_cur.averageFuelConsumption,
#                    "averageSpeed": td_cur.averageSpeed,
                    "mileage": td_cur.mileage,
                    "startMileage": td_cur.startMileage,
#                    "traveltime": td_cur.traveltime,
                    "timestamp": td_cur.timestamp,
#                    "overallMileage": td_cur.overallMileage,
                }
            if td_rst is not None:
                self._vehicle.state[kind.lower() + "_reset"] = {
                    "tripID": td_rst.tripID,
#                    "averageElectricEngineConsumption": td_rst.averageElectricEngineConsumption,
#                    "averageFuelConsumption": td_rst.averageFuelConsumption,
#                    "averageSpeed": td_rst.averageSpeed,
                    "mileage": td_rst.mileage,
                    "startMileage": td_rst.startMileage,
#                    "traveltime": td_rst.traveltime,
                    "timestamp": td_rst.timestamp,
#                    "overallMileage": td_rst.overallMileage,
                }

derhappy avatar Aug 08 '23 13:08 derhappy

This issue is stale because it has been open for 60 days with no activity. Are you still experiencing this issue?

github-actions[bot] avatar Mar 14 '24 02:03 github-actions[bot]