ad-ha/mg-saic-ha

[ISSUE] MG5 EU Exterior Temperature generic check causes integration to go unavailable

Opened this issue · 5 comments

Home Assistant Version

2024.12.4

MG/SAIC Integration Version

0.8.2

Installation Method

HACS

Did you check for existing issues?

  • Yes, I have checked for existing issues
  • No, I have not checked for existing issues

Did you enable debug logging before and are ready to post logs?

  • Yes, I have enabled debug logging
  • No, I have not enabled debug logging

Describe the Issue

The check for generic data on the ExternalTemperature returned data causes the integration to report unavailable for most of the sensors. I don't think that the MG5 has external temp reported via the API (iSmart does not display it, only internal) so the test for generic data always fails, causing the tool to give up and not display the remaining data.

Removing the external check from coordinator.py solves the issue, so it might require a vehicle type check?

Many thanks for the work in the integration - it otherwise works really well!

Alex

Logs

No response

Additional Context

No response

ad-ha commented

Hi @madhulk81

Thabks for pointing that out and for letting me know about this.

Do you have a log for your MG5, so I may see the kind of vehicle response and vehicle info for that model?

That might help on setting up the checks or on how to find a way to address it.

Cheers

Hope this is helpful:

2024-12-29 12:56:26.844 DEBUG (MainThread) [custom_components.mg_saic] No changes detected in monitored keys or charging status.
2024-12-29 12:56:26.848 DEBUG (MainThread) [custom_components.mg_saic] Sensor Exterior Temperature has invalid temperature value -128
2024-12-29 12:56:26.849 DEBUG (MainThread) [custom_components.mg_saic] Sensor Interior Temperature has invalid temperature value -128
2024-12-29 12:56:26.858 DEBUG (MainThread) [custom_components.mg_saic] Evaluating interval adjustment: Powered On: False, Charging: False, Idle Duration: 1 day, 21:37:11.795263, Activity Duration: 20:15:14.487652
2024-12-29 12:56:26.858 DEBUG (MainThread) [custom_components.mg_saic] No recent activity. Using default update interval.
2024-12-29 12:56:26.858 DEBUG (MainThread) [custom_components.mg_saic] Adjusted update interval: 1:00:00.
2024-12-29 12:56:26.858 DEBUG (MainThread) [custom_components.mg_saic] Next update scheduled in 1:00:00.
2024-12-29 12:56:26.859 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Type: BEV
2024-12-29 12:56:26.859 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Info: [VinInfo(bindTime=1735040752000, brandName='MG', colorName='FLARE RED', isActivate=False, isCurrentVehicle=True, isSubaccount=True, modelName='MG5 Electric', modelYear='2022', name=None, series='EP22 UK', vin='LSJE24094PG015218', 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='1'), VehicleModelConfiguration(itemCode='ENERGY', itemName='ENERGY', itemValue='0'), 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='1'), VehicleModelConfiguration(itemCode='BTKEY', itemName='BTKEY', itemValue='0'), VehicleModelConfiguration(itemCode='BType', itemName='Battery', itemValue='1'), VehicleModelConfiguration(itemCode='SBH', itemName='SBH', itemValue='0'), VehicleModelConfiguration(itemCode='BHI', itemName='BHI', itemValue='0'), VehicleModelConfiguration(itemCode='ROV', itemName='ROV', itemValue='25857')])]
2024-12-29 12:56:26.860 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Status: VehicleStatusResp(basicVehicleStatus=BasicVehicleStatus(batteryVoltage=125, bonnetStatus=0, bootStatus=0, canBusActive=1, clstrDspdFuelLvlSgmt=0, currentJourneyId=2990, currentJourneyDistance=20, dippedBeamStatus=0, driverDoor=0, driverWindow=0, engineStatus=0, extendedData1=97, extendedData2=0, exteriorTemperature=-128, frontLeftSeatHeatLevel=None, frontLeftTyrePressure=52, frontRightSeatHeatLevel=None, frontRightTyrePressure=53, fuelLevelPrc=0, fuelRange=2850, fuelRangeElec=2850, handBrake=0, interiorTemperature=-128, lastKeySeen=30819, lockStatus=1, mainBeamStatus=0, mileage=372190, passengerDoor=0, passengerWindow=0, powerMode=0, rearLeftDoor=0, rearLeftTyrePressure=53, rearLeftWindow=0, rearRightDoor=0, rearRightTyrePressure=54, rearRightWindow=0, remoteClimateStatus=0, rmtHtdRrWndSt=0, sideLightStatus=0, steeringHeatLevel=0, steeringWheelHeatFailureReason=0, sunroofStatus=0, timeOfLastCANBUSActivity=None, vehElecRngDsp=0, vehicleAlarmStatus=2, wheelTyreMonitorStatus=0), extendedVehicleStatus=ExtendedVehicleStatus(alertDataSum=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), gpsPosition=GpsPosition(gpsStatus=2, timeStamp=1735476977, wayPoint=GpsPosition.WayPoint(hdop=7, heading=278, position=GpsPosition.WayPoint.Position(altitude=42, latitude=52209059, longitude=-2169073), satellites=6, speed=0)), statusTime=1735476977)
2024-12-29 12:56:26.860 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Charging Data: ChrgMgmtDataResp(chrgMgmtData=ChrgMgmtData(bmsAdpPubChrgSttnDspCmd=2, bmsAltngChrgCrntDspCmd=0, bmsChrgCtrlDspCmd=2, bmsChrgOtptCrntReq=1023, bmsChrgOtptCrntReqV=None, bmsChrgSpRsn=0, bmsChrgSts=0, bmsDsChrgSpRsn=None, bmsEstdElecRng=296, bmsOnBdChrgTrgtSOCDspCmd=7, bmsPackCrnt=20000, bmsPackCrntV=None, bmsPackSOCDsp=968, bmsPackVol=1598, bmsPTCHeatReqDspCmd=0, bmsPTCHeatResp=None, bmsPTCHeatSpRsn=0, bmsReserCtrlDspCmd=2, bmsReserSpHourDspCmd=6, bmsReserSpMintueDspCmd=0, bmsReserStHourDspCmd=22, bmsReserStMintueDspCmd=0, ccuEleccLckCtrlDspCmd=None, ccuOffBdChrgrPlugOn=None, ccuOnbdChrgrPlugOn=None, chrgngAddedElecRng=None, chrgngAddedElecRngV=None, chrgngDoorOpenCnd=None, chrgngDoorPosSts=None, chrgngRmnngTime=1023, chrgngRmnngTimeV=1, chrgngSpdngTime=None, chrgngSpdngTimeV=None, clstrElecRngToEPT=285, disChrgngRmnngTime=None, disChrgngRmnngTimeV=None, imcuChrgngEstdElecRng=None, imcuChrgngEstdElecRngV=None, imcuDschrgngEstdElecRng=None, imcuDschrgngEstdElecRngV=None, imcuVehElecRng=None, imcuVehElecRngV=None, onBdChrgrAltrCrntInptCrnt=None, onBdChrgrAltrCrntInptVol=None), rvsChargeStatus=RvsChargeStatus(chargingDuration=0, chargingElectricityPhase=None, chargingGunState=0, chargingPileID=None, chargingPileSupplier=None, chargingType=1, endTime=1735448068, extendedData1=None, extendedData2=None, extendedData3=None, extendedData4=None, fotaLowestVoltage=None, fuelRangeElec=2850, lastChargeEndingPower=719, mileage=372190, mileageOfDay=50, mileageSinceLastCharge=50, powerUsageOfDay=62, powerUsageSinceLastCharge=17, realtimePower=702, startTime=0, staticEnergyConsumption=None, totalBatteryCapacity=725, workingCurrent=20000, workingVoltage=1598))
2024-12-29 12:56:26.861 DEBUG (MainThread) [custom_components.mg_saic] State updated: Is Powered On: False, Is Charging: False, Last Powered On Time: 2024-12-27 15:19:15.062892+00:00, Last Powered Off Time: 2024-12-27 15:19:15.062875+00:00, Last Vehicle Activity: 2024-12-28 16:41:12.370486+00:00, Update Interval: 1:00:00
2024-12-29 12:56:26.861 DEBUG (MainThread) [custom_components.mg_saic] Finished fetching MG SAIC data update coordinator data in 12.744 seconds (success: True)
2024-12-29 12:56:26.861 DEBUG (MainThread) [custom_components.mg_saic] Next update scheduled in 1:00:00.
2024-12-29 12:56:26.866 DEBUG (MainThread) [custom_components.mg_saic] Sensor Exterior Temperature has invalid temperature value -128
2024-12-29 12:56:26.868 DEBUG (MainThread) [custom_components.mg_saic] Sensor Interior Temperature has invalid temperature value -128

ad-ha commented

Thanks @madhulk81

I did not think of that to be honest. I thought that you could get the data for every vehicle.

Looking at your logs, though, seems like you are getting generic responses for both temperature sensors:

  • exteriorTemperature=-128
  • interiorTemperature=-128

So even if I get rid of the exteriorTemperature verification, under your log, you would still get the same error as the interior temperature returns also a "-128ºC" reading.

ad-ha commented

Anyhow, I removed that check for next release.

Thanks @ad-ha

Just to let you know - for the MG5 exteriorTemperature never works - always returns -128. The log I sent you showed internet as -128, but does work intermittently, depending on the API's mood :)

Therefore, if you do plan on checking vehicle type, or checking these values, then interior will work sometimes, but external will never work.

Thanks again!