ad-ha / mg-saic-ha

MG SAIC Custom Integration for Home Assistant
MIT License
9 stars 0 forks source link

MG 4 2022 SE shows SoC of 102,3% #19

Closed x3e closed 2 weeks ago

x3e commented 2 weeks ago

I'm very happy that the SoC now seems to be working for my car. From time to time the SoC shows 102,3% and that doesn't seem correct. Maybe you should filter for values above 100%?

Let me know if you want some logs.

IMG_20241108_140629 IMG_20241108_141200

x3e commented 2 weeks ago

Seems like this is a duplicate of https://github.com/ad-ha/mg-saic-ha/issues/18. You can close this if you like.

ad-ha commented 2 weeks ago

The new release 0.4.3 shall address this issue. Added more conditions to the generic response verification.

x3e commented 1 week ago

@ad-ha sadly I'm still having this issue with 0.4.5. Let me know how I can help.

ad-ha commented 1 week ago

@x3e

I noticed this issue this morning. On yesterday version I refactored the exception handling and oversight that the exception with Generic Responses would not be fully raised and was being parsed.

I just released a fix that I believe gets this addressed (again). 😄

x3e commented 1 week ago

Seems like now I'm not getting any data at all. This was also a problem a few versions ago. I did try to remove and add the integration, that did not help.

ad-ha commented 1 week ago

Hi @x3e

It has been working fine for me. Think that it might be a case of the API sending only generic responses. Last weekend I spent almost the whole time without being able to get any data and on Monday morning it came back again.

Anyhow, let me have a look this night if I can.

Cheers

x3e commented 1 week ago

Yeah, for me it's not working at all anymore. I have been trying to re-add the integration for days now. I only get "generic responses"

