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

Hi,
no real worries about that.
Within the plugin gateway you can dynamically define some parameters for gateway activity:
  • gateway_active_refresh_period (in seconds)
  • gateway_grace_period_after_car_shutdown (in seconds)
  • gateway_inactive_refresh_period (in seconds)
  • gateway refresh mode periodic / force / off
  • gateway_refresh_period_after_car_shutdown in seconds
This parameters are available in HA per default after installation. e.g.
gateway_inactive_refresh_period an be set to 86400s to check the car only once a day
or switch it off and force one refresh when needed.
 
Thanks, @wattmatters and @gredie, that's a weight off my mind!

It might not even be the HV relays I'm hearing, so more potential cycles. But if the plugin has a way to minimize it when idle, that sounds fantastic.

I'll give it a try then! (First Home Assistant steps here.)
 
While the car is off the relays that click are to wake up the various LV systems like bms and such. I wish it would close the HV relay as it would reduce the risk of draining the 12V battery.

The only times the HV system is energised is when you turn remote heating/cooling on or start defrosting the windows.
 
I just took the car out of the garage to warm up in the sunlight (hah, what sunlight!) before a trip this afternoon, and for the first time actually noticed these little clunks it makes when it wakes up. So that's what it is?
 
Thanks for the feedback nanomad. Up and running now! I really like how the plugin checks for car starts with the SAIC server to adjust the polling rates. Great job!

Maybe it could be a potential hack to remotely run the AC every few days to charge the 12V battery. Not sure if charging only happens when the car is in ready mode.

Next step is to build my first dashboard. @wattmatters, your "Days Since 100% SOC" sensor is a custom creation, isn't it? Would you like to share some pointers on that?
 
@wattmatters, your "Days Since 100% SOC" sensor is a custom creation, isn't it? Would you like to share some pointers on that?
Yes.

I created a custom counter entity using the template helper:

Screen Shot 2024-07-27 at 7.35.22 am.png


Screen Shot 2024-07-27 at 7.42.43 am.png


Then two automations built using the automation UI to increment the counter each day, and reset it to zero when SOC hits 100%.

This is the yaml the UI generates for the daily counter increment:

Code:
alias: EV - Increment Counter Days Since EV 100% SOC
description: Increment the days since EV 100% SOC cycle counter each day
trigger:
  - platform: time
    at: "00:00:00"
condition: []
action:
  - service: counter.increment
    data: {}
    target:
      entity_id:
        - counter.ev_days_since_100_soc
mode: single

And a second automation to reset the counter once SOC reaches 100%:

Code:
alias: EV - Reset Days Since 100% SOC
description: Reset Counter for number of days since the car was fully charged.
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.<mycarID>_soc
    above: 99
condition: []
action:
  - service: counter.reset
    target:
      entity_id: counter.ev_days_since_100_soc
    data: {}
mode: single

Obviously sensor.<mycarID>_soc is just a placeholder and not the real sensor name (which is the identifier for my car). Substitute with your own.
 
Thank you @wattmatters! I will try to set this up in the next few days.

I have tried to set it up via an SQL sensor that queries the historical values, but I still need to familiarise myself with "value templates" and such. I like your approach better :)
 
Is it possible to use this addon to start/stop the charging process? For example; you have a solar setup and only want to charge the car when there's enough power from the sun or home battery?
 
Is it possible to use this addon to start/stop the charging process? For example; you have a solar setup and only want to charge the car when there's enough power from the sun or home battery?
If an EVSE is plugged into the car then yes it should enable you to do that.

There is a switch to start/stop charging and you can set the charging rate and scheduler as well:

Screen Shot 2024-07-28 at 7.01.40 pm.png


Screen Shot 2024-07-28 at 7.03.01 pm.png


Screen Shot 2024-07-28 at 7.02.42 pm.png
 
Is it possible to use this addon to start/stop the charging process? For example; you have a solar setup and only want to charge the car when there's enough power from the sun or home battery?
Maybe you want to have a look at post #11 regarding evcc. This tool can be installed within HA and provides exactly what you asked for. So you could reduce effort to implement more complex logic into HA.
 
