Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOC not showing in HA #6

Closed
wj-brown opened this issue Sep 18, 2024 · 7 comments · Fixed by #7
Closed

SOC not showing in HA #6

wj-brown opened this issue Sep 18, 2024 · 7 comments · Fixed by #7
Labels
bug Something isn't working

Comments

@wj-brown
Copy link

wj-brown commented Sep 18, 2024

Hi,

Set up the integration via HACS - logged in fine and has pulled through number of sensors, however I'm missing State of Charge.
Car is a MG ZS EV (fully electric). Have run debug per the comments on the HA community page and have noted that vehicle type on the output is ICE rather than BEV which I'm assuming is causing the SOC sensor to not be added to HA.

I don't really know coding but the way the vehicle type is classified makes sense so I think this may be an issue caused by the data on the SAIC/MG side.

Attached the log output. Just let me know if you need anything further. Thanks for creating the integration, looking forward to hopefully getting SOC sensor working.

home-assistant_2024-09-18T21-17-59.097Z.log

@ad-ha
Copy link
Owner

ad-ha commented Sep 18, 2024

Hi @wj-brown

Thanks for this. Let me have a look and will let you know.

In the meanwhile, can you try to reload the integration? During my tests, the same happened to me, as a Marvel R Electric came as a PHEV because the MG API reports wrong data on the vehicle type (mine, is Electric but for MG API it is not, as the API returns a 0 on the Electric check).. Odd things from MG/SAIC. That's why I had to add an additional check for "Electric" in the name.

Try to reload and see if it changes on new data check. Thanks

@ad-ha
Copy link
Owner

ad-ha commented Sep 18, 2024

And found it. Looking into your log, it happens the same as myself: with the EV check from the API.

VehicleModelConfiguration(itemCode='EV', itemName='EV', itemValue='0'),

The issue is that your model name does not mention Electric on it. Although, having Battery and so forth the integration should mark it as a PHEV.

Again, try to reload the integration and see if it works.

I will try to mess a bit around and see if there is a way that I can make this check into the configuration process and get the user to correct any issue during the setup process. Although, that will take me a while to figure it out.

If not, I will try to add additional checks based on the data available.

Let me know if reloading resulted in any change.

@wj-brown
Copy link
Author

Hi @ad-ha

Reloaded the integration and no change unfortunately. Also tried logging back into the MG iSmart app then reloading to see if it did anything but no change.

Don't know if it will help but in the Vehicle Charging Data bmsPackSOCDsp=774 is the current state of charge of the battery - it's 77% at the moment.

Will be taking the car out tomorrow so will see if running it for a bit triggers any changes and will let you know.

@ad-ha
Copy link
Owner

ad-ha commented Sep 18, 2024

HI @wj-brown

Thanks for checking. I guess that not having anything mentioning "Electric" on the name results as the integration not identifying the model as electric. The issue is on MG for not being providing the data correctly.

I will check the API and see if I find a workaround.

Don't know if it will help but in the Vehicle Charging Data bmsPackSOCDsp=774 is the current state of charge of the battery - it's 77% at the moment.

That's where the integration is looking for the SOC. The thing is that I've tried to get the sensors to be related to the vehicle type, so, for example, a BEV would not have a Fuel Level or Fuel Range sensor showing with a 0 value. The same for an ICE, that does not need a SOC sensor. IN hindsight maybe I added an additional complexity layer, but I thought that it would be better for the users... until is not and MG does not record their vehicles correctly.

Let me see if in the upcoming days I am able to find a solution for the matter.

Thanks for the feedback

@ad-ha ad-ha added the bug Something isn't working label Sep 19, 2024
@ad-ha ad-ha mentioned this issue Sep 19, 2024
Merged
@ad-ha ad-ha closed this as completed in #7 Sep 19, 2024
@ad-ha
Copy link
Owner

ad-ha commented Sep 19, 2024

Hi @wj-brown

Just released a new version addressing what I commented yesterday. I found a way to easily add an additional step to the configuration so you may select the correct vehicle type.

You will need to remove the integration and add it again. Check if it works that way and let me know.

Thanks again for the help.

@wj-brown
Copy link
Author

Hi @ad-ha

Updated and added again - works perfectly.

Thanks so much

@ad-ha
Copy link
Owner

ad-ha commented Sep 19, 2024

Glad it did work out.

Hope you enjoy it.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants