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

Some fields are not present in Superb iV 2020 response to driving_range #202

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

fursov
Copy link
Contributor

@fursov fursov commented Nov 13, 2024

Log entries:

2024-11-13 00:49:12.301 ERROR (MainThread) [myskoda.rest_api] Failed to deserialize data: {"carType":"hybrid","totalRangeInKm":770,"primaryEngineRange":{"engineType":"gasoline","currentSoCInPercent":93,"currentFuelLevelInPercent":93,"remainingRangeInKm":770},"secondaryEngineRange":{"engineType":"electric","remainingRangeInKm":0},"carCapturedTimestamp":"2024-11-12T17:54:48Z"}
Traceback (most recent call last):
  File "<string>", line 31, in __mashumaro_from_json__
  File "<string>", line 7, in __mashumaro_from_dict_json__
mashumaro.exceptions.MissingField: Field "current_soc_in_percent" of type int is missing in EngineRange instance

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 435, in _deserialize
    data = deserialize(text)
           ^^^^^^^^^^^^^^^^^
  File "<string>", line 33, in __mashumaro_from_json__
mashumaro.exceptions.InvalidFieldValue: Field "secondary_engine_range" of type Optional[EngineRange] in DrivingRange has invalid value {'engineType': 'electric', 'remainingRangeInKm': 0}
2024-11-13 00:49:12.302 ERROR (MainThread) [custom_components.myskoda.coordinator] Unexpected error fetching myskoda data
Traceback (most recent call last):
  File "<string>", line 31, in __mashumaro_from_json__
  File "<string>", line 7, in __mashumaro_from_dict_json__
mashumaro.exceptions.MissingField: Field "current_soc_in_percent" of type int is missing in EngineRange instance

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 382, in _async_refresh
    [self.data](http://self.data/) = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myskoda/coordinator.py", line 94, in _async_update_data
    vehicle = await self.myskoda.get_vehicle(self.vin)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/myskoda.py", line 311, in get_vehicle
    vehicle.driving_range = await self.get_driving_range(vin)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/myskoda.py", line 277, in get_driving_range
    return (await self.rest_api.get_driving_range(vin, anonymize=anonymize)).result
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 191, in get_driving_range
    result = self._deserialize(raw, DrivingRange.from_json)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 435, in _deserialize
    data = deserialize(text)
           ^^^^^^^^^^^^^^^^^
  File "<string>", line 33, in __mashumaro_from_json__
mashumaro.exceptions.InvalidFieldValue: Field "secondary_engine_range" of type Optional[EngineRange] in DrivingRange has invalid value {'engineType': 'electric', 'remainingRangeInKm': 0}
2024-11-13 00:49:12.306 DEBUG (MainThread) [custom_components.myskoda.coordinator] Finished fetching myskoda data in 2.144 seconds (success: False)

And another one:

2024-11-13 01:09:25.294 DEBUG (MainThread) [myskoda.myskoda] Trace: GET https://mysmob.api.connect.skoda-auto.cz/api/v2/vehicle-stat - response: 200 (2 bytes) {}
2024-11-13 01:09:25.299 ERROR (MainThread) [myskoda.rest_api] Failed to deserialize data: {}
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 435, in _deserialize
    data = deserialize(text)
           ^^^^^^^^^^^^^^^^^
  File "<string>", line 8, in __mashumaro_from_json__
mashumaro.exceptions.MissingField: Field "car_captured_timestamp" of type datetime is missing in DrivingRange instance
2024-11-13 01:09:25.308 ERROR (MainThread) [custom_components.myskoda.coordinator] Unexpected error fetching myskoda data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 382, in _async_refresh
    [self.data](http://self.data/) = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/myskoda/coordinator.py", line 94, in _async_update_data
    vehicle = await self.myskoda.get_vehicle(self.vin)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/myskoda.py", line 311, in get_vehicle
    vehicle.driving_range = await self.get_driving_range(vin)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/myskoda.py", line 277, in get_driving_range
    return (await self.rest_api.get_driving_range(vin, anonymize=anonymize)).result
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 191, in get_driving_range
    result = self._deserialize(raw, DrivingRange.from_json)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/myskoda/rest_api.py", line 435, in _deserialize
    data = deserialize(text)
           ^^^^^^^^^^^^^^^^^
  File "<string>", line 8, in __mashumaro_from_json__
mashumaro.exceptions.MissingField: Field "car_captured_timestamp" of type datetime is missing in DrivingRange instance
2024-11-13 01:09:25.311 DEBUG (MainThread) [custom_components.myskoda.coordinator] Finished fetching myskoda data in 3.150 seconds (success: False)

@fursov fursov changed the title The field currentSoCInPercent is not present in Superb iV 2020 response to driving_range Some fields are not present in Superb iV 2020 response to driving_range Nov 13, 2024
@WebSpider
Copy link
Contributor

WebSpider commented Nov 13, 2024

Loosly related: Do we already have a fixture for this car?

It seems the message was completely empty.
@fursov
Copy link
Contributor Author

fursov commented Nov 13, 2024

Loosly related: Do we already have a fixture for this car?

Yes (myskoda/fixtures/superb_iv_2020_3v35xc_liftback_l_and_k.yaml), but for some reason the currentSoCInPercent is missing in the response for secondary engine here.

The second response is quite strange: it is just empty. So I removed the fix for missing car_captured_timestamp, seems the issue is somewhere else.

@dvx76 dvx76 merged commit e779456 into skodaconnect:main Nov 13, 2024
2 checks passed
@WebSpider WebSpider added the bug Something isn't working label Nov 13, 2024
@fursov fursov deleted the fix-engine-range branch November 14, 2024 07:41
zaptm pushed a commit to zaptm/myskoda that referenced this pull request Dec 8, 2024
…ge (skodaconnect#202)

* The field currentSoCInPercent is not present in Superb iV 2020 response to driving_range

* The field carCapturedTimestamp is not present in Superb iV 2020 response to driving_range

* Roll back change for carCapturedTimestamp

It seems the message was completely empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants