skodaconnect / homeassistant-myskoda

Homeassistant integration for MySkoda.
96 stars 15 forks source link

AttributeError: 'ServiceEventData' object has no attribute 'charged_range' #356

Open prvakt opened 3 days ago

prvakt commented 3 days ago

with latest version of myskoda (1.11.1) I got following error

Logger: homeassistant
Source: custom_components/myskoda/coordinator.py:171
integration: MySkoda ([documentation](https://github.com/skodaconnect/homeassistant-myskoda/blob/main/README.md), [issues](https://github.com/skodaconnect/homeassistant-myskoda/issues))
First occurred: 12:02:35 PM (1 occurrences)
Last logged: 12:02:35 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/myskoda/coordinator.py", line 117, in _on_mqtt_event
    await self._on_charging_event(event)
  File "/config/custom_components/myskoda/coordinator.py", line 171, in _on_charging_event
    if data.charged_range is not None:
       ^^^^^^^^^^^^^^^^^^
AttributeError: 'ServiceEventData' object has no attribute 'charged_range'

after receiving service-event

2024-11-27 12:02:35.545 DEBUG (MainThread) [myskoda.mqtt] Message (service-event) received for XXXXXXXXXXXXXXXXX on topic charging: b'{"version":1,"traceId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","timestamp":"2024-11-27T11:02:35Z","producer":"SKODA_MHUB","name":"charging-status-changed","data":{"userId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","vin":"XXXXXXXXXXXXXXXXX"}}'
fursov commented 3 days ago

Most probably happens after mine https://github.com/skodaconnect/myskoda/pull/235

fursov commented 3 days ago

@WebSpider just to clarify: when I mentioned the https://github.com/skodaconnect/myskoda/pull/235, I meant the HA component now needs adaptation, this is not a bug in the library. This now happens because the interface towards library has changed.

fursov commented 3 days ago

I must admit that I have not taken care of that myself and also forgot to inform you about potential issue.

WebSpider commented 2 days ago

I must admit that I have not taken care of that myself and also forgot to inform you about potential issue.

Don't worry about it, it's why this piece of software has a big disclaimer :-)

Should you change the interface of the library, next time please just add this in the PR, so we can check accordingly. As reviewers we also learned to check on interface changes better.

reineo commented 2 days ago

Get this too and sensors stop updating. Skoda Octavia iV (Hybrid)

Logger: homeassistant
Källa: custom_components/myskoda/coordinator.py:181
integration: MySkoda ([dokumentation](https://github.com/skodaconnect/homeassistant-myskoda/blob/main/README.md), [ärenden](https://github.com/skodaconnect/homeassistant-myskoda/issues))
Inträffade först: 07:41:54 (6 händelser)
Senast loggade: 07:55:48

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/myskoda/coordinator.py", line 127, in _on_mqtt_event
    await self._on_charging_event(event)
  File "/config/custom_components/myskoda/coordinator.py", line 181, in _on_charging_event
    if data.charged_range is not None:
       ^^^^^^^^^^^^^^^^^^
AttributeError: 'ServiceEventData' object has no attribute 'charged_range'
fursov commented 2 days ago

Get this too and sensors stop updating. Skoda Octavia iV (Hybrid)

Logger: homeassistant
Källa: custom_components/myskoda/coordinator.py:181
integration: MySkoda ([dokumentation](https://github.com/skodaconnect/homeassistant-myskoda/blob/main/README.md), [ärenden](https://github.com/skodaconnect/homeassistant-myskoda/issues))
Inträffade först: 07:41:54 (6 händelser)
Senast loggade: 07:55:48

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/myskoda/coordinator.py", line 127, in _on_mqtt_event
    await self._on_charging_event(event)
  File "/config/custom_components/myskoda/coordinator.py", line 181, in _on_charging_event
    if data.charged_range is not None:
       ^^^^^^^^^^^^^^^^^^
AttributeError: 'ServiceEventData' object has no attribute 'charged_range'

I'm working on it. Yesterday Skoda had once again "terms update" issue and I did not test my change. Only this morning I read Discord messages and found info about this. The fix should be ready today evening.

prvakt commented 2 days ago

yep same here, If I start auxiliary heater while the charging cable is connected, charging event is published before start-auxiliary-heater event but this start event is never captured because of the error while parsing charging event. Then sensors are updated just during regular update

@reineo Would it be possible for you to generate fixtures for your car? As we don't have fixtures from this car I would like to check if there is something we are missing.. Generate Fixture button is available from the integration under diagnostic section and trace is generated inside the HA core log starting with line Fixtures for

reineo commented 2 days ago

Fixtures: https://github.com/skodaconnect/myskoda/issues/253

WebSpider commented 2 days ago

I moved the fixtures to skodaconnect/myskoda so we can add it to tests

prvakt commented 2 days ago

I moved the fixtures to skodaconnect/myskoda so we can add it to tests

I will create PR with the file as I have another fixture from citigo as well