skodaconnect / myskoda

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

Make fields of ServiceEventChargingData optional #183

Closed fursov closed 1 week ago

fursov commented 1 week ago

Superb iV (MY 2020) does not send any additional data in the charging-status-changed event so the exception happens and warning is printed in the logs.

This can be observed from logs:

2024-11-09 15:30:34.512 DEBUG (MainThread) [myskoda.mqtt] Received PUBLISH (d0, q0, r0, m0), '97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx/TMBAXXXXXXXXXXXXX/service-event/charging', ...  (237 bytes)
2024-11-09 15:30:34.513 DEBUG (MainThread) [myskoda.mqtt] Message (service-event) received for TMBAXXXXXXXXXXXXX on topic charging: b'{"version":1,"traceId":"81b50439-af83-44e1-9515-5b3925d4c34a","timestamp":"2024-11-09T13:30:34Z","producer":"SKODA_MHUB","name":"charging-status-changed","data":{"userId":"97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx","vin":"TMBAXXXXXXXXXXXXX"}}'
2024-11-09 15:30:34.513 WARNING (MainThread) [myskoda.mqtt] Exception parsing MQTT event: Field "data" of type ServiceEventChargingData in ServiceEventCharging has invalid value {'userId': '97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx', 'vin': 'TMBAXXXXXXXXXXXXX'}
2024-11-09 15:30:34.515 DEBUG (MainThread) [myskoda.mqtt] Received PUBLISH (d0, q0, r0, m0), '97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx/TMBAXXXXXXXXXXXXX/service-event/charging', ...  (237 bytes)
2024-11-09 15:30:34.516 DEBUG (MainThread) [myskoda.mqtt] Message (service-event) received for TMBAXXXXXXXXXXXXX on topic charging: b'{"version":1,"traceId":"81b50439-af83-44e1-9515-5b3925d4c34a","timestamp":"2024-11-09T13:30:34Z","producer":"SKODA_MHUB","name":"charging-status-changed","data":{"userId":"97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx","vin":"TMBAXXXXXXXXXXXXX"}}'
2024-11-09 15:30:34.516 WARNING (MainThread) [myskoda.mqtt] Exception parsing MQTT event: Field "data" of type ServiceEventChargingData in ServiceEventCharging has invalid value {'userId': '97bee240-dd09-4d56-8d8b-fbdfxxxxxxxx', 'vin': 'TMBAXXXXXXXXXXXXX'}