Has Anyone played around with HomeASSISTANT addon for the MG4 ???

PvinSan

Standard Member
Joined
Apr 7, 2024
Messages
36
Reaction score
14
Points
10
Location
Brussels, Belgium
Driving
MG4 Trophy LR
Hi2All,
As anyone played around with HommeAssistant Addon for the mg4 ( from https://github.com/SAIC-iSmart-API/saic-home-assistant-addon ?
I can see data of the car on my home Assistant -BUT- the app then loses the acccess and I need to re authenticate it ( and then the homeAssistant Addon loses access;):):)
otherwise quite nice to see the car data :):) via HomeAssistant;):)
 
Of course, I'm one of the Devs of the add-on :)

Just share the digital key to another account /email and use that for daily use. Keep the original for HA and you're golden
GREAT TO HEAR(y)(y)(y)(y)(y)(y) !!!! AND A GREAT THANKS in ADVANCE ALREADY??:coffee:? for the Addon programming ..... And thanks for the help - I'll retry then As you say
 
OK done - but the shared key only gives you access to lock/inlock/start the car from the "other account"... the other app features that you access are now in the homeAssistant - or the ismart app with the original account where the car is binded.....
Ummmmm-- deciding moment -access all via homeASSIST -or- the app...
For the moment the app wins;): the homeassist isnt internet ready yet( mine that is) ;):)
:D
 
Last edited:
I'm using it. I set up a phone dashboard which is on both our phones:

IMG_0660.jpeg


And have the rest of it all in a larger browser window dashboard.

Screen Shot 2024-04-21 at 9.42.03 am.png


Plus track some key stuff with Grafana:

Screen Shot 2024-04-21 at 9.43.22 am.png
 
Do you please have a sample of the addon or how to install/configure
Start here for more info:
 
I've been slowly moving things over to docker with ha docker. Does anybody know if this can work with docker?
for sure.

You can run HA with docker (or as VM or standalone) and a separate container for the SAIC gateway. For message delivery between these two you need a mqtt broker - this could be mosquitto broker in a docker container or as integration within HA, which is probably the more simply solution.
Then you're ready to define a HA dashboard as alternative to iSmart on the mobile and as GUI at home.

Additionally you can install evcc for advanced MG charge-management. Can be done either as HA integration or as separate docker container.
There are also HA / evcc integrations of some wallboxes available.
 
OK, that's great! I've one last question and then I'm run with this.

How do I go about making a container and installing saic gateway? Knowing this might help me with other things like predbat.
 
OK, that's great! I've one last question and then I'm run with this.

How do I go about making a container and installing saic gateway? Knowing this might help me with other things like predbat.
Here you can find all details about the saic gateway - its not hard to get it up/running
SAIC MQTT Gateway
On that page there is also an example for the docker compose file to set it up
docker compose file
The gateway supports Home Assistant MQTT discovery. It publishes configuration information so that the vehicle appears as a MQTT device. This will save you a lot of configuration effort since all the entities provided by the vehicle will automatically show-up in Home Assistant.

P.S.: fyi: the gateway will use your credentials on the SAIC side, so when it refreshes data you will get logged of in the app of your mobile. In HA you can set some timer for the gateway for refresh period, inactivity etc.
 
Last edited:
Here you can find all details about the saic gateway - its not hard to get it up/running
SAIC MQTT Gateway
On that page there is also an example for the docker compose file to set it up
docker compose file
The gateway supports Home Assistant MQTT discovery. It publishes configuration information so that the vehicle appears as a MQTT device. This will save you a lot of configuration effort since all the entities provided by the vehicle will automatically show-up in Home Assistant.

P.S.: fyi: the gateway will use your credentials on the SAIC side, so when it refreshes data you will get logged of in the app of your mobile. In HA you can set some timer for the gateway for refresh period, inactivity etc.
Thanks for the details. After following the instructions, I've managed to get 90% of the way. You're right; it's very straightforward. I don't want to turn this Thread into a tech support thread so I'll make a issues post on github. Cheers
 
Never mind I managed to fix it. For some reason charging.stations.json was turning into a DIR. So I removed that and found the default of [] in your code repo, so created that file in /opt/saic. Then in mqtt.gateway I found tcp://iphere:1883 which I added to MQTT_URI on the Composer. I think I went wrong removing ${INFO} and entering my info.

services:
saic-mqtt-gateway:
image: "saicismartapi/saic-python-mqtt-gateway:latest"
container_name: "saic-mqtt-gateway"
environment:
- MQTT_URI=${MQTT_BROKER_URI}
- MQTT_USER=${MQTT_USERNAME}
- MQTT_PASSWORD=${MQTT_PWD}
- SAIC_USER=${SAIC_USERNAME}
- SAIC_PASSWORD=${SAIC_PWD}
volumes:
- /opt/saic/charging-stations.json:/usr/src/app/charging-stations.json

What was I supposed to enter after = ?

I got it working after my fudging :D
 
volumes:
- /opt/saic/charging-stations.json:/usr/src/app/charging-stations.json

What was I supposed to enter after = ?

I got it working after my fudging :D
You could also define an environment variable CHARGING_STATIONS_JSON=filename
instead of a volume.
But tbh I don't use this option as I use evcc between saic-gateway and my charger to control the charging process.

What do you mean with your question "What was I supposed to enter after = ?"

Glad, you got it working at the end. :cool:
 
You could also define an environment variable CHARGING_STATIONS_JSON=filename
instead of a volume.
But tbh I don't use this option as I use evcc between saic-gateway and my charger to control the charging process.

What do you mean with your question "What was I supposed to enter after = ?"

Glad, you got it working at the end. :cool:
cheers.

I mean was i right to delete everything after = on each line? Also was I supposed to add tcp and the pet the the URI?
 
I assume you installed within HA, than it should work this way. If the gateway is running outside of HA, $(MQTT-blabla) needs to be replaced with correct values
like SAIC_USER=your_username_within i_Smart etc..
The uri should look like MQTT_URI=tcp://ip_of_your_mqtt_broker_host:portnumber(default:1883)

You can easily check mqtt-traffic between your hosts on your network with a client
like: mqtt-explorer
 
Hi from Spain. I've just joined and I'm really pleased to see that we have such an active MG4 community.

I'm really interested in this home assistant plug-in, but I'm a little concerned about my car's high-voltage relays. I can hear them switching each time I refresh the app, so I'm wondering if using the plug-in that's going to happen every 5 minutes, as I don't want them to wear out too quickly.

Just to highlight the issue, I've seen HV relays with a lifetime of 100k - 1000k operations. There are 105k 5 minute intervals in a year...

To those who that use the plugin, does the car switch the relays every 5 minutes? That's the clicking you year when unlocking or refreshing the app. We even seem to have a dev here so let me ask directly: @nanomad, does the plugin do anything to avoid the wear-out? (I'm not sure if it can)

Thanks in advance.
 
Can't say I've ever noticed relays clicking. My integration records mostly when driving, charging or discharging. Rest of the time it is idle unless I invoke a call of some time. It has a refresh after 86,400 seconds (24 hours) if there's been no activity. Else it sleeps.
 

Are you enjoying your MG4?

  • Yes

    Votes: 908 77.7%
  • I'm in the middle

    Votes: 171 14.6%
  • No

    Votes: 90 7.7%
Support us by becoming a Premium Member

Latest MG EVs video

MG Hybrid+ EVs OVER-REVVING & more owner feedback
Subscribe to our YouTube channel
Back
Top Bottom