Skip to main content

SAIC Python client library

About

A Python package for interacting with the MG iSmart API.

MG iSmart is the connectivity system in your MG car (MG5 MG4, ZS, MGS5, MGS6 ...).

Supported functionality (partial list, check the code for more)

  • login
  • set alarm switches
  • get message list
  • get vehicle status
  • get cached vehicle status (SAIC's stored copy; does not wake the car)
  • get charging status
  • lock vehicle
  • unlock vehicle
  • start rear window heating
  • stop rear window heating
  • remote climate
  • heated seats: each seat on its own, front and rear, plus rear seat status
  • heated steering wheel
  • door windows: close, ventilate or fully open

Push notifications

The optional saic_ismart_client_ng.push package receives SAIC's real-time notifications (vehicle started, charging finished, ...) instead of polling the message queue. Install it with pip install "mg-saic-client[push]".

It registers as an Android device with Google, keeps a connection to Google's push servers open, and binds that registration to your SAIC session at login:

from saic_ismart_client_ng import SaicApi
from saic_ismart_client_ng.model import SaicApiConfiguration
from saic_ismart_client_ng.push import PushMessage, SaicPushClient


async def on_push(message: PushMessage) -> None:
    if message.is_vehicle_start:
        print("Car started:", message.vin, message.sent_at)


push = SaicPushClient(on_message=on_push)
credentials = await push.start()  # registers on first use; keep `credentials` to reuse

config = SaicApiConfiguration("user@example.com", "password", push_token=credentials.token)
api = SaicApi(config)
await api.login()  # SAIC now sends pushes for this account to `push`

Things worth knowing:

  • SAIC allows one session per account, and push follows the most recent login. Logging in anywhere else (including the phone app) moves pushes there. Use a separate account for the integration.
  • A registration that has been in use for several days can stop receiving vehicle pushes while still looking healthy. SaicPushClient.renew() swaps in a fresh identity; log in again with the new push_token afterwards.
  • Every message is acknowledged to Google, and persistent_ids can be saved between runs so a restart does not see old messages again. Google keeps undelivered messages for up to 28 days, so check PushMessage.age_seconds() before acting on one.
  • A connected client does not prove pushes are arriving. Keep polling as a slow fallback.
  • If Google refuses the login several times in a row, credentials_rejected becomes true (and on_credentials_rejected fires once). Call renew() and log in to SAIC again with the new token. Plain network failures do not count.

Notification switches

The notifications in the app (Vehicle Fault, Vehicle Start, ...) are switches on the vehicle. SAIC seems to start sending some messages, finished charging among them, only when a switch changes from off to on, not when it is already on. rearm_alarm_switches does what unticking and re-ticking in the app does:

results = await api.rearm_alarm_switches(vin, pause=10)  # Fault and Start by default
for result in results:
    print(result.alarm_type, result.off_confirmed, result.on_confirmed)

Each type is sent as its own request, with a read-back after each change. The switch is always turned back on, even if something fails in between. set_alarm_switches(types, vin, enabled=False) turns types off directly.

Errors

Every error is a SaicApiException (or a subclass). Besides the message text, it carries SAIC's reply as separate values, so you don't need to parse the text:

  • return_code: SAIC's numeric code (see SaicReturnCode), or None
  • saic_message: the message on its own
  • checks for the common cases: is_vehicle_unreachable (code 4), is_request_rejected (code 8), is_vehicle_not_locked, is_logged_out and is_unexpected_failure

Prerequisites

You have an iSmart account (can be created in the iSmart app)

Credit

This is a maintained fork of SAIC-iSmart-API/saic-python-client-ng by Giovanni Condello, used by the mg-saic-ha Home Assistant integration. Licensed under MIT; see LICENSE.

Metadata

Release files for mg-saic-client 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mg-saic-client 0.10.1
File Size Uploaded Provenance Actions
mg_saic_client-0.10.1.tar.gz 48.8 kB With provenance Details for mg_saic_client-0.10.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mg-saic-client 0.10.1
File Interpreter ABI Platform Actions
mg_saic_client-0.10.1-py3-none-any.whl Python 3 none any Details for mg_saic_client-0.10.1-py3-none-any.whl

Total release size: 112.9 kB

Release files / mg_saic_client-0.10.1.tar.gz

Download URL mg_saic_client-0.10.1.tar.gz
Size 48.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dec0c3c87bbf5cdc889493261716e288107c0c2c87f9abfae0a588c980ca8b65
BLAKE2b-256 checksum
How to use checksums
003fadf9959ba022632ab38185bec9c29e8521964dc93bd861cdd98fe4768180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / mg_saic_client-0.10.1-py3-none-any.whl

Download URL mg_saic_client-0.10.1-py3-none-any.whl
Size 64.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c74db285ae4f0e9d13701cce0e14333e8e4fd6153f9f9e15086b5e7d19a92b10
BLAKE2b-256 checksum
How to use checksums
20a9935fc21eb8455b9d0a2bc4bd775e34048e0d135c0e809a32d3f3cc5615bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for mg-saic-client 0.10.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mg_saic_client-0.10.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page