Skip to main content

MG iSMART India Client

Python client for the MG iSMART India TAP/gateway API.

This package contains the protocol/client layer used by the MG iSMART India Home Assistant work. It is intentionally separate from Home Assistant so it can be tested and released independently.

Install

pip install mg-ismart-india-client

Basic use

import aiohttp
from mg_ismart_india_client import MgIndiaClient, hash_control_pin

async with aiohttp.ClientSession() as session:
    client = MgIndiaClient(
        session,
        phone="9876543210",
        password="your-password",
        vin="YOURVINHERE",
        pin_hash=hash_control_pin("1234"),
    )

    await client.login()
    vehicles = await client.vehicles()
    status = await client.status()

    # On an EV, ask the same poll for the charging frame too: it lands on
    # status.charge (None when none arrived -- routine, not an error), and
    # saves the second round trip a separate charge_status() would cost.
    #
    # Only set this where a charging frame is expected. The loop waits for one,
    # so a vehicle that never sends it spends the full poll budget on every call.
    status = await client.status(include_charge=True)
    print(status.charge)

Control methods require a configured PIN hash. The raw 4-digit control PIN is not stored by the client.

Development

python -m venv .venv
. .venv/bin/activate
pip install -e '.[dev]'
pytest -q
ruff check src tests

Release notes

0.3.0

  • Add Vehicle.is_electric.
  • Add Snapshot.battery_soc, using the charge frame's SOC or falling back to the status fuel level for EVs.
  • Add ChargeStatus.charging_power_kw.
  • Add MgIndiaMfaRequired, a subclass of MgIndiaLoginRejected, raised when the account has multi-factor login turned on.

0.2.1

  • Reject malformed responses, mismatched vehicle identities and invalid charge values.
  • Avoid resending commands when their completion is uncertain.
  • Improve session recovery and verify lock outcomes against fresh vehicle status.

License

MIT License. Copyright (c) 2026 John Lazarus.

Metadata

Release files for mg-ismart-india-client 0.3.0

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-ismart-india-client 0.3.0
File Size Uploaded Provenance Actions
mg_ismart_india_client-0.3.0.tar.gz 37.9 kB With provenance Details for mg_ismart_india_client-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mg-ismart-india-client 0.3.0
File Interpreter ABI Platform Actions
mg_ismart_india_client-0.3.0-py3-none-any.whl Python 3 none any Details for mg_ismart_india_client-0.3.0-py3-none-any.whl

Total release size: 66.6 kB

Release files / mg_ismart_india_client-0.3.0.tar.gz

Download URL mg_ismart_india_client-0.3.0.tar.gz
Size 37.9 kB
Tags Source
SHA-256 checksum
How to use checksums
86ef00fbba1790990dd2c7034361c4c5f9559789c1abaf6492b3171428a77961
BLAKE2b-256 checksum
How to use checksums
388a560a1142d0e1f846cedecc528bb47178880918080a39e83bebd6d00f02fa
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 2, 2026.

Transparency log

Release files / mg_ismart_india_client-0.3.0-py3-none-any.whl

Download URL mg_ismart_india_client-0.3.0-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9acbbb7f40c7903e8931447c25f069a61a2f8e8743ae0262de4408a92d3179e4
BLAKE2b-256 checksum
How to use checksums
1d6986d9d62b9b042b333af83970e64f485463b8940aed0e24c9e156691c14e8
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 2, 2026.

Transparency log

Security for mg-ismart-india-client 0.3.0

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_ismart_india_client-0.3.0.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 2, 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