Skip to content

feat(india): expose EV charging status sensors - #302

Draft
Dr-Blank wants to merge 3 commits into
townsmcp:betafrom
Dr-Blank:feat/india-charging
Draft

feat(india): expose EV charging status sensors#302
Dr-Blank wants to merge 3 commits into
townsmcp:betafrom
Dr-Blank:feat/india-charging

Conversation

@Dr-Blank

Copy link
Copy Markdown
Contributor

What

Wires MG iSMART India EV vehicles into the existing charging sensors. The
India backend's get_charging_info now fetches the decoded charging frame from
the client and maps it onto the chrgMgmtData / rvsChargeStatus shapes the
shared charging sensors already read — so India EVs get charging state, SOC,
voltage, current, power, range, session duration and odometer with no new
sensor code.

How it maps

The client returns charging values in declared real units (volts, amps,
percent, km). This backend re-encodes them onto the global SAIC raw scales
the shared sensors decode (CHARGING_VOLTAGE_FACTOR, CHARGING_CURRENT_FACTOR,
tenths), rather than assuming the India protocol's raw field values happen to
share the global scale. rvsChargeStatus is built field by field, so every
value a sensor reads has a named source and a stated scale assumption.

  • is_charging / is_plugged_inbmsChrgSts (charging / plugged-in / unplugged)
  • Fields with no confirmed India scale (total battery capacity, mileage/energy
    since last charge) are forwarded as the vehicle's own integer, flagged in a
    comment as the line to correct if a sensor reads wrong.
  • Returns None when the vehicle sends no charging frame (coordinator handles
    it); session/protocol errors propagate so they're logged, not silently
    reported as "not charging".

Dependency

⚠️ Needs the client-side decoder: john-lazarus/mg-ismart-india-client#6
(charge_status()ChargeStatus). Merge + release that, then bump the pinned
client in manifest.json before this lands. Draft until then.

Scope

Diff is two files (backends/india.py, backends/__init__.py). Branch is behind
beta; will rebase before un-drafting.

Dr-Blank and others added 2 commits August 19, 2026 09:49
…o method for India backend

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… conversion

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resolve conflict in india.py: purely additive, both charging-current/
duration helpers (ours) and GPS-position mapping (upstream) kept.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Dr-Blank
Dr-Blank force-pushed the feat/india-charging branch from 9f231ad to f0171c4 Compare August 19, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants