General Integration Questions #262
Replies: 25 comments 66 replies
|
Thanks Harry — good questions. Taking them in turn: 1. Scheduled charging mode ("Disabled" / "Until Scheduled Time") Your reading is essentially right. The select maps to SAIC's own scheduling mode:
There's a third value, Until Target SOC, that some cars expose and yours doesn't — which is why you only see two. The labels come straight from what SAIC reports, so they reflect the car's behaviour, not a naming choice on our side. 2. Battery heating Two separate things here, which is the source of the confusion:
So to answer directly: yes, there are conditions beyond just flipping the switch, the car decides whether to actually heat, and the status sensor reflects real activity rather than the switch state. 3. Port Lock Fair assessment. The car manages port locking/unlocking itself during the charge cycle, so as a control it's rarely needed. Its main value is as a status, plus the occasional manual override (e.g. releasing a cable the car has left locked). If you find it more clutter than use, it's safe to just hide the entity — nothing else depends on it. Thanks, James 👍 — happy to spin any of these out into an issue if they turn up something worth changing. |
|
Clear thanks James, apart clarifying a couple of things
|
|
Morning James! I was happily coding away until around 2am and decided to call it a day/night. Car was charging and all seemed to be OK, apart from a persistent invalid interior temp sensor reading of -128. On returning to my laptop, whilst SOC was 100% it said it was still charging. Then I noticed the time of the last update was 03:06. It seems that around this time the charging completed, but some weird stuff started happening and I got no further updates to say Charging Complete or Connecting which is what it usually says once the charging session has complete. See screen shot from 09:10ish and you'll see it still says last update was 03:06 and despite 6 hours passing, the 09:06 refresh time came and went with no activity. At 09:18 it did get around to doing something and got a bunch of errors relating to charging info. Error 4s amongst them. Reachability still Awake and freshness still Live. Something happened a 03:06 to kick all this off, but no idea what. The attached log is not MG filtered I'm afraid as I had to download it to see it. I'm now going to go and disconnect the car to see if that changes the charging info status and will report back. |
|
@HarryFlatter The core problem is SAIC-side, and your own testing proves it. Charging-info retrieval has been failing (return code 4 / timeout) since ~03:06, and — the key tell — the iSmart app fails on charging info too (it gets SOC but not the charging data). When the official app can't fetch it either, it's the car or SAIC's servers, not the integration. Ours is correctly surfacing the failure (the error-4s and retries) and keeping Reachability/Freshness green because the rest of the data is fine. Nothing to fix there beyond waiting for SAIC/the car to start answering again. But your logs exposed three things on my side that I've now fixed (landed in 1.2.0-beta11):
Separately, I also found and fixed an unrelated bug where a "vehicle started" push could record the power-on time up to ~2 hours in the future (a timezone mismatch in the SAIC message) — that's in beta10. So: the charging outage itself is SAIC's to resolve, but the integration will handle it far more gracefully now. Give beta11 a go once it's up and let me know if the refresh behaves better next time the endpoint has a wobble. |
Idiots guide to Air ConditioningApologies if you have covered this James. When I very first started with this integration, I think there was only one AC control: climate.mg_hs_phev_trophy_climate - Which typically used the standard HA thermostat card. I could control the AC using this, but wasn't sure how to implement that into custom buttons on my dashboard. More recently I spotted the addition of: select.mg_hs_phev_trophy_climate_mode These entities are much simpler to use with custom buttons. So my question is, is there a right or wrong way to control the AC? Intuitively, I would use the 3 separate entities, set the mode, set the target and switch it on. Once the target temp is reached, does the AC switch off or does it idle, maintaining the temp? |
|
Thanks James. I checked iSMart and it concurred that the AC was running, but disagreed on the target temp. Still said 22, despite my setting of 24. The major issue is that I could not turn it off!. Switch kept flipping back to on and mode flipped back to Cool. Oooerr, then I checked the logs.... |
Why HA can't show the AC target temperature — proven with two testsHarry, this bugged me enough that I went and proved it properly rather than just asserting it. Short version: the target temperature you set is sent to the car in the command, but the car never reports it back in any status response — so there's genuinely nothing for the integration to read. Here's the evidence from two separate tests. Test 1 — decrypted the app's own network trafficI ran a proxy (mitmproxy) that decrypts the iSmart app's encrypted API calls, then set the temperature to 19°C in the app and sent the AC-on command while capturing everything. The outbound command does carry the temperature. The AC command ( But the inbound status response does not. The response the app polls ( Test 2 — my live Home Assistant log, same momentTo confirm the integration sees the same thing, I watched HA's live log while doing the above. Two consecutive fetches, before and after the AC came on:
The only climate value that changed when the AC started was Why the setpoint isn't in the responseThe car's telematics reports the climate state — is it on, and in what mode — but not the setpoint it's running at. The temperature you choose only ever exists in the outgoing command; once sent, it's not echoed back in any form. This is the same in both directions, which is why iSmart showed 22°C while HA had a different value, and why HA can't reflect a temperature you set in iSmart: neither app can read the other's setpoint, because SAIC simply doesn't put it on the wire. Bottom lineIt's not that we forgot to wire the target temp up to the car — there's nothing to wire it to. The integration reads the climate state (which it uses correctly), but the setpoint isn't in any response, so the only value it can ever show is the one you last set from HA. That's exactly what the |
|
So thorough as ever - thanks James. I always leave my AC on Auto and set to 22deg. Having hit the command limit before my next test, I popped out to the car for a key start and noticed that the AC was set to manual (fan 6) and 'Lo' temp. I wonder how that happens, or whether it is some default setting when it receives a remote AC command. Since the mode activates and deactivates the AC, is the switch.mg_hs_phev_trophy_air_conditioning, actually surplus to requirements? Just tried another 2 tests. Set the temp, selected 'Cool' and it fires up immediately. However, any attempt to shut it down consistently comes back with an error 500. Stopping it with iSmart (which when refreshed recognised that the AC was running) works 100%. So the iSmart command is definitely working. I can also confirm that AC is set to manual (fan 6) and 'Lo' temp each time I send the remote command. It would appear to ignore the setpoint completely. Is it possible that different models have different command structures? |
|
I will give this a shot today James. If you have the AC Airflow toggle exposed in HA, try that on/off too. How would I have that exposed in HA other than in your integration? For option B, have you sent me something (decrypt add-on)? |
|
Hi James, I've got mitmproxy running and can see the http flow on the webui on my laptop (running under Widows is fine). However iSmart (Android) bombs out with a message saying proxies are forbidden. Are you Android or IOS? Might IOS make the difference on this? |
|
Working on getting an iPhone. In the meantime, I'm pressing on with my HA dashboard. One question, with regard to the max number of API commands that can be send without starting the car with the key, would there be any concept of aggregating commands to circumvent this. So for example, on a cold morning, I want to switch on both seats, the front and rear demist and the AC - is that doable? |
|
Hi Harry,
Hopefully this gets through, what with GitHub issues at the moment.
Unfortunately not. I think I have tried to save as much as possible for the 3 commands by not sending the target temperature but that seems to be it. Unfortunately those entities you mention are discrete standalone controls - from the app you can’t send a ‘batch’ of commands as one button press from what I have discovered (if you know differently do let me know!) - it’s very frustrating the 3 command limit before starting the car with a key (or phone if you car is capable of using a phone as a key). I have tried a lot of tests to see even if the counter/mechanism is in the API but I don’t get anything to hook into sadly.
The only thing I can suggestion is raising a complaint with SAIC via the app/social media asking them to up their limit like the way I have. But I think it will fall on deaf ears. It’s very frustrating as other car manufacturers don’t have the 3 strikes and your out policy (well, Mazda and Mercedes certainly don’t)
…Sent from my iPhone
On 17 Aug 2026, at 3:47 pm, HarryFlatter ***@***.***> wrote:
Working on getting an iPhone.
In the meantime, I'm pressing on with my HA dashboard.
One question, with regard to the max number of API commands that can be send without starting the car with the key, would there be any concept of aggregating commands to circumvent this. So for example, on a cold morning, I want to switch on both seats, the front and rear demist and the AC - is that doable?
—
Reply to this email directly, view it on GitHub<#262?email_source=notifications&email_token=ADLJAMLDFJOS4VXJILNLDTL5KMLHZA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBQGUZTGMJQUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-18053310>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLJAMIS3UVCS7RTFJMKRZL5KMLHZAVCNFSNUABIKJSXA33TNF2G64TZHM4DGNJUGI4DOMZVHNCGS43DOVZXG2LPNY5TCMBVGUYDSNZSUF3AE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
|
As you say, deaf ears! Especially since the API is not even published and there is no documentation. Why would they help a bunch of reverse engineers. |
|
It's a poxy theme setting! I've now registered another 'secondary' account. However, I bow to your knowledge, but if you are going to log in with this user, I have a feeling that it's going to require that you bind that address with the car. However, no time like the present... How shall I get these credentials to you? You have my e-mail address & phone number from that DM that I send you. Pinf me something and I send them back and we can try it as soon as. |
|
Ready when you are |
|
Hi all - n00b here so go easy please! I have an Australia spec IM5 Platinum, which is the midrange model with 100kWh NMC battery. I ticked the "Adaptive Air Suspension" box so it would be interesting to see if the sensors could be added over time :) The "IM IM5" device is showing lots of good stuff, especially tyre pressures, SoC etc. Really useful to have in a dashboard. One quirk - the battery capacity, showing as 72.50kWh Let me know if there's anything I can add to get the actual capacity in the device. Cheers Andrew |
|
Thanks James - yep the iSmart app doesn't have anything about the
suspension so "nothing to see here" I guess :)
The iSmart app always shows my interior temperature as 87c, external as
0c. HA shows 21c/21c...
Looking forward to the next version, and thank you for getting this up and
running. Next time Im in HA I'll buy you a pint of 6X :)
https://imgur.com/IY916u7
Cheers Andrew
*Andrew Jago*
+61 418 455 404
PO Box 3092 | Yeronga Qld 4104
…On Mon, 24 Aug 2026 at 15:32, James Townsend ***@***.***> wrote:
The latest beta will allow you to override the battery capacity.
Your image link isn’t working.
Regarding the adaptive air suspension, does the ismart app show you any
detail about it? If not then it is very unlikely to be in the API. I
actually can’t think of a reason why it would be in the app to be reported
on but I guess you never know
—
Reply to this email directly, view it on GitHub
<#262?email_source=notifications&email_token=CDIDQS6CAWXY3L32ITWCWKL5LPHNVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRGMYDMNRTUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-18130663>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CDIDQS43OSTT7TQ5UUVEBXT5LPHNVAVCNFSNUABIKJSXA33TNF2G64TZHM4DGNJUGI4DOMZVHNCGS43DOVZXG2LPNY5TCMBVGUYDSNZSUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/CDIDQS57BOTQXVP3MQYRU235LPHNVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRGMYDMNRTUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSVGM33PORSXEX3JN5ZQ>
and Android
<https://github.com/notifications/mobile/android/CDIDQSZW2RSTIW2NCWP43E35LPHNVA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRGMYDMNRTUZZGKYLTN5XKOY3PNVWWK3TUUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ>.
Download it today!
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Hi James, |
|
Thanks James, but unfortunately that new sensor is 'unknown' for me. Is it possible that this may appear at some point, since the car has not moved since last charge. |
|
Hi James, Looks like SOC version is absent for PHEV. The other one does give me the attributes as per your screen shot above, but I'm struggling to see how they will give me a last charged energy. 'Energy kWh' is what has been burned since last charge. I want to know how much I put into the battery at the last charge. At this moment in time after 2 trips on 100% EV (no fuel used) the Power Usage Since Last Charge is defo appox 3 times what it should be. Here are all the relevant values... Electric Range 53 mi (out of 75) (extra 2 miles due to regen) I did spot this in the logs: lastChargeEndingPower=725 (that's my 3 times too large 100% SOC after a full charge). I don't suppose there is a lastChargeStartingPower=999 or something similar? |
Added Electric MileageAnother one for you James. 'Added Electric Mileage' has never populated on my car. Should it, or is it reserved for BEVs. I guess I could calculate it with an automation by subtracting the range at 'start of charge' from range at 'charge complete'. Just seems odd that mine remains at '0', as opposed to unknown. |
|
Good to see my skills at breaking things or finding already broken things remain undulled.😜😁 In a former life, I ran a team of developers on a financial information distribution system for dealers & brokers. I was the bane of their lives, getting involved in system testing and finding stuff they had signed off as 100% to spec. Thanks again for such a comprehensive investigation and resolution. My life in the city would have been so much easier if some of my people took a leaf out of your work ethic manual! |
|
@HarryFlatter — got to the bottom of Added Electric Range, and the answer is that it's a dead end. Here's what it actually is, and what you're getting instead. What that sensor isI think that's the one you mean — there's no separate "Added Electric Mileage", and no PHEV variant. BEV and PHEV get the same single entity. It exposes the API's That also explains the Except it never reports anything anywayI checked my own car's history across a full charge — five hours on AC, 37% to 80% — and it sat at I then thought I'd found the explanation: the API carries a companion Wrong, as it turns out. I grabbed a live debug capture mid-charge with current flowing, and So it isn't a PHEV limitation, it isn't your car, and there's nothing hiding behind a flag. The field simply isn't populated, and an honest-looking I've left the sensor in place rather than removing it, in case it works on a model neither of us has. If anyone reading this sees it show a non-zero value during a charge, please say so. What you're getting insteadYou said you could work it out with an automation by subtracting range at charge start from range at charge complete. That's exactly right — and it's precisely the pair of readings the new charge-session tracking already captures. So rather than have you build it, it's now built in. Coming in 1.2.7-beta8, a new Last Charge Range Added sensor. It uses the electric range figure that demonstrably does work — the one behind your 53-of-75 readout — rather than the field that doesn't. It's a proper sensor rather than just an attribute for a specific reason: Home Assistant converts sensor readings to your unit system but never converts attributes. As a fellow UK user you'd have got kilometres sitting next to everything else in miles. The raw One deliberate quirk: if range falls across a charge, the delta is dropped rather than reported, though both endpoint readings are kept so you can still see what happened. That's less exotic than it sounds — I caught it happening in my own capture, where preconditioning the cabin while plugged in knocked 13 km off the estimate mid-charge. And a bonus your log question led toWhile confirming all this I noticed a field we don't expose at all: That's arguably closer to what most people picture when they hear "added range", and it's live rather than only available after the fact. Not in beta8, but it's going on the list. |
|
Hi James, I'm guessing the elephant in the room said "hello" when you said "on a test car at 57% with 177 miles showing and an 80% target". As per bloody usual, my car has given up the ghost in terms of charging info about an hour into the charge! Just pondering this issue, is it possible that the PHEV is saying "stop bloody asking me about charging every 5 minutes!" and eventually saying "right, I'm not listening any more!". I might try an experiment with my next granny charge and increase the charging update to once every 30 or even 60 mins and see if that delays or eliminates the charging silence. Out of interest, does the charging process issue any unsolicited updates, a bit like the door lock status does and is picked up by your once a minute listener? It might be significant that iSmart does not auto-poll the charging data at all. |







