Closed DreamT80 closed 9 months ago
The basic implementation of control commands is done in the saic-python-client. The problem is that starting the A/C includes a temperature value that depends on the car model. Same for starting front defrost. The reverse engineering has been done with an MG5. I could implement these commands for an MG5 right now. For other car models additional reverse engineering is required. If you want to contribute, you can record and analyze the request from the app as described in the reverse engineering project.
Thank you for the clarification. I have a ZS, and will try to contribute in the near future.
The feature is implemented in the develop branch. would you be able to test it?
By the way... The temperature values seem to be the same for the MG5 and the ZS.
The feature is implemented in the develop branch. would you be able to test it?
I did some testing, here's my report:
Both saic/[user]/vehicles/[vin]/climate/remoteClimateState/set on/off and saic/[user]/vehicles/[vin]/climate/frontWindowDefrosterHeating/set on/off worked like they should. Great!
should saic/[vin]/remoteClimateState instead be published under should saic/[user]/vehicles/[vin]/remoteClimateState instead, or do I understand it wrong? Also, I didn't see that it ever changed from 0 to 1, when i ran saic/[user]/vehicles/[vin]/climate/remoteClimateState/set on.
There also is an 'AC blow mode' in the app. Basically it's only the fan blowing without AC. It doesn't seem to be implemented. (No big deal for me, but it can be good to know).
Great work! Really nice that the AC control works now.
Thanks for your feedback @DreamT80
Thanks for your feedback @DreamT80
- I don't have the topic saic/[vin]/remoteClimateState on my broker and I don't find the code that generates this topic. Could be that it comes from a previous version or from one of your tests. You could delete the topic in MQTT Explorer and check whether it is re-created.
- The 'AC blow mode' is implemented in the saic-python-client, but I didn't know where to put it in the MQTT topic hierarchy
Does setting AC blow mode have a result in the API? maybe a different state in remoteClimateState? If so its should probably be a new possible value for remoteClimateState/set.
Does setting AC blow mode have a result in the API? maybe a different state in remoteClimateState? If so its should probably be a new possible value for remoteClimateState/set.
I don't know about how it looks in the API, but if that is the case it sounds logical that it should result in a new remoteClimateState value.
I checked sending AC blow mode. It sets remoteClimateState
to 1, so we can distinguish it from the other states.
There is also an explicit stop blow mode command, but the generic stop remote A/C also works, so I don't think it is needed to take the current remoteClimateState value into account when disabling and just send the current off command.
Let's discuss on how to call the new state in the discussions: https://github.com/orgs/SAIC-iSmart-API/discussions/6#discussioncomment-6140892
Reference implementation in Java: https://github.com/SAIC-iSmart-API/saic-java-client/pull/31
I would really like to test the temperature values on the ZS. Where can I find the actual mappings that have been tested for the MG5?
Is there any limitations with MG5 Comfort (afaik no internal temp. sensor as there is no A/C Automatic Temperature Control included) compared to Luxury (with Automatic A/C) when using the A/C toggle via API. Just wonder what A/C does when switched on - just using the last „cooling/heating“ value which had been set on the last ride in the car?
Is there any limitations with MG5 Comfort (afaik no internal temp. sensor as there is no A/C Automatic Temperature Control included) compared to Lixury (with Automatic A/C) when using the A/C toggle via API. Just wonder what A/C does when switched on - just using the last „cooling/heating“ value which had been set on the last ride in the car?
That is a very good question. :) Can you share the country the MG5 you are talking about is from? Is it the Facelift version or the previous one? Do you have a chance to test it?
Is there any limitations with MG5 Comfort (afaik no internal temp. sensor as there is no A/C Automatic Temperature Control included) compared to Lixury (with Automatic A/C) when using the A/C toggle via API. Just wonder what A/C does when switched on - just using the last „cooling/heating“ value which had been set on the last ride in the car?
This is an interesting use case... we can probably handle it. I'd love to see the content of the folliowing topic:
saic/MAIL/vehicles/VIN/_internal/configuration/raw
There's no confidential info in there, just data used by the app to self-configure itself
That is a very good question. :) Can you share the country the MG5 you are talking about is from? Is it the Facelift version or the previous one? Do you have a chance to test it?
I myself use an MG5 Comfort (Germany, Model Year 2021) w/o Automatic Climate Control and when you remotely start A/C it is always a surprise what the car does (heat or cool), especially during winter time it is annoying when the car does not get heated up but only cold air blown in.
Sure I could test - but I am not experienced with py, MQTT etc. and just using the ready to use docker image (latest) and have no experience creating a docker image myself from scratch.
I don't see topic saic/MAIL/vehicles/VIN/_internal/configuration/raw
in my MQTT explorer, but instead of _internal I just used info
saic/MAIL/vehicles/VIN/info/configuration/raw
showing the following result
name:Tire,code:J17,value:1;name:Airbag,code:Q00,value:1;name:FAirbag,code:Q01,value:1;name:AirbagS,code:Q09,value:1;name:Sunroof,code:S35,value:0;name:Remote control,code:S61,value:1;name:AC,code:T11,value:1;name:EPS,code:EPS,value:1;name:SA64,code:SA64,value:0111110000000000001000000100101000000010100000000000000000000110;name:BONNUT,code:BONNUT,value:1;name:DOOR,code:DOOR,value:1111;name:BOOT,code:BOOT,value:1;name:ENGINE,code:ENGINE,value:1;name:EV,code:EV,value:0;name:HeatedSeat,code:HeatedSeat,value:0;name:KEYPOS,code:KEYPOS,value:1;name:ENERGY,code:ENERGY,value:0;name:BATTERY,code:BATTERY,value:1;name:INTEMP,code:INTEMP,value:1;name:EXTEMP,code:EXTEMP,value:1;name:WINDOW,code:WINDOW,value:0000;name:LRD,code:LRD,value:0;name:BTKEY,code:BTKEY,value:0;name:Battery,code:BType,value:2
OK, don't worry about testing, if you have little experience with the setup...
So, if you say 2021 german model, it must be the facelift, should be 2022 though, that is what is wondering me a little bit, afaik the first mg5 came in May 2022? Just to be sure you are not some exception...
The "it is a surprise", you mean with the app, or with the gateway?
With the gateway, as of today, you cannot set temperature, only AC or Blowing:
climate/remoteClimateState:
in your case I would expect only AC on/front/blowingOnly, and what we will do as "remoteTemperature" should somehow set the fan speed, but we will need to test this, I think the first java version will be released relatively soon... ;)
@tisoft , @nanomad, it would be great if we could push the model of the car (in Java API from vinInfo.getSeries()) to some topic in order to have the chance to see if this kind of cases can be handled somehow...
@mschmiedel It's already available under SAIC/<EMAIL>/vehicles/<VIN>/info/series
So looking at the car configuration topic we cannot do much from there, the only choice is using the series (as the app does for other stuff) and then using that for some feature gates. The same approach is already in place to decode the AC temp anyway
@cybersmart-eu can you provide a dump of the whole SAIC/<EMAIL>/vehicles/<VIN>/info
sub-topics?
@mschmiedel It's already available under
SAIC/<EMAIL>/vehicles/<VIN>/info/series
So looking at the car configuration topic we cannot do much from there, the only choice is using the series (as the app does for other stuff) and then using that for some feature gates. The same approach is already in place to decode the AC temp anyway
Yep, I am personally implementing this feature on the Java Gateway, and I am 100% sure we do not have the info/series topic there, will add it soon. And yes, I am seeing that it is documented (https://github.com/orgs/SAIC-iSmart-API/discussions/6), so only needs to be added on all gateways, this helps to find out what happens on certain configurations...
In the vehicle data the MG5 is shown as MY 2021 - this is the Facelift sold 2022 in Germany.
Will send the content of /info once I have access at home this evening.
The "it is a surprise", you mean with the app, or with the gateway?
I mean the car :-) In the App you can just remotely switch on A/C and in winter time, although really cold outside, this sometimes did not heat the car but just started blowers. On other days the car was pre heated.
But without any reasoning which could habe explained go me why the remote A/C led to different results. So I was hoping having more granular control with the gateway by providing a target temperature.
@cybersmart-eu can you provide a dump of the whole
SAIC/<EMAIL>/vehicles/<VIN>/info
sub-topics?
@nanomad How can I create a dump? I am using MQTT Explorer and it does not allow me to dump incl. sub-topics. I can add a screenshot however.
That's fine. So EP2 is the MG5 CP3 then is the Comfort facelift version
Just out of curiosity, since the API reports you have both inside and outside temperature sensors, what's the value of interiorTemperature and exteriorTemperature under the climate topic? Does it make any sense?
Remote A/C uses an algorithm akin to an "auto" fan speed, but it should respect the temperature set. Also, did you try the AC on auto with the MQTT gateway? What does it do? If you use Home Assistant with the latest python gateway it should auto-create the climate entity for you
I am not using Home Assistent, I integrate with a Timberwolf KNX Server via MQTT, very powerful server in a KNX environment with MQTT, Modbus RTU and TCP, 1wire Subsystems already embedded. Also InfluxDB and Grafana running on the system ready to go and very easy to connect all objects with TimeSeries.
Will check temp values, but in the car there is no internal temp shown at all as there is no automated climatic control in the Comfort. But acc to the data the internal temperature should be available as the sensor seems to be installed.
Will check and come back to you.
@cybersmart-eu I think I've found a gap in the way we send A/C commands in the API code. I've put some notes there
(I guess that this is already in the works, but it would be nice to get a status update).
It would be great if you'd add support for controlling the A/C. If I look in the documentation for the API, it seems like there is support for it in the API.
(Start/Stop A/C, Start/Stop A/C blowing, Start/Stop front defrost)