Skip to content

Small changes to handle battery heating #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

magior
Copy link
Contributor

@magior magior commented Dec 20, 2023

  • added is_battery_heating to OtaChrgMangDataResp
  • set ptcHeatReq to 2 to turn off battery heating (tested on MG4 2022)

- added is_battery_heating to OtaChrgMangDataResp
- set ptcHeatReq to 2 to turn off battery heating (tested on MG4 2022)
@tosate
Copy link
Contributor

tosate commented Dec 31, 2023

Thank you @magior for your contribution. I am still hesitating a bit with the merging since I am not sure about values for disabling and enabling of the battery heating.

The current implementation is:

  • 0: deactivate battery heating
  • 1: activate battery heating

I have to admit that I didn't test it on my ZS yet.

On your MG4 2022 it should be

  • 1: activate battery heating
  • 2: deactivate battery heating

@tosate
Copy link
Contributor

tosate commented Dec 31, 2023

@nanomad do you have experience with the values for activating battery heating?

@magior
Copy link
Contributor Author

magior commented Dec 31, 2023

I double-checked my value for MG4 with the native app (since it's difficult to understand if the battery is heating for real).

@tosate, on your ZS, when inactive, which value you read on bmsPTCHeatResp? If you read different values, we need to change behavior on a per-vehicle basis.

On MG4, to test it, the battery has to be under 7/8 degrees.

@tosate
Copy link
Contributor

tosate commented Dec 31, 2023

This is how my charge state response looks like:

{
  "applicationData": {
    "bmsReserCtrlDspCmd": 2,
    "bmsReserStHourDspCmd": 10,
    "bmsReserStMintueDspCmd": 0,
    "bmsReserSpHourDspCmd": 15,
    "bmsReserSpMintueDspCmd": 0,
    "bmsOnBdChrgTrgtSOCDspCmd": 7,
    "bmsEstdElecRng": 249,
    "bmsAltngChrgCrntDspCmd": 0,
    "bmsChrgCtrlDspCmd": 2,
    "chrgngRmnngTime": 1023,
    "chrgngRmnngTimeV": 1,
    "bmsChrgOtptCrntReq": 1023,
    "bmsPackCrnt": 20000,
    "bmsPackVol": 1599,
    "bmsPackSOCDsp": 610,
    "bmsChrgSts": 5,
    "bmsChrgSpRsn": 0,
    "clstrElecRngToEPT": 149,
    "bmsPTCHeatReqDspCmd": 0,
    "chargeStatus": {
      "realtimePower": 442,
      "chargingGunState": true,
      "fuelRangeElec": 1490,
      "chargingType": 1,
      "mileage": xxxxx,
      "startTime": 1703953218,
      "endTime": 1703976515,
      "workingCurrent": 20000,
      "workingVoltage": 1599,
      "mileageSinceLastCharge": 0,
      "powerUsageSinceLastCharge": 299,
      "mileageOfDay": 0,
      "powerUsageOfDay": 898,
      "chargingDuration": 0,
      "lastChargeEndingPower": 742,
      "totalBatteryCapacity": 725
    },
    "bmsAdpPubChrgSttnDspCmd": 1,
    "bmsPTCHeatSpRsn": 0
  },
  "body": {
    "applicationID": "516",
    "eventCreationTime": 1704034074,
    "messageID": 6,
    "applicationDataLength": 71,
    "applicationDataProtocolVersion": 768,
    "uid": "00000000000000000000000000000000000000000000000000",
    "token": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXX",
    "vin": "LSJXXXXXXXXXXXXXX",
    "eventID": 537282789,
    "ackRequired": false,
    "applicationDataEncoding": "perUnaligned",
    "testFlag": 2,
    "result": 0,
    "ulMessageCounter": 0,
    "dlMessageCounter": 1,
    "ackMessageCounter": 0
  },
  "header": {
    "protocolVersion": 48,
    "dispatcherMessageLength": 123,
    "dispatcherBodyEncoding": 0
  }
}

I don't even get the optional field bmsPTCHeatResp. In the native app I cannot simply switch on battery heating. I can only schedule the heating for a certain time.

@magior
Copy link
Contributor Author

magior commented Dec 31, 2023

Sorry, my mistake. You have bmsPTCHeatReqDspCmd with 0 as the value.
On MG4, I receive 2 as a value when the battery heating is off and 1 when it is on, and I need to use the same values to turn the heater on and off.

It seems that we have to handle the vehicle type. Could you do some tests on your ZS to verify if it can control the instant turn-on of the battery heater and check the value of the response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants