ad-ha / mg-saic-ha

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

[ISSUE] BEV Mileage Range Reporting 0 #41

Closed eximo84 closed 2 days ago

eximo84 commented 4 days ago

Home Assistant Version

2024.11.1

MG/SAIC Integration Version

0.5.2

Installation Method

HACS

Did you check for existing issues?

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

Describe the Issue

Mileage range is report 0 miles for my BEV.

Oddly the graph seems to track like this

IMG_4249

Logs

2024-11-22 22:56:08.499 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Type: BEV
2024-11-22 22:56:08.499 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Info: [VinInfo(bindTime=1718292462000, brandName='MG', colorName='Andes Grey', isActivate=False, isCurrentVehicle=True, isSubaccount=False, modelName='EH32 X8', modelYear='2023', name=None, series='EH32 L', vin='xxx', 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='1'), 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-22 22:56:08.499 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Status: VehicleStatusResp(basicVehicleStatus=BasicVehicleStatus(batteryVoltage=124, bonnetStatus=0, bootStatus=0, canBusActive=1, clstrDspdFuelLvlSgmt=0, currentJourneyId=884, currentJourneyDistance=10, dippedBeamStatus=0, driverDoor=0, driverWindow=0, engineStatus=0, extendedData1=53, extendedData2=0, exteriorTemperature=1, frontLeftSeatHeatLevel=0, frontLeftTyrePressure=57, frontRightSeatHeatLevel=0, frontRightTyrePressure=56, fuelLevelPrc=0, fuelRange=0, fuelRangeElec=0, handBrake=0, interiorTemperature=2, lastKeySeen=0, lockStatus=1, mainBeamStatus=0, mileage=49540, passengerDoor=0, passengerWindow=1, powerMode=0, rearLeftDoor=0, rearLeftTyrePressure=56, rearLeftWindow=1, rearRightDoor=0, rearRightTyrePressure=56, rearRightWindow=1, 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=0, timeStamp=0, wayPoint=GpsPosition.WayPoint(hdop=0, heading=0, position=GpsPosition.WayPoint.Position(altitude=0, latitude=0, longitude=0), satellites=0, speed=0)), statusTime=1732316153)
2024-11-22 22:56:08.499 DEBUG (MainThread) [custom_components.mg_saic] Vehicle Charging Data: ChrgMgmtDataResp(chrgMgmtData=ChrgMgmtData(bmsAdpPubChrgSttnDspCmd=0, bmsAltngChrgCrntDspCmd=4, bmsChrgCtrlDspCmd=2, bmsChrgOtptCrntReq=1023, bmsChrgOtptCrntReqV=1, bmsChrgSpRsn=0, bmsChrgSts=0, bmsDsChrgSpRsn=0, bmsEstdElecRng=301, bmsOnBdChrgTrgtSOCDspCmd=7, bmsPackCrnt=20000, bmsPackCrntV=0, bmsPackSOCDsp=530, bmsPackVol=1369, bmsPTCHeatReqDspCmd=2, bmsPTCHeatResp=0, bmsPTCHeatSpRsn=None, bmsReserCtrlDspCmd=2, bmsReserSpHourDspCmd=6, bmsReserSpMintueDspCmd=0, bmsReserStHourDspCmd=22, bmsReserStMintueDspCmd=0, ccuEleccLckCtrlDspCmd=2, ccuOffBdChrgrPlugOn=0, ccuOnbdChrgrPlugOn=0, chrgngAddedElecRng=0, chrgngAddedElecRngV=0, chrgngDoorOpenCnd=0, chrgngDoorPosSts=0, chrgngRmnngTime=1023, chrgngRmnngTimeV=1, chrgngSpdngTime=0, chrgngSpdngTimeV=0, clstrElecRngToEPT=148, disChrgngRmnngTime=1023, disChrgngRmnngTimeV=1, imcuChrgngEstdElecRng=315, imcuChrgngEstdElecRngV=0, imcuDschrgngEstdElecRng=139, imcuDschrgngEstdElecRngV=0, imcuVehElecRng=148, imcuVehElecRngV=0, onBdChrgrAltrCrntInptCrnt=0, onBdChrgrAltrCrntInptVol=0), rvsChargeStatus=RvsChargeStatus(chargingDuration=0, chargingElectricityPhase=None, chargingGunState=0, chargingPileID=None, chargingPileSupplier=None, chargingType=1, endTime=1732253810, extendedData1=None, extendedData2=None, extendedData3=None, extendedData4=None, fotaLowestVoltage=None, fuelRangeElec=1480, lastChargeEndingPower=510, mileage=49540, mileageOfDay=400, mileageSinceLastCharge=400, powerUsageOfDay=146, powerUsageSinceLastCharge=126, realtimePower=384, startTime=1732235517, staticEnergyConsumption=None, totalBatteryCapacity=725, workingCurrent=20000, workingVoltage=1369))
2024-11-22 22:56:08.499 DEBUG (MainThread) [custom_components.mg_saic] Finished fetching MG SAIC data update coordinator data in 18.817 seconds (success: True)

Additional Context

Sorry to log another issue 🙂

ad-ha commented 4 days ago

Hi @eximo84

No worries on my end. I'm sorry for the issues you are facing.

So, looking into the log, seems like you are getting 2 different responses from the API:

Currently the sensor gets the data from the Vehicle Status, thus you are getting that info.

I never saw a similar response from the API, only on the SOC. For the next version I will add a compare probe between both values and will discard any value equal to 0, and get only the one greater than 0. This shall be an easy fix and we will be able to have a fallback.

If you notice this behavior on more sensors, please let me know.

Thanks for pointing this out.

Cheers

eximo84 commented 3 days ago

Just checking now, the only sensor that show 0 would be this:

However I've noticed this sensor being off:

Currently reporting 126kwh however mileage since last charge is only 26 miles (40km). The battery is only 51kwh in size.

ad-ha commented 3 days ago

However I've noticed this sensor being off:\n\nsensor.mg_eh32_x8_power_usage_since_last_charge\nCurrently reporting 126kwh however mileage since last charge is only 26 miles (40km). The battery is only 51kwh in size.

@eximo84

I noticed a similar behavior on my car as well on that sensor. I just don't know yet what coefficient shall be used to get a proper value.

Still need to get some math to try to understand those values.

Thanks for pointing it out.

ad-ha commented 2 days ago

@eximo84 The issue is now solved on 0.6.0. I hope 😄

On the power usage, I am trying to figure that out and see how to get a meaningful value from the data provided by the API.