`2024-11-15 09:16:52.912 DEBUG (MainThread) [custom_components.mg_saic] Logging in with username: [redacted], country_code: [redacted], is_email: False, region: EU 2024-11-15 09:16:55.750 DEBUG (MainThread) [custom_components.mg_saic] Vehicle list response: VehicleListResp(vinList=[VinInfo(bindTime=1677172627000, brandName='MG', colorName='[redacted]', isActivate=False, isCurrentVehicle=True, isSubaccount=False, modelName='EH32 X1', modelYear='2022', name=None, series='EH32 L', vin='[redacted]', subAccountList=[], vehicleModelConfiguration=[VehicleModelConfiguration(itemCode='J17', itemName='Tire', itemValue='1'), VehicleModelConfiguration(itemCode='Q00', itemName='Airbag', itemValue='1'), VehicleModelConfiguration(itemCode='Q01', itemName='FAirbag', itemValue='1'), VehicleModelConfiguration(itemCode='Q09', itemName='AirbagS', itemValue='1'), VehicleModelConfiguration(itemCode='S35', itemName='Sunroof', itemValue='0'), VehicleModelConfiguration(itemCode='S61', itemName='Remote control', itemValue='1'), VehicleModelConfiguration(itemCode='T11', itemName='AC', itemValue='1'), VehicleModelConfiguration(itemCode='EPS', itemName='EPS', itemValue='1'), VehicleModelConfiguration(itemCode='SA64', itemName='SA64', itemValue='0111110000000000001000000100101000000010100000000000000000000110'), VehicleModelConfiguration(itemCode='BONNUT', itemName='BONNUT', itemValue='1'), VehicleModelConfiguration(itemCode='DOOR', itemName='DOOR', itemValue='1111'), VehicleModelConfiguration(itemCode='BOOT', itemName='BOOT', itemValue='1'), VehicleModelConfiguration(itemCode='ENGINE', itemName='ENGINE', itemValue='1'), VehicleModelConfiguration(itemCode='EV', itemName='EV', itemValue='0'), VehicleModelConfiguration(itemCode='HeatedSeat', itemName='HeatedSeat', itemValue='0'), VehicleModelConfiguration(itemCode='KEYPOS', itemName='KEYPOS', itemValue='0'), VehicleModelConfiguration(itemCode='ENERGY', itemName='ENERGY', itemValue='1'), VehicleModelConfiguration(itemCode='BATTERY', itemName='BATTERY', itemValue='1'), VehicleModelConfiguration(itemCode='INTEMP', itemName='INTEMP', itemValue='1'), VehicleModelConfiguration(itemCode='EXTEMP', itemName='EXTEMP', itemValue='1'), VehicleModelConfiguration(itemCode='WINDOW', itemName='WINDOW', itemValue='0000'), VehicleModelConfiguration(itemCode='LRD', itemName='LRD', itemValue='0'), VehicleModelConfiguration(itemCode='BTKEY', itemName='BTKEY', itemValue='1'), VehicleModelConfiguration(itemCode='BType', itemName='Battery', itemValue='2'), VehicleModelConfiguration(itemCode='SBH', itemName='SBH', itemValue='1'), VehicleModelConfiguration(itemCode='BHI', itemName='BHI', itemValue='1'), VehicleModelConfiguration(itemCode='ROV', itemName='ROV', itemValue='25857')])]) 2024-11-15 09:16:55.750 INFO (MainThread) [custom_components.mg_saic] Fetched vehicle data successfully. 2024-11-15 09:16:57.440 DEBUG (MainThread) [custom_components.mg_saic] Logging in with region-based endpoint for region: EU 2024-11-15 09:17:00.183 DEBUG (MainThread) [custom_components.mg_saic] Login successful, initializing vehicle APIs. 2024-11-15 09:17:04.466 DEBUG (MainThread) [custom_components.mg_saic] Generic Charging Data response. 2024-11-15 09:17:04.466 WARNING (MainThread) [custom_components.mg_saic] Data invalid or generic: Generic charging response received. 2024-11-15 09:17:04.466 INFO (MainThread) [custom_components.mg_saic] Retrying in 10 seconds... 2024-11-15 09:17:18.204 DEBUG (MainThread) [custom_components.mg_saic] Generic Charging Data response. 2024-11-15 09:17:18.204 WARNING (MainThread) [custom_components.mg_saic] Data invalid or generic: Generic charging response received. 2024-11-15 09:17:18.204 INFO (MainThread) [custom_components.mg_saic] Retrying in 20 seconds... 2024-11-15 09:17:41.953 DEBUG (MainThread) [custom_components.mg_saic] Generic Charging Data response. 2024-11-15 09:17:41.953 WARNING (MainThread) [custom_components.mg_saic] Data invalid or generic: Generic charging response received. 2024-11-15 09:17:41.953 INFO (MainThread) [custom_components.mg_saic] Retrying in 30 seconds... 2024-11-15 09:18:15.714 DEBUG (MainThread) [custom_components.mg_saic] Generic Charging Data response. 2024-11-15 09:18:15.715 WARNING (MainThread) [custom_components.mg_saic] Data invalid or generic: Generic charging response received. 2024-11-15 09:18:15.715 INFO (MainThread) [custom_components.mg_saic] Retrying in 40 seconds... 2024-11-15 09:18:59.476 DEBUG (MainThread) [custom_components.mg_saic] Generic Charging Data response. 2024-11-15 09:18:59.476 WARNING (MainThread) [custom_components.mg_saic] Data invalid or generic: Generic charging response received. 2024-11-15 09:18:59.476 INFO (MainThread) [custom_components.mg_saic] Retrying in 50 seconds... 2024-11-15 09:19:49.478 ERROR (MainThread) [custom_components.mg_saic] Failed to fetch data after retries. 2024-11-15 09:19:49.478 ERROR (MainThread) [custom_components.mg_saic] No previous data available. Returning empty data. 2024-11-15 09:19:49.479 DEBUG (MainThread) [custom_components.mg_saic] Finished fetching MG SAIC data update coordinator data in 169.206 seconds (success: True) 2024-11-15 09:19:49.480 ERROR (MainThread) [custom_components.mg_saic] Error setting up MG SAIC sensors: 'info' 2024-11-15 09:19:49.481 ERROR (MainThread) [custom_components.mg_saic] Error setting up MG SAIC binary sensors: 'info' 2024-11-15 09:19:49.482 ERROR (MainThread) [custom_components.mg_saic] Failed to retrieve vehicle info or status. 2024-11-15 09:19:49.483 ERROR (MainThread) [homeassistant.components.button] Error while setting up mg_saic platform for button Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/mg_saic/button.py", line 11, in async_setup_entry vin_info = coordinator.data["info"][0]


KeyError: 'info'
2024-11-15 09:19:49.485 ERROR (MainThread) [homeassistant.components.climate] Error while setting up mg_saic platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/mg_saic/climate.py", line 23, in async_setup_entry
    vin_info = coordinator.data["info"][0]
               ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'info'
2024-11-15 09:19:49.487 ERROR (MainThread) [homeassistant.components.number] Error while setting up mg_saic platform for number
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/mg_saic/number.py", line 11, in async_setup_entry
    vin_info = coordinator.data["info"][0]
               ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'info'
2024-11-15 09:19:49.489 ERROR (MainThread) [homeassistant.components.switch] Error while setting up mg_saic platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/mg_saic/switch.py", line 10, in async_setup_entry
    vin_info = coordinator.data["info"][0]
               ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'info'
2024-11-15 09:19:49.491 ERROR (MainThread) [homeassistant.components.lock] Error while setting up mg_saic platform for lock
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/mg_saic/lock.py", line 10, in async_setup_entry
    vin_info = coordinator.data["info"][0]
               ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'info'
2024-11-15 09:19:49.495 INFO (MainThread) [custom_components.mg_saic] Services registered for MG SAIC integration.
2024-11-15 09:19:49.496 INFO (MainThread) [custom_components.mg_saic] MG SAIC integration setup completed successfully.`

No device or entities were added.
x3e commented 1 week ago

Will retry with the newest beta

ad-ha commented 1 week ago

I will now release a new version. Will incorporate a logger for the generic responses, so we may see what might be laying down below that issue.

For me this is working, but let's see what might be your case.

Wait a moment and I will release the 0.4.7 with that change.

ad-ha commented 1 week ago

@x3e

New release 0.4.7 done.

Check if this fixes the issues. In case it does not, you now have a logger with the generic response, so we may see what might be causing the issue.