Last edited by a moderator:
Maybe you want to have a look at post #11 regarding evcc. This tool can be installed within HA and provides exactly what you asked for. So you could reduce effort to implement more complex logic into HA.
That is very cool indeed!

I'll have a look, once i have everything setup. Thx for the tip!
 
Maybe it could be a potential hack to remotely run the AC every few days to charge the 12V battery. Not sure if charging only happens when the car is in ready mode.
I think the 2 preheat cycles limit that applies when you use the phone app would still apply? You need to sit in the car after 2 cycles before it will go again?
 
To those who that use the plugin, does the car switch the relays every 5 minutes?

Good Call @scal - This is a very valid question and reason for concern. You definitely caught my curiosity and I just tested this and I can report the following:

Every time you restart the service, then entire car is scanned and I hear all the relays clicking.
Furthermore; Looking at the log for a few minutes I see these ever so often:

2024-07-31 13:13:36,739 [ INFO ] Updating vehicle status - __main__
Code:
2024-07-31 13:13:44,155 [  INFO  ] Updating charging status - __main__
2024-07-31 13:13:47,853 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 13:13:47,905 [  INFO  ] Refreshing vehicle status succeeded... - __main__
...
2024-07-31 13:15:48,158 [ INFO ] Updating vehicle status - __main__
Code:
2024-07-31 13:15:55,537 [  INFO  ] Updating charging status - __main__
2024-07-31 13:15:59,228 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 13:15:59,280 [  INFO  ] Refreshing vehicle status succeeded... - __main__

It's safe to assume it scans regularly, but this didn't give me a definite answer, so I stood next to the car for ten minutes and I can happily report I do not hear any clicking from the relays every one or two minute.
 
Good Call @scal - This is a very valid question and reason for concern. You definitely caught my curiosity and I just tested this and I can report the following:

Every time you restart the service, then entire car is scanned and I hear all the relays clicking.
Furthermore; Looking at the log for a few minutes I see these ever so often:

2024-07-31 13:13:36,739 [ INFO ] Updating vehicle status - __main__
Code:
2024-07-31 13:13:44,155 [  INFO  ] Updating charging status - __main__
2024-07-31 13:13:47,853 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 13:13:47,905 [  INFO  ] Refreshing vehicle status succeeded... - __main__
...
2024-07-31 13:15:48,158 [ INFO ] Updating vehicle status - __main__
Code:
2024-07-31 13:15:55,537 [  INFO  ] Updating charging status - __main__
2024-07-31 13:15:59,228 [  INFO  ] Updating scheduled battery heating status - __main__
2024-07-31 13:15:59,280 [  INFO  ] Refreshing vehicle status succeeded... - __main__

It's safe to assume it scans regularly, but this didn't give me a definite answer, so I stood next to the car for ten minutes and I can happily report I do not hear any clicking from the relays every one or two minute.
good to know (y) I think the regular polling only gets stuff the MG server is already aware of so doesn't need to communicate with the car.
 
You can see the frequency of polling (i.e. the dots) from the data:

Screen Shot 2024-08-01 at 9.25.20 am.png


So frequent polling when the car is charging or discharging, but pretty much bugger all in between.

When driving I find polling maxes at ~ 1 min⁻¹, but when charging it is less frequent - the app sort of does a calculation to evenly space out polls

e.g. zooming in to a time period from the above chart shows this:

Screen Shot 2024-08-01 at 9.28.45 am.png
 
All this seems quite interesting but could someone elaborate on how to do this (step by step) as I am not a stupid man but this is a bit of a programmers thing. Is there a help file somewhere
 
Page 1:

 
I run a home server for media and redundant storage. I have the ability to use home assistant if I want, but haven't yet tried it as Google Home has served my needs up to this point.

That all being said the iSmart app is complete rubbish, and barely functions half the time, like if the car is off for longer than a day it seems to never be able to connect to the car again until I either unlock it with the fob or physically get in the car. Does this HA integration work better than the app? Can I use it to finally be able to reliably control my car remotely?
 
IMG_3965.png

I'm using it. Need to test the heating and defrost ahead of winter as it logs me out of the app. Shame you can't have them both.

I also need to get it refreshing when I plug in etc... sometimes delays quite a bit and I have to enforce an update.
 

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