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.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.2.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-ismart-india-client 0.2.1
File Size Uploaded
mg_ismart_india_client-0.2.1.tar.gz 36.4 kB Details

Built distribution (wheel)

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

Total release size: 64.1 kB

Release files / mg_ismart_india_client-0.2.1.tar.gz

Download URL mg_ismart_india_client-0.2.1.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6d2b4ce19f70e97ba700f9b8786f40323e7948a718aedba26c5fccea9e9ac23f
BLAKE2b-256 checksum
How to use checksums
f49562026384af072b9ca58f7754177ce627a252640bca672e6d09119e5cab5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

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

Download URL mg_ismart_india_client-0.2.1-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9c7f8b8149213db7517b4adb39e333fab08b60a6274ffd760441ae7e8923114
BLAKE2b-256 checksum
How to use checksums
f12e3941678b36d8a3f314250e1100d8c1b5902cff2709b6e40e09227ed4f096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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