This project has been split up into several subprojects.
Please visit https://github.com/SAIC-iSmart-API for the current development.
SAIC-API Documentation (MG iSmart API, MG5 EV)
This project has been split up into several subprojects.
Please visit https://github.com/SAIC-iSmart-API for the current development.
Currently we have this project which contains the reverse engineered documentation and the java api and mqtt implementation. Additionally we have https://github.com/ReverseEngineeringDE/iSmart-Gateway-Home-Assistant-Add-on which contains the HA add-on.
We have a fork from @tosate, who implemented a python integration here: https://github.com/tosate/SAIC-API-Documentation/tree/main/saic-python-mqtt-gateway
I have a fork of the OpenHAB repository, containing the OpenHab plugin here: https://github.com/tisoft/openhab2-addons/tree/saic_api
There might be other language or home automation integrations later.
I would like to propose a new structure:
What do you think?
Explicitly pinging @ReverseEngineeringDE, @tosate, @mschmiedel, @weidi, @Tonno87 since all of you committed or forked one of the repos.
Hi there,
thank you for your impressive work so far. I am currently working on a Python version of the SAIC API. I am aware of the fact that a second codebase will add more maintenance, redundancy and bugs. However, my goal is to implement the basis for a Home Assistant integration or an openWB SoC module, so that those systems no longer rely on a running docker container. As a prove-of-concept, I have re-implemented your MQTT gateway.
Whether you like the idea of another implementation or not, what I can offer you is a code review since I have spend a lot of time with your code during the last weeks.
One thing that was confusing me, is the if-condition in the handleVehicle() method of the VehicleHandler class. I would expect that the VehicleHandler updates the status and then waits for another 15 minutes before it checks the status again. But what I see in the code is that it queries the API as often as possible for 15 minutes. After that it sleeps until an event from the MessageHandler wakes it up. When I subscribe to one of the topics, I see the same. My container starts up, publishes the mileage and the SoC more than 450 times. That means it sends more than 900 requests to the SAIC API. In parallel, it checks every second for new alarms.
I have read that you did not run into limitations with this yet. However, we might get into trouble when SAIC notices that some clients run heavily on steroids.
To avoid this behaviour I have implemented my VehicleHandler slightly different. The notifyCarActivity() method updates the lastActivityTime only.
def notify_car_activity(self, last_activity_time: datetime):
if (
self.last_car_activity is None
or self.last_car_activity < last_activity_time
):
self.last_car_activity = last_activity_time
self.publisher.publish_str(f'{self.vin_info.vin}/last_activity',
self.last_car_activity.strftime("%Y-%m-%d, %H:%M:%S"))
Things like forcing an update are handled in the while-loop of the handleVehicle() method.
while True:
if (
self.last_car_activity is None
or self.force_update
or self.last_car_activity < (datetime.datetime.now() - datetime.timedelta(minutes=self.configuration.query_vehicle_status_interval))
):
self.force_update = False
vehicle_status = self.update_vehicle_status()
charge_status = self.update_charge_status()
self.abrp_api.update_abrp(vehicle_status, charge_status)
self.notify_car_activity(datetime.datetime.now())
else:
# car not active, wait a second
print(f'sleeping {datetime.datetime.now()}, last car activity: {self.last_car_activity}')
time.sleep(float(1))
Kind regards,
Thomas
Installed said-java-mqtt-gateway via deb
If service is running syslog and daemon.log are flooded with all java-messages.
How to stop this kind of logging?
The ASN.1 files found in the apk seem to be of an old version old the protocol.
There seem to be several versions of the binary protocol. Which can be found in the packages under com.saicmotor.telematics.tsgp.otaadapter.mp.
The classes in that package are annotated with annotations from a custom fork of https://sourceforge.net/projects/bnotes/
The annotations completely describe the ASN.1 format.
My idea is to create an annotation processor, that reads those classes and recreates the ASN.1 specification.
What do you think about that idea?
Hallo,
erstmal vielen Dank für diese Software. Leider wird anscheindet die MQTT Verbindung zu meinem MQTT Server nach 5min getrennt
java.util.concurrent.ExecutionException: Client is not connected (32104)
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at net.heberling.ismart.mqtt.SaicMqttGateway.call(SaicMqttGateway.java:293)
at net.heberling.ismart.mqtt.SaicMqttGateway.call(SaicMqttGateway.java:67)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at net.heberling.ismart.mqtt.SaicMqttGateway.main(SaicMqttGateway.java:327)
Suppressed: Client is disconnected (32101)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.disconnect(ClientComms.java:507)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:818)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:779)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:788)
at org.eclipse.paho.client.mqttv3.MqttClient.disconnect(MqttClient.java:347)
at net.heberling.ismart.mqtt.SaicMqttGateway$1.close(SaicMqttGateway.java:176)
at net.heberling.ismart.mqtt.SaicMqttGateway.call(SaicMqttGateway.java:172)
... 10 more
Caused by: Client is not connected (32104)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:205)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.publish(MqttAsyncClient.java:1375)
at org.eclipse.paho.client.mqttv3.MqttClient.publish(MqttClient.java:570)
at net.heberling.ismart.mqtt.VehicleHandler.updateChargeStatus(VehicleHandler.java:549)
at net.heberling.ismart.mqtt.VehicleHandler.handleVehicle(VehicleHandler.java:79)
at net.heberling.ismart.mqtt.SaicMqttGateway.lambda$call$2(SaicMqttGateway.java:278)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Mit Wireshark sind die letzten Lebenszeichen
das der Server ein Websocket PING schickt und der Client darauf sofort die Verbindung schliesst
Trying to use the ismart-api-cli username password I initially get a The account is not registered.
response. After some looking around I notice that the app mentioned in the Getting Started section is for .europe and the app I have on my phone is .au - So I try modifying the endpoint URL to https://tap-au.soimt.com/... which gives me a different error message Incorrect password. You may have another 4 attempts of the day, please try again.
I have verified via java debugger that the password is correct (albeit complicated).
Has anyone had success with a non .europe account?
Has anyone had success with a complex password?
Cheers!
Hi everyone,
This is a great project! It worked first time using the CLI - but I'm having issues reading the numbers returned.
I'm just after the current charge level. I've attached a screenshot from the MG app showing 60% charge, and the JSON returned from running the JAR. I can see "bmsPackSOCDsp":1023 but I'm unsure how that relates, or how to convert it.
Can anyone shed any light for me? Thank you :)
Adam
mg4.txt
Proposed structure for the MQTT topic hierarchy:
Topic names in Italic are placeholders for the actual content. E.g. VIN is replaced by the actual VIN from the
vehicle. Not all vehicles support all functionality, so some of the subtopics will not be available for each type of
vehicle.
Hallo Zusammen,
tolles Projekt! Danke für eure Arbeit :)
Ich würde mir wünschen das die configfile so erweitert wird das man z.B. nur den SOC abfragen kann.
Für die meisten Anwender ist dieser Wert ausreichend, der Rest ist optional.
Auch hätte ich gerne eine Möglichkeit um die Intervalle der Abfrage zu ändern. Beim laden an der Wallbox sind meiner Meinung nach Werte von 1-2 min ausreichend. Um mit 11kw 1% zu laden dauert es länger als 2 Minuten. Daher sollte EVCC damit umgehen können.
Das erzeugt zum einen weniger Datenmüll und zum anderen wird es damit unwahrscheinlicher das die API abfragen irgendwann geblockt werden. Je mehr das Gateway benutzen desto eher wird das zum Problem werden.
Was meint ihr dazu?
Hello
Would it be possible to have a how-to for the mqtt if we are not using home assistant?
I installed the docker based on the link given on the GitHub but I don't find the configuration file in the etc folder. And I have no idea of what should be configured in this file.
Tx
Antoine
Hi all,
Sorry, I am a beginner with Android Virtual Device.
I managed to run an AVD with an armeabi-v7a iso of Marshmallow and push the iSMART apk with abd, but when I launch the app, it says "Update to V1.1.10, MG iSMART has some major updates, please update to the latest version.", and all I can do is to click the Update button, which launch the browser to the Google Play page of the app. But I can't download the apk from here (even if I log in with my Google account), it seems to detect that the device is not compatible (because it suggests to install the app to different devices instead). I can't find a 1.1.10 apk compatible with Marshmallow. And I failed installing Google Play Store app on Marshmallow so far.
Is everybody stuck with this app update, or am I missing something obvious to solve the issue?
Thank you for your help!
Hi, I am an owner of MG ZS EV 2022 Facelift. Currently iSmart is not available in my country. However, I was able to bind the iSmart app (UK) to my vehicle. But everything can't be loaded, probably the eSIM is not supported here.
Would like to confirm if the API provided by SOIMT can only be accessible from internet?
If my car has no internet connectivity, is that there is no way to receive the car's SOC information ?
Thanks!
First of all! Thanks for this fantastic project. I've been playing around with the APIs for roughly 11 months (ever since I got the ZS) - yet didn't have the time to go into all details.
For the ZS I currently use the following values:
bmsPackSOCDsp (% / 10), bmsEstdElecRng (km), fuelRangeElec (km / 10), mileageOfDay (km / 10), totalBatteryCapacity (kWh / 10), mileage (km / 10)
All of those match the car's values or my expectations. My idea is (among others) to calculate and show the daily average consumption.
However for powerUsageOfDay I have no clue how to interpret it. I was expecting the unit to be kW (after diving it by 10). However that cannot be the case: according to my logged data the car should be almost empty, but is still half full. Percentage also does not work for the same reason.
Also the power usage does not seem to correspond to the daily mileage:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.