Uh oh!
There was an error while loading. Please reload this page.
I'll kick it of with....
Could that actually read Disabled - meaning if I hit the charging button (switch.mg_hs_phev_trophy_charging), charging will start immediately assuming binary_sensor.mg_hs_phev_trophy_charging_gun_state is 'Plugged In'
OR Enabled - meaning if I hit the charging button (switch.mg_hs_phev_trophy_charging), charging will start assuming binary_sensor.mg_hs_phev_trophy_charging_gun_state is 'Plugged In', but limited to the times set in time.mg_hs_phev_trophy_scheduled_charging_start and time.mg_hs_phev_trophy_scheduled_charging_end entities.
This regards the heating. I just wanted clarify how this works. If I set the time.mg_hs_phev_trophy_battery_heating_schedule_time and then hit the switch.mg_hs_phev_trophy_battery_heating switch, then battery heating will take place every day at that time? Are there any other conditions that need to be met for the switch to work? Whenever I've tried it, it bounces back to off after a short while.
Also, what switches the heating off? Does the sensor.mg_hs_phev_trophy_battery_heating_status sensor show the state of the switch or whether the heating is actually active?
Port Lock. On the basis that the car / charging process pretty much takes care of locking/unlocking or the cable port, do you think this entity is much use? Maybe as a status, but even then I'm not sure. Am I missing anything here?
Thanks James👍
All reactions