API integration

I had a go at getting this integration installed and with a fair bit of help from the good people on the HA user forums* I have it running.

Working on some dashboards, but the nice thing with this is I can have a dashboard operating on both my and my wife's phone whereas iSmart is limited to one device at a time. Indeed there may never be a need for iSmart.

Will use something like this for a phone dashboard:

Screen Shot 2024-03-27 at 10.27.54 am.png


We don't need defrosting, so left those control out. I can still get them via the main dashboard if ever needed.

Some prettying up with a pic of the car etc might be nice.

As to the rest of it, it's a work in progress.

Screen Shot 2024-03-27 at 10.06.07 am.png


Be interested to see what others have come up with.

Charging is managed with ChargeHQ at present but I think ultimately I may bring that into Home Assistant as well as I have so many considerations for optimising use of our power supply - a combination of using our solar PV most of the time but also the tariff free energy windows our electricity retailer provides on weekends.

* My process/experience starts here and goes on for some number of posts back and forth nutting out the issues:

I note my SAIC MQTT feed went offline this morning a bit after 5AM. Not sure if that's a connectivity issue or something else.

I am able to log in using the iSmart app, so not sure what's up.

Edit: I restarted the add on:
SAIC MQTT Gateway (Python) (legacy)
And it seems to have come back to life.


And on this, with the dozens of variables it is curious the ones not available which are via an OBD reader, e.g. Battery State of Health, cell voltage minimum, maximum and delta.

Phone dashboard so far:

IMG_9C240A50E8B6-1.jpeg
 
Is this something the masses can use or is it too complicated?
Both :LOL:

Put another way, if Home Assistant is something you use now or plan to, then this can be a nice add on, but I wouldn't be setting up Home Assistant just for this.

I'm 2-3 years into my Home Assistant journey and I'm not an IT/comms guy so learning has been bit by bit. But the communities are good and helpful and it's been a useful hobby.

Home energy monitoring and management is the main use case for me, plus convenience of managing a range of things such as lights and fans etc from the phone. Now I have installed this integration I have an EV page (as well as the one for the phone):

I have a dashboard with all sort of stuff on it. Still needs organisation and it's a bit ugly, some people have designed all sorts of amazing looking dashboards with animated vehicle images but that's all beyond me.

There is lots of info is available, as well as control over various functions. It would be possible for instance to do some charging automations with this if you just wanted to use a basic charger and a suitably rated smart switch. I don't need that as I use ChargeHQ with my OCPP charge station.

Screen Shot 2024-03-28 at 5.05.45 pm.png


When I build up enough courage I hope to also bring my charging automations into Home Assistant. I have all sorts of parameters to consider for charging and while it is very good ChargeHQ can't cover for them all.

The mere fact I my Home Assistant now has access to state of charge data for the car is a big plus.
 
Both :LOL:

Put another way, if Home Assistant is something you use now or plan to, then this can be a nice add on, but I wouldn't be setting up Home Assistant just for this.

I'm 2-3 years into my Home Assistant journey and I'm not an IT/comms guy so learning has been bit by bit. But the communities are good and helpful and it's been a useful hobby.

Home energy monitoring and management is the main use case for me, plus convenience of managing a range of things such as lights and fans etc from the phone. Now I have installed this integration I have an EV page (as well as the one for the phone):

I have a dashboard with all sort of stuff on it. Still needs organisation and it's a bit ugly, some people have designed all sorts of amazing looking dashboards with animated vehicle images but that's all beyond me.

There is lots of info is available, as well as control over various functions. It would be possible for instance to do some charging automations with this if you just wanted to use a basic charger and a suitably rated smart switch. I don't need that as I use ChargeHQ with my OCPP charge station.

View attachment 25168

When I build up enough courage I hope to also bring my charging automations into Home Assistant. I have all sorts of parameters to consider for charging and while it is very good ChargeHQ can't cover for them all.

The mere fact I my Home Assistant now has access to state of charge data for the car is a big plus.
Sounds very impressive. Where should I start? What additional apps do I need etc?

