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

I also need to get it refreshing when I plug in etc... sometimes delays quite a bit and I have to enforce an update.
I have a home energy monitoring system (Iotawatt) integrated with HA. One of the circuits it monitors is the EV charging circuit. So I have a HA automation which polls the car every 10 minutes if the EV circuit power draw exceeds 500 W:

Code:
alias: "EV - SAIC Start polling when charge session starts "
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.input_10_garage_ev
    for:
      hours: 0
      minutes: 0
      seconds: 10
    above: 500
  - platform: time_pattern
    minutes: /10
condition:
  - condition: numeric_state
    entity_id: sensor.input_10_garage_ev
    above: 500
action:
  - service: select.select_option
    metadata: {}
    data:
      option: force
    target:
      entity_id: select.<mycarID>_gateway_refresh_mode
mode: single

I'm not sure it's actually necessary to poll every 10 minutes as I think all it needs is the initial poll after which the integration keeps doing so periodically, with a polling frequency adjusted based on the charge rate.

I may adjust that automation to just do it once and see how it goes.
 
I have a home energy monitoring system (Iotawatt) integrated with HA. One of the circuits it monitors is the EV charging circuit. So I have a HA automation which polls the car every 10 minutes if the EV circuit power draw exceeds 500 W:

Code:
alias: "EV - SAIC Start polling when charge session starts "
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.input_10_garage_ev
    for:
      hours: 0
      minutes: 0
      seconds: 10
    above: 500
  - platform: time_pattern
    minutes: /10
condition:
  - condition: numeric_state
    entity_id: sensor.input_10_garage_ev
    above: 500
action:
  - service: select.select_option
    metadata: {}
    data:
      option: force
    target:
      entity_id: select.<mycarID>_gateway_refresh_mode
mode: single

I'm not sure it's actually necessary to poll every 10 minutes as I think all it needs is the initial poll after which the integration keeps doing so periodically, with a polling frequency adjusted based on the charge rate.

I may adjust that automation to just do it once and see how it goes.
My pod point integration provides me the ability to know when it's connected. So force car update when connected and when charging stops should be enough for my card to be upto date.
 
Hi there,

another new owner of a MG4 Luxury here, and starting to play with the home assistant integrations. Quite excited when finding the SAIC integration ( GitHub - SAIC-iSmart-API/saic-python-mqtt-gateway ) but turns into big frustration since I'm unable to even configure the Add-On. I'm constantly getting a 'login error' just trying to Start the Add-on

