Skip to content

MG ZS EV: Cable-lock status not reflected, does not change even though successful locking is reported #271

Closed

Description

@jkrenzer

Hi!

With our MG ZS saic/${user}/vehicles/${vin}/drivetrain/chargingCableLock is always False even when the cable-lock is clearly audible engaged. Toggeling the switch yields the message in the logs, that the cable will be locked/unlocked and Success is reported in saic/${user}/vehicles/${vin}/drivetrain/chargingCableLock/result. Using saic/${user}/vehicles/${vin}/drivetrain/chargingCableLock/set yields the same.

As of now, we were not able to clearly determine if the car reacts to the command and is just not reporting the locking status or if it does not do anything at all. Our ZS is quite slow to react on manual locking/unlocking requests even using the touch interface and likes to lock and unlock on it's own. We'll keep trying to make certain.

So it might be, the ZS does not support reporting the status or it is ignoring the topic completely. Maybe some upstream research in the API is needed to clarify this.

Cheers,

Jörn

Activity

  1. nanomad commented on Oct 22, 2024

    @nanomad
    Contributor
  2. jkrenzer commented on Oct 22, 2024

    @jkrenzer
    Author

    Otherwise I'll need some api dumps (they can be enabled and pushed on mqtt) with different cable states

    I would prefer using the mqtt-gateway if possible to colleect the dump, as the vehicle and our own app using the mqtt is currently in use. Do you mean MQTT_LOG_LEVEL=DEBUG or something else? A search did not turn up anything akin to "api dump" in the repo.

  3. nanomad commented on Dec 5, 2024

    @nanomad
    Contributor

    You can set
    PUBLISH_RAW_API_DATA_ENABLED=True

    This will publish API Request/Response to MQTT

  4. jkrenzer commented on Dec 5, 2024

    @jkrenzer
    Author

    PUBLISH_RAW_API_DATA_ENABLED=True

    BTW: Is there an entry in the documentation for this? Very helpful feature, thanks!

    For people using the homeassistant addon and finding this issue while searching: You can add

    PUBLISH_RAW_API_DATA_ENABLED: true

    in the yaml config view of the addon.


    So, here some of the api-info I could collect.

    Request when pressing lock:

    {
      "path": "/vehicle/charging/control",
      "query": {},
      "body": {
        "chrgCtrlReq": 0,
        "tboxEleccLckCtrlReq": 1,
        "tboxV2XReq": 0,
        "vin": "REDACTED"
      },
      "headers": {
        "host": "gateway-mg-eu.soimt.com",
        "event-id": "1342824349",
        "content-length": "136",
        "content-type": "application/json"
      }
    }

    Followed by mutliple errors:

    {
      "path": "/vehicle/charging/control",
      "query": {},
      "body": {
        "code": 4,
        "message": "The remote control instruction failed, please try again later."
      },
      "headers": {
        "date": "Thu, 05 Dec 2024 19:45:27 GMT",
        "content-type": "application/json",
        "content-length": "85",
        "connection": "keep-alive",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733427927094",
        "app-verification-string": "REDACTED"
      }
    }

    And then suddenly:

    {
      "path": "/vehicle/charging/control",
      "query": {},
      "body": {
        "code": 0,
        "data": {
          "chrgCtrlDspCmd": 1,
          "rvcReqSts": 3,
          "chrgCtrlResp": 0
        },
        "message": "success"
      },
      "headers": {
        "date": "Thu, 05 Dec 2024 19:45:39 GMT",
        "content-type": "application/json",
        "content-length": "89",
        "connection": "keep-alive",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733427939353",
        "app-verification-string": "REDACTED"
      }
    }

    But the lock status stays false:

    saic/REDACTED/vehicles/REDACTED/drivetrain/chargingCableLock = False
    saic/REDACTED/vehicles/REDACTED/drivetrain/chargingCableLockresult = Success
    saic/REDACTED/vehicles/REDACTED/drivetrain/chargingCableLock/set = True
    
  5. nanomad commented on Dec 5, 2024

    @nanomad
    Contributor

    Thanks, can you repeat the test this time checking the following topics?

    saic/_internal/api/vehicle/charging/mgmtData/response
    saic/_internal/api/vehicle/control/response
    saic/_internal/api/vehicle/status/response

    (Just pick the last value after it settles, the in between errors are supposed to be there since the API requires a few retries by design)

  6. jkrenzer commented on Dec 5, 2024

    @jkrenzer
    Author

    Thanks, can you repeat the test this time checking the following topics?

    saic/_internal/api/vehicle/charging/mgmtData/response saic/_internal/api/vehicle/control/response saic/_internal/api/vehicle/status/response

    (Just pick the last value after it settles, the in between errors are supposed to be there since the API requires a few retries by design)

    Yes, I will have a look next time the vehicle is loading.

  7. jkrenzer commented on Dec 12, 2024

    @jkrenzer
    Author

    So, I tried my best to capture all consecutive messages coming when locking is enabled. Hope I caught everything. Some topics have multiple messages, the order of the json objects in this case is descending in time.

    saic/_internal/api/vehicle/charging/mgmtData/response:

    {
      "path": "/vehicle/charging/mgmtData",
      "query": {
        "vin": [
          "REDACTED"
        ]
      },
      "body": {
        "code": 0,
        "data": {
          "rvsChargeStatus": {
            "mileageSinceLastCharge": 0,
            "totalBatteryCapacity": 725,
            "workingVoltage": 1559,
            "chargingDuration": 7735,
            "chargingType": 6,
            "fuelRangeElec": 2730,
            "realtimePower": 592,
            "workingCurrent": 19498,
            "chargingGunState": 1,
            "mileageOfDay": 560,
            "startTime": 1733989813,
            "endTime": 1733954768,
            "powerUsageOfDay": 1119,
            "powerUsageSinceLastCharge": 0,
            "mileage": 117830
          },
          "chrgMgmtData": {
            "clstrElecRngToEPT": 273,
            "bmsChrgSts": 1,
            "bmsPackSOCDsp": 817,
            "bmsPTCHeatReqDspCmd": 2,
            "bmsPackCrnt": 19498,
            "bmsChrgCtrlDspCmd": 1,
            "bmsReserStMintueDspCmd": 0,
            "bmsOnBdChrgTrgtSOCDspCmd": 6,
            "bmsEstdElecRng": 304,
            "bmsReserCtrlDspCmd": 2,
            "bmsPTCHeatSpRsn": 0,
            "bmsChrgOtptCrntReq": 155,
            "bmsReserStHourDspCmd": 22,
            "bmsPackVol": 1559,
            "bmsReserSpHourDspCmd": 6,
            "bmsAdpPubChrgSttnDspCmd": 2,
            "chrgngRmnngTimeV": 0,
            "bmsReserSpMintueDspCmd": 0,
            "bmsAltngChrgCrntDspCmd": 0,
            "bmsChrgSpRsn": 0,
            "chrgngRmnngTime": 39
          }
        },
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:59:09 GMT",
        "content-type": "application/json",
        "content-length": "891",
        "connection": "keep-alive",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997549510",
        "app-verification-string": "2638cbf6569227fcd91eb98b9df8c925c1e466da3e91ff828ce5c87536eab93a"
      }
    }
    
    {
      "path": "/vehicle/charging/mgmtData",
      "query": {
        "vin": [
          "REDACTED"
        ]
      },
      "body": {
        "code": 0,
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:59:06 GMT",
        "content-type": "application/json",
        "content-length": "30",
        "connection": "keep-alive",
        "event-id": "955639740",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997546411",
        "app-verification-string": "a74890b631c8c5aabd65cc60be4f38f5ff021e012ce089f5d78145673720b45a"
      }
    }
    
    {
      "path": "/vehicle/charging/mgmtData",
      "query": {
        "vin": [
          "REDACTED"
        ]
      },
      "body": {
        "code": 0,
        "data": {
          "rvsChargeStatus": {
            "mileageSinceLastCharge": 0,
            "totalBatteryCapacity": 725,
            "workingVoltage": 1556,
            "chargingDuration": 7614,
            "chargingType": 6,
            "fuelRangeElec": 2710,
            "realtimePower": 589,
            "workingCurrent": 19498,
            "chargingGunState": 1,
            "mileageOfDay": 560,
            "startTime": 1733989813,
            "endTime": 1733954768,
            "powerUsageOfDay": 1119,
            "powerUsageSinceLastCharge": 0,
            "mileage": 117830
          },
          "chrgMgmtData": {
            "clstrElecRngToEPT": 271,
            "bmsChrgSts": 1,
            "bmsPackSOCDsp": 812,
            "bmsPTCHeatReqDspCmd": 2,
            "bmsPackCrnt": 19498,
            "bmsChrgCtrlDspCmd": 1,
            "bmsReserStMintueDspCmd": 0,
            "bmsOnBdChrgTrgtSOCDspCmd": 6,
            "bmsEstdElecRng": 304,
            "bmsReserCtrlDspCmd": 2,
            "bmsPTCHeatSpRsn": 0,
            "bmsChrgOtptCrntReq": 156,
            "bmsReserStHourDspCmd": 22,
            "bmsPackVol": 1556,
            "bmsReserSpHourDspCmd": 6,
            "bmsAdpPubChrgSttnDspCmd": 2,
            "chrgngRmnngTimeV": 0,
            "bmsReserSpMintueDspCmd": 0,
            "bmsAltngChrgCrntDspCmd": 0,
            "bmsChrgSpRsn": 0,
            "chrgngRmnngTime": 41
          }
        },
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:57:08 GMT",
        "content-type": "application/json",
        "content-length": "891",
        "connection": "keep-alive",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997428846",
        "app-verification-string": "11e02d9d4396820dc71abb6a255625daca7b17e737cba7925cb7c34d7f9eacfe"
      }
    }

    saic/_internal/api/vehicle/control/response:

    {
      "path": "/vehicle/control",
      "query": {},
      "body": {
        "code": 0,
        "data": {
          "basicVehicleStatus": {
            "frontRightSeatHeatLevel": 0,
            "steeringWheelHeatFailureReason": 0,
            "rearRightDoor": 0,
            "sideLightStatus": 0,
            "frontLeftTyrePressure": 67,
            "driverWindow": 0,
            "rearRightTyrePressure": 66,
            "rmtHtdRrWndSt": 0,
            "canBusActive": 1,
            "frontRightTyrePressure": 66,
            "driverDoor": 0,
            "frontLeftSeatHeatLevel": 0,
            "lockStatus": 1,
            "powerMode": 0,
            "engineStatus": 0,
            "exteriorTemperature": 0,
            "fuelRange": 2100,
            "extendedData2": 0,
            "currentJourneyId": 1114,
            "extendedData1": 64,
            "mileage": 117270,
            "fuelLevelPrc": 0,
            "steeringHeatLevel": 0,
            "interiorTemperature": 10,
            "batteryVoltage": 132,
            "passengerDoor": 0,
            "clstrDspdFuelLvlSgmt": 0,
            "mainBeamStatus": 0,
            "remoteClimateStatus": 0,
            "vehElecRngDsp": 0,
            "sunroofStatus": 1,
            "currentJourneyDistance": 120,
            "timeOfLastCANBUSActivity": 1733961055,
            "bonnetStatus": 0,
            "bootStatus": 0,
            "fuelRangeElec": 2100,
            "lastKeySeen": 24163,
            "rearRightWindow": 0,
            "vehicleAlarmStatus": 2,
            "wheelTyreMonitorStatus": 0,
            "rearLeftTyrePressure": 66,
            "rearLeftDoor": 0,
            "passengerWindow": 0,
            "rearLeftWindow": 0,
            "dippedBeamStatus": 0
          },
          "gpsPosition": {
            "timeStamp": 1733961056,
            "gpsStatus": 2,
            "wayPoint": {
              "satellites": 6,
              "heading": 0,
              "position": {
                "altitude": 0,
                "latitude": 0,
                "longitude": 0
              },
              "hdop": 11,
              "speed": 0
            }
          },
          "rvcReqType": "AQ==",
          "failureType": 0,
          "rvcReqSts": "Ag=="
        },
        "message": "success"
      },
      "headers": {
        "date": "Wed, 11 Dec 2024 23:50:59 GMT",
        "content-type": "application/json",
        "content-length": "1260",
        "connection": "keep-alive",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733961059591",
        "app-verification-string": "42f6bffcfcb56eb9ab02416d149f12989a5cdaa6f554ff34af29e065cb3c4aff"
      }
    }

    saic/_internal/api/vehicle/status/response:

    {
      "path": "/vehicle/status",
      "query": {
        "vin": [
          "REDACTED"
        ],
        "vehStatusReqType": [
          "2"
        ]
      },
      "body": {
        "code": 0,
        "data": {
          "basicVehicleStatus": {
            "frontRightSeatHeatLevel": 0,
            "steeringWheelHeatFailureReason": 0,
            "rearRightDoor": 0,
            "sideLightStatus": 0,
            "frontLeftTyrePressure": 68,
            "driverWindow": 0,
            "rearRightTyrePressure": 65,
            "rmtHtdRrWndSt": 0,
            "canBusActive": 1,
            "frontRightTyrePressure": 66,
            "driverDoor": 0,
            "frontLeftSeatHeatLevel": 0,
            "lockStatus": 1,
            "powerMode": 0,
            "engineStatus": 0,
            "exteriorTemperature": 0,
            "fuelRange": 2730,
            "extendedData2": 1,
            "currentJourneyId": 1120,
            "extendedData1": 82,
            "mileage": 117830,
            "fuelLevelPrc": 0,
            "steeringHeatLevel": 0,
            "interiorTemperature": 10,
            "batteryVoltage": 148,
            "passengerDoor": 0,
            "clstrDspdFuelLvlSgmt": 0,
            "mainBeamStatus": 0,
            "remoteClimateStatus": 0,
            "vehElecRngDsp": 0,
            "sunroofStatus": 0,
            "currentJourneyDistance": 0,
            "bonnetStatus": 0,
            "handBrake": 0,
            "bootStatus": 0,
            "fuelRangeElec": 2730,
            "lastKeySeen": 24163,
            "rearRightWindow": 0,
            "vehicleAlarmStatus": 2,
            "wheelTyreMonitorStatus": 0,
            "rearLeftTyrePressure": 66,
            "rearLeftDoor": 0,
            "passengerWindow": 0,
            "rearLeftWindow": 0,
            "dippedBeamStatus": 0
          },
          "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": {
            "timeStamp": 1733997543,
            "gpsStatus": 2,
            "wayPoint": {
              "satellites": 11,
              "heading": 198,
              "position": {
                "altitude": 0,
                "latitude": 0,
                "longitude": 0
              },
              "hdop": 5,
              "speed": 0
            }
          },
          "statusTime": 1733997545
        },
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:59:06 GMT",
        "content-type": "application/json",
        "content-length": "1376",
        "connection": "keep-alive",
        "event-id": "1865151625",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997546314",
        "app-verification-string": "17e7f05466d1fc01688914a6005b359a70f973c71bdb9b5e506cb4f16ad6f92c"
      }
    }
    
    {
      "path": "/vehicle/status",
      "query": {
        "vin": [
          "REDACTED"
        ],
        "vehStatusReqType": [
          "2"
        ]
      },
      "body": {
        "code": 0,
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:59:03 GMT",
        "content-type": "application/json",
        "content-length": "30",
        "connection": "keep-alive",
        "event-id": "1865151625",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997543238",
        "app-verification-string": "ddf199ed5886ae9c0b79b29750edf1161fe1b53fb9415cc4ac3404fa645b8b67"
      }
    }
    
    {
      "path": "/vehicle/status",
      "query": {
        "vin": [
          "REDACTED"
        ],
        "vehStatusReqType": [
          "2"
        ]
      },
      "body": {
        "code": 0,
        "data": {
          "basicVehicleStatus": {
            "frontRightSeatHeatLevel": 0,
            "steeringWheelHeatFailureReason": 0,
            "rearRightDoor": 0,
            "sideLightStatus": 0,
            "frontLeftTyrePressure": 68,
            "driverWindow": 0,
            "rearRightTyrePressure": 65,
            "rmtHtdRrWndSt": 0,
            "canBusActive": 1,
            "frontRightTyrePressure": 66,
            "driverDoor": 0,
            "frontLeftSeatHeatLevel": 0,
            "lockStatus": 1,
            "powerMode": 0,
            "engineStatus": 0,
            "exteriorTemperature": 0,
            "fuelRange": 2710,
            "extendedData2": 1,
            "currentJourneyId": 1120,
            "extendedData1": 81,
            "mileage": 117830,
            "fuelLevelPrc": 0,
            "steeringHeatLevel": 0,
            "interiorTemperature": -128,
            "batteryVoltage": 148,
            "passengerDoor": 0,
            "clstrDspdFuelLvlSgmt": 0,
            "mainBeamStatus": 0,
            "remoteClimateStatus": 0,
            "vehElecRngDsp": 0,
            "sunroofStatus": 1,
            "currentJourneyDistance": 0,
            "bonnetStatus": 0,
            "handBrake": 0,
            "bootStatus": 0,
            "fuelRangeElec": 2710,
            "lastKeySeen": 24163,
            "rearRightWindow": 0,
            "vehicleAlarmStatus": 2,
            "wheelTyreMonitorStatus": 0,
            "rearLeftTyrePressure": 66,
            "rearLeftDoor": 0,
            "passengerWindow": 0,
            "rearLeftWindow": 0,
            "dippedBeamStatus": 0
          },
          "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": {
            "timeStamp": 1733997419,
            "gpsStatus": 2,
            "wayPoint": {
              "satellites": 11,
              "heading": 198,
              "position": {
                "altitude": 0,
                "latitude": 0,
                "longitude": 0
              },
              "hdop": 5,
              "speed": 0
            }
          },
          "statusTime": 1733997421
        },
        "message": "success"
      },
      "headers": {
        "date": "Thu, 12 Dec 2024 09:57:05 GMT",
        "content-type": "application/json",
        "content-length": "1378",
        "connection": "keep-alive",
        "event-id": "1905558288",
        "app-content-encrypted": "1",
        "original-content-type": "application/json",
        "app-send-date": "1733997425640",
        "app-verification-string": "fead41d0ce726b5f4dd7db1199cb55c1a2f4e8bb066c6a2e6ef314c741d14da0"
      }
    }
  8. nanomad commented on Dec 15, 2024

    @nanomad
    Contributor

    Uhm unfortunately @jkrenzer I don't see any value I can use to deduce the lock state... I'll keep this open as a reminder for the future in case we discover something new

  9. jkrenzer commented on Dec 16, 2024

    @jkrenzer
    Author

    Thanks. I am not entirely sure yet, but maybe it is an "optimistic" action (e.g. no state, just triggering) for the ZS, as in the car itself there is also only an unlock button and the lock engages by itself when the cable is plugged into the wallbox/charger. Will try to investigate, when the vehicle is not needed so frequently.

  10. nanomad commented on Oct 17, 2026

    @nanomad
    Contributor

    Thanks again for the dumps, they made this clear. The charge management response from the ZS has no ccuEleccLckCtrlDspCmd field. The other models send it, with 1 for locked and 2 for unlocked. Without the field the gateway fell back to "unlocked", so the lock state was always False. The car does not report it, so the gateway cannot read it back.

    #477 changes two things:

    • The topic is no longer published when the car does not report the lock, so Home Assistant shows "unknown" and not a wrong "unlocked".
    • After a lock or unlock command succeeds, the gateway publishes the commanded state. On your car that is what you will see, not the real state. A manual lock or unlock is not reflected.

    An older version already left a retained False on .../drivetrain/chargingCableLock. It stays until your first lock or unlock command. To clear it, publish an empty retained message to that topic.

  11. added this to the Version 0.13.0 milestone on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions