MG Motor Mg5 Electric Car Integration

As above, I have a page in home assistant where I can do all the things I need to to with the car, saving me from having to log back in to the app.

If needed, I can allow or restrict access to this page to other HA users.

I’m awful at dashboard creation/design, has anybody created a HA dashboard for the MG cars they’d be willing to share ?

This is what I created, car is new lease, dashboard is still evolving. Also I’m trying to have same/similar as I have for my Polestar.

But, the info from the MG is not updating as I had hoped. I use some of the battery/charging info to control my EVSE. But the data is stale, the car was charging the moment I took this screenshot (the MG app does update).

Hi Dave,
Is this still working for you since the API changes last year? Did you have any complications before it started working? For example, i have heard that a too complex password for the iSmart account could be an issue.
Cheers
Nick

Tady to je pěkně vytvoření v Node-RED:

2 Likes

Hi, hoping to get some assistance with installing this integration. I have a MG4 (Australia). Would be very nice to have some of the car’s data integrated in Home Assistant.

I followed the instructions as posted upthread here:

I have:
Mosquitto broker Current version: 6.4.0
SAIC MQTT Gateway (Python) Current version: 0.5.15
(I also tried the Java version but having same problems as described below)

I entered my MQTT login and MG login details details into the SAIC MQTT Gateway.

But I am stuck and not sure how to progress. I made it through to the point where it says to restart Home Assistant, which I did.

Then it says to Configure MQTT.

But my MQTT is already in use with another device, so I am uncertain as to how I proceed.

If I click on CONFIGURE ,I am presented with:

and if I click on ADD ENTRY, I am presented with a message saying only a single configuration is possible:

I’m a little lost on what I should do from here.
Thanks for any pointers.

Also, I notice the SAIC add on stops running.

If I go to the add on and start it:

All seems OK if I leave that screen open, but as soon as I navigate away from that screen and come back to view the add on, it has stopped running:

Unsure if this is related to the problem I’m having or what I am doing wrong?

That version of the gateway won’t work is Aus as we use an older version of MG’s API.

Uninstall it, then install the one with (Python)(Legacy) next to it.

I don’t remember having to restart HA.
From memory all the new entities were auto discovered in HA, but start with installing the legacy add-on, start it then check the logs on the SAIC add ons page

Edit:

Very Important !

Also, in the SAIC add on config, under where you add your MG log in details, change SAIC_URI to https://tap-au.soimt.com

Ah, OK, thanks.

I have uninstalled that version and installed the legacy version, although I think at present the MG servers are offline as people across the country haven’t been able to connect to their cars with with their iSmart app.

No matter, as long as I can see the MQTT topics appear in Home Assistant is what I’m looking for.

I can see them in MQTT Explorer:

Screen Shot 2024-03-22 at 6.20.19 pm

where it just reports
lwt = offline

Not sure what lwt is but I am at least seeing an SAIC topic which suggest I have part of the set up right.

But I can’t see anything in the Home Assistant MQTT integration, just my Solar Assistant data:

Not really sure what I am missing?

I can only guess that with MG’s API being down, there’s no values to publish, hence no entities to auto discover ?

Unless there are some clues in the add on’s log, we won’t know too much more until the API comes back online.

Also thanks - just did that and restarted, I see many more topics in MQTT Explorer now (I blanked out my SAIC log in email address):

Screen Shot 2024-03-22 at 6.31.42 pm

But still not sure how I get access to these into Home Assistant.

Take another look at your MQTT integration and see if your MG now appears as a device

It should look like this:

Unfortunately not. It’s just showing my Solar Assistant MQTT feed.

I think there is something about MQTT integration which only allows one MQTT connection. Which seems rather odd.

Hey @wattmatters, I recognise you from the MG owners Aussie thread!
As you mentioned, there’s an issue with the API so this addon isn’t updating at the moment.
Your MQTT topics look similar to mine:
image

Here’s my settings from the SAIC MQTT Gateway (Python) (legacy) integration in HA. I have HA_DISCOVERY_ENABLED turned off, but if you enabled this and use “homeassistant” as the HA_DISCOVERY_PREFIX you should get auto discovered entities for MQTT.


1 Like

Thanks!

This is what I have (and is what was already there):

I get nothing from SAIC in the MQTT integration.

I only see my Solar Assistant topic feed.

Hmm, if you go to your integrations page and pick MQTT, do you have discovery enabled there? You’ll need to expand the options next to configure and select ‘System Options’

Yep.

The thing to note is where yours says “Mosquitto broker”, mine shows an IP address (192.168.0.160) which is not HA, but rather my Solar Assistant.

I was wondering about that address.
You may need to go into the configure option for that entry in your screenshot, then “re-configure mqtt”. Turn on the ‘advanced options’ toggle and work you way though the menus. Double check discovery is enabled and the prefix is set.

In MQTT explorer you don’t seem to have the ‘homeassistant’ topic present which suggests it’s not looking for discovery.

If you don’t care about discovery, you can setup manually (this is actually how my deployment works as I have MQTT discovery turned off).

In /configuration.yaml

mqtt:
  sensor:
    - name: mg4_soc_percent
      state_topic: "saic/[email protected]/vehicles/VIN/drivetrain/soc"
      value_template: "{{ value }}"
      unit_of_measurement: "%"
    - name: mg4_soc_kwh
      state_topic: "saic/[email protected]/vehicles/VIN/drivetrain/soc_kwh"
      value_template: "{{ value |round(1) }}"
      unit_of_measurement: "kWh"
    - name: mg4_range
      state_topic: "saic/[email protected]/vehicles/VIN/drivetrain/range"
      value_template: "{{ value |round(0) }}"
      unit_of_measurement: "km"

… and so-on. Definitely not as friendly as discovery though!

Edit: I just looked at your screenshots again.
You have two MQTT brokers? 192.168.0.139 used by SAIC, and 192.168.0.160 used by Solar Assistant?
I think you want to settle on a single broker. You could try and bridge with mosquitto but I’m not sure it’s worth the complexity. I’ve never tried it.

It would appear so. I don’t fully understand how/why but it seems I can’t have both at the same time.

I’ve had the MQTT connection with Solar Assistant for some years, and that’s the IP address for Solar Assistant.

I’m not sure how though.

OK, I went thorugh reconfigure and put in the IP address and login details for the Home Assistant MQTT broker.

Now MQTT integration is showing two devices:


However the original MQTT for the Solar Assistant (showing as Axpert Max) is no longer being populated.

It’s dead as a door nail:

That one matters as it’s my home’s energy systems, so I’ll need to revert back to that unless/until I can work out how to make it work with the HA MQTT.

But it is showing the SAIC data:

Two steps forward, one step back!