2024-08-07 20:55:47,600 [ ERROR ] MqttGateway crashed due to an Exception during startup - main
Traceback (most recent call last):
File "/usr/src/app/./mqtt_gateway.py", line 441, in run
login_response_message = await self.saic_api.login()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 72, in login
result = await self.deserialize(req, response, LoginResp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 185, in deserialize
raise se
File "/usr/local/lib/python3.12/site-packages/saic_ismart_client_ng/api/base.py", line 170, in deserialize
raise SaicApiException(error_message, return_code=return_code)
saic_ismart_client_ng.exceptions.SaicApiException: return code: 15018, message: Incorrect password. You may have another 4 attempts of the day, please try again.
return code: 15018, message: Incorrect password. You may have another 4 attempts of the day, please try again.
2024-08-07 20:55:47,966 [ ERROR ] Task was destroyed but it is pending!
task: <Task pending name='Task-1' coro=<Client._resend_qos_messages() running at /usr/local/lib/python3.12/site-packages/gmqtt/client.py:176>> - asyncio
sys:1: RuntimeWarning: coroutine 'Client._resend_qos_messages' was never awaited


I'm 100% sure that the user (Phone number) and password are correct, since I can log in via the APP with no issues.

It shouldn't be so difficult when all you guys have been able to set up the integration, so I guess I'm doing something wrong.

SAIC_MQTT_Gateway-config.PNG


Did you guys experienced something similar with the authentication?

If it helps for the context, I'm running HA in a Raspberry PI 3B:

SAIC_version.PNG

HA_version.PNG
 
Did you also check the MQTT credentials (User/Password)?

You could leave following options blank, as the gateway works ok with default values
  • SAIC_PHONE_COUNTRY_CODE
  • SAIC_REST_URI
  • SAIC_REGION
  • SAIC_TENANT_ID
 
I seem to recall an issue with having a phone number as the username, this is going back quite a while now so might not be an issue any more, maybe the config of SAIC_PHONE_COUNTRY_CODE and SAIC_USER isn't quite right? (should the country code have a '+' ? Do you have to remove/include the first digit of the phone number?)

I've just checked mine and I used my email address - which works fine. Might be worth registering your email and trying that?
 
[SOLVED] Good news! Changing the user name to the mail address and deleting the country code (not sure if this is really necessary, but I asume that with the mail address, country code doesn't make sense)

Additionally, I also deleted
  • SAIC_REST_URI
  • SAIC_REGION
  • SAIC_TENANT_ID
But even tough I save the fields with empty values, they are populated again automatically, so it seems that wasn't the issue.

Conclusion, user name must be the mail address. Phone number doesn't work.

Thanks all for your help. Now starting to play to find fancy dashboards
 
[SOLVED] Good news! Changing the user name to the mail address and deleting the country code (not sure if this is really necessary, but I asume that with the mail address, country code doesn't make sense)

Additionally, I also deleted
  • SAIC_REST_URI
  • SAIC_REGION
  • SAIC_TENANT_ID
But even tough I save the fields with empty values, they are populated again automatically, so it seems that wasn't the issue.

Conclusion, user name must be the mail address. Phone number doesn't work.

Thanks all for your help. Now starting to play to find fancy dashboards
Phone number definitely does work. I have mine configured for my phone number, but this is because my account was setup using my phone number, I don't have a registered account using an email address. For those that use a phone number just omit the 0 at the start of it and use the country code 44 (in the UK). 044 and +44 are not recognised.
 
Last edited by a moderator:
Phone number definitely does work. I have mine configured for my phone number, but this is because my account was setup using my phone number, I don't have a registered account using an email address. For those that use a phone number just omit the 0 at the start of it and use the country code 44 (in the UK). 044 and +44 are not recognised.
It doesn't to me. Then let's take it as another option to try to those with the same issue.
 
@wattmatters, I saw "Monthly km" on your dashboard. Have you implemented this using a utility meter helper? I have done this on my end and found that it always loses a few kilometres compared to the odometer. Have you noticed the same?
 
I case it helps anyone else, I'd like to share an automation that I'm quite happy with. It uses the MG and Ohme integrations.

Background:
1. My parking space, and thus my Ohme Home Pro charger, are in a communal garage. I have therefore configured the charger to require approval when plugged in.

2. MG is not fully supported by Ohme, i.e. the charger does not know the current SoC. You can only tell it to add x% to the battery but not to charge up to y%.

Goal:
Automatically configure the charger for the percentage needed to reach my car's set charge limit and approve the charge when I can assume it's me. I.e. plug in the car and be done. :)

Automation:
1. Template sensor helper "MG4 Target SoC Delta", reports the difference between current SoC and set target SoC (rounded up).
YAML:
{{ (states('number.<car VIN>_target_soc') | float - states('sensor.<car VIN>_soc') | float) | round(0, 'ceil') }}

2. Automation triggered by pending approval and plugging in the car. Checks if (a) car is in home zone, (b) car is connected and (c) there is an approval pending. Sets Ohme charge target to required delta (+1) to be safe) and approves charge.
YAML:
alias: EV - Set and Approve Home Charge
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.<car VIN>_charger_connected
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.ohme_pending_approval
    to: "on"
condition:
  - condition: zone
    entity_id: device_tracker.<car VIN>_vehicle_position
    zone: zone.home
  - condition: state
    entity_id: binary_sensor.<car VIN>_charger_connected
    state: "on"
  - condition: state
    entity_id: binary_sensor.ohme_pending_approval
    state: "on"
action:
  - metadata: {}
    data:
      value: "{{ states('sensor.mg4_target_soc_delta') | int + 1 }}"
    target:
      entity_id: number.ohme_target_percent
    action: number.set_value
    alias: Set Ohme Target to MG4 Delta + 1
  - metadata: {}
    data: {}
    target:
      entity_id: button.ohme_approve_charge
    action: button.press
    alias: Press Approve Charge
mode: single
 
@wattmatters, I saw "Monthly km" on your dashboard. Have you implemented this using a utility meter helper? I have done this on my end and found that it always loses a few kilometres compared to the odometer. Have you noticed the same?
Just a utility meter helper.

Can't say I've noticed what you describe. Right now it reports:

Screen Shot 2024-08-17 at 11.28.23 am.png


And the odometer reading at end of July was 10,928km, so that tallies.

Looking back at the monthly numbers as they increment and comparing to the odometer sensor difference at end of each month, they tally up.
 
Thanks, wattmatters. Mine seems to be working for the last few trips now too. In the beginning it drifted a bit and lost a few km (~6% at the moment).

I'll keep an eye on it. There isn't much configuration that could be wrong.

1724052935504.png
 
Thanks, wattmatters. Mine seems to be working for the last few trips now too. In the beginning it drifted a bit and lost a few km (~6% at the moment).
It might be a poll timing thing, or perhaps a loss of data signal. If the most recent poll of the car's data was before you had finished driving, that might explain a loss of some km.
 
I case it helps anyone else, I'd like to share an automation that I'm quite happy with. It uses the MG and Ohme integrations.

Background:
1. My parking space, and thus my Ohme Home Pro
Thanks for this. I've adapted it and am running it on my system now.
 
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
Hi, as one of the developers..... are there any plans to be able to control V2L from the add-on. It would be great to be able to control from HomeAssistant rather than setting it up in the car. By the way great add on as it is, use it everyday...thanks for that.
 
I would guess no. This will only be able to match the features in the official app at a guess.
 
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.
@nanomad, @wattmatters or anyone else using the mqtt add on - I set up the mqtt add on in HA the other day and all connected well, but when I was out and about in the car and connected the HA app via wireguard VPN through my Asus router at home to my server, none of the entities for my MG were available on my dashboard. The rest of my dashboard entities were there as usual though. Is that expected behaviour? It may have been that the mobile signal was too weak at times - looking at the history back at home later, there were times when the data connection was lost. Or do I need to connect via ddns instead? Thanks
 
Last edited:
Hey there, I am pretty happy about this integration, altough I am missing some settings.

I am working on "heat up my interior" automatically, and I have found the "remote temperature" on MQTT, but for some reason, there is no entity for that entry.
1729696240898.png


I found out, even when I put that temperature to max, just to heat up fast (?) during the 10min of heat up automation, the remote temperature is set back to "default" 22°C while drinve the car etc?

I wonder how I can set it to max (30°C) for the automation before enabling entity:
"climate.lsjwh4096pn192965_vehicle_climate"


Happy so read any suggestions! Thanks alot!
 

Are you enjoying your MG4?

  • Yes

    Votes: 910 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