Cheers
 
Sounds very impressive. Where should I start? What additional apps do I need etc?
 
One question about integration through API, will it keep iSmart logged in phone?
We use occasionally each others cars with my wife and I would like to config our MG into HA so I could use it through there and she could always stay logged in.
 
One question about integration through API, will it keep iSmart logged in phone?
We use occasionally each others cars with my wife and I would like to config our MG into HA so I could use it through there and she could always stay logged in.
As soon as the API is used to log in it takes ownership and it will result in all existing tokens being invalidated so if you are logged into your phone as well it will be logged out as soon as the API accesses the access. It means if your always running the API in something like HomeAssistant you will need to log in every time you try and use the phone (and may even have to when using it if the API tries to do something while your using it.
 
As soon as the API is used to log in it takes ownership and it will result in all existing tokens being invalidated so if you are logged into your phone as well it will be logged out as soon as the API accesses the access. It means if your always running the API in something like HomeAssistant you will need to log in every time you try and use the phone (and may even have to when using it if the API tries to do something while your using it.
Hmm, not so sure on this? I don't have this running permanently yet as I only downloaded the API onto my laptop to have a play with - but I do sometimes have it running for a few days at a time. I'm pretty sure it hasn't logged me out of the android app recently though? :unsure:
 
It should log you out. The only workaround is to share the digital key to another ismart account and use that to lock/unlock the car and remote start it.

But you'll have to treat home assistant as the complete replacement of the mg app (it will still pause for 15 mins if you login in the app but then it will retake control)
 
It should log you out. The only workaround is to share the digital key to another ismart account and use that to lock/unlock the car and remote start it.

But you'll have to treat home assistant as the complete replacement of the mg app (it will still pause for 15 mins if you login in the app but then it will retake control)
Is it constantly logging anything when running on your laptop i.e. are you sure its got any data?

It's really no different that two people sharing an email address. As soon as one person logs in the other person is kicked out, the API just sees someone access without the token and so generates a new one and thus the others user token is invalidated.
 
We use occasionally each others cars with my wife and I would like to config our MG into HA so I could use it through there and she could always stay logged in.
What I have done is create a dashboard in HA suitable for the phone screen and added that to the HA instance on both my wife's and my phones, so we both have the HA MG4 dashboard on our phones, along with a Home screen (for control of home lights, aircon and basic monitoring info) and lists for shopping and garden.

Phone dashboard is still a work in progress:

Screenshot 2024-05-16 at 4.23.05 AM.jpg
 
What I have done is create a dashboard in HA suitable for the phone screen and added that to the HA instance on both my wife's and my phones, so we both have the HA MG4 dashboard on our phones, along with a Home screen (for control of home lights, aircon and basic monitoring info) and lists for shopping and garden.

Phone dashboard is still a work in progress:

View attachment 26558

Looks great, thanks for answer!
So need to Build fully to HA, no problem. With my I-Pace I need to do same but with that I could use the remote app & WattCat (API derivative) at the same time, but ofc just Build that also to HA.
A lot to create around HA, tariff charging with evcc on Elli Pro chargers, House heating optimisation etc, but it is awesome.
 
I also created a kind of home dashboard for MG:
 

Attachments

  • HA MG4.png
    HA MG4.png
    2.4 MB · Views: 36
  • Screenshot_2024-05-17-11-53-55-22_c3a231c25ed346e59462e84656a70e50.jpg
    Screenshot_2024-05-17-11-53-55-22_c3a231c25ed346e59462e84656a70e50.jpg
    149.7 KB · Views: 4

Are you enjoying your MG4?

  • Yes

    Votes: 540 79.2%
  • I'm in the middle

    Votes: 91 13.3%
  • No

    Votes: 51 7.5%
Support us by becoming a Premium Member

Latest MG EVs video

MG3 Hybrid+ & Cyberster Configurator News + hot topics from the MG EVs forums
Subscribe to our YouTube channel
Back
Top Bottom