skodaconnect / myskoda

Python library for interacting with MySkoda APIs.
MIT License
9 stars 22 forks source link

mashumaro.exceptions.InvalidFieldValue: Field "status" of type Optional[ChargingStatus] in Charging has invalid value {'state': 'CONNECT_CABLE', 'chargeType': 'OFF', 'battery': {'stateOfChargeInPercent': 39}} #194

Closed jmartens closed 1 week ago

jmartens commented 2 weeks ago

While generting fixtures for my vehicle, same as in #193 I run into the following error:

2024-11-11 20:56:33 L-13697 myskoda.rest_api[24732] ERROR Failed to deserialize data: {"isVehicleInSavedLocation": false, "status": {"state": "CONNECT_CABLE", "chargeType": "OFF", "battery": {"stateOfChargeInPercent": 39}}, "set
tings": {"availableChargeModes": [], "maxChargeCurrentAc": "MAXIMUM"}, "carCapturedTimestamp": "2024-11-09T18:06:31Z", "errors": [{"type": "CARE_MODE_IS_NOT_AVAILABLE", "description": "Care mode is not available."}, {"type": "AUTO_UNLOCK_IS_NOT_AVAILABLE", "description": "Auto unlock is not available."}, {"type": "CHARGE_LIMIT_IS_NOT_AVAILABLE", "description": "Charge limit is not available."}]}
Traceback (most recent call last):
  File "<string>", line 9, in __mashumaro_from_dict_json__
  File "<string>", line 6, in __mashumaro_from_dict_json__
mashumaro.exceptions.MissingField: Field "remaining_cruising_range_in_meters" of type int is missing in Battery instance

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 34, in __mashumaro_from_json__
  File "<string>", line 11, in __mashumaro_from_dict_json__
mashumaro.exceptions.InvalidFieldValue: Field "battery" of type Battery in ChargingStatus has invalid value {'stateOfChargeInPercent': 39}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jonathan.martens\Code\skoda\myskoda\myskoda\rest_api.py", line 435, in _deserialize
    data = deserialize(text)
           ^^^^^^^^^^^^^^^^^
  File "<string>", line 36, in __mashumaro_from_json__
mashumaro.exceptions.InvalidFieldValue: Field "status" of type Optional[ChargingStatus] in Charging has invalid value {'state': 'CONNECT_CABLE', 'chargeType': 'OFF', 'battery': {'stateOfChargeInPercent': 39}}
jmartens commented 2 weeks ago

After applying #195 I am able to generate fixtures

WebSpider commented 2 weeks ago

Is this still present in v0.10.0?

dvx76 commented 1 week ago

Closing assuming this is fixed by #195