SAIC-iSmart-API / saic-java-client

MIT License
6 stars 3 forks source link

Add HVAC / Rear Window Heat temperature controls #50

Open mschmiedel opened 1 year ago

mschmiedel commented 1 year ago

I am thinking of starting to implement this feature. Since there are some unknown variables here, I am offering to make a first draft and try to iterate through this together.

What we know?

Using the topics from here:

Since this will already be startet, try to see if backWindowHeat can be implemented (though I am not sure if it will be testable before winter)...

My proposal is to make an implementation trying to consider these aspects, and ask people with different car configurations to test it and improve it.

mschmiedel commented 12 months ago

So, first draft is out there, @tisoft, feel free to test it out, I will be retesting this week.

For other models, I am not aware of any different mappings, but I set the first stone on how it could look like in the future. It would also be possible to allow users to generate a yaml config that can configure the whole mapping, however I am not sure if we want end-users to potentially send invalid data to the SAIC API... So this part should be further discussed...

tisoft commented 12 months ago

The different App versions contain several mappings. It is unclear to me which of them are really used.

India: https://github.com/SAIC-iSmart-API/decompiled-app/blob/9932f224a5179d82352a06df4801319018b00d24/sources/com/saic/cmp/business/home_page/air_conditioner/View/AirConditionerAdapter.java#L48-L302

Europe: https://github.com/SAIC-iSmart-API/decompiled-app/blob/0ef0061c2c9a64dd75afe6afdea6f428f0d768e8/sources/com/saic/cmp/business/home_page/air_conditioner/View/AirConditionerAdapter.java#L51-L215

Australia: https://github.com/SAIC-iSmart-API/decompiled-app/blob/c0e4776c43ca3464a3afba1e9d1e530fe359bac0/sources/com/saic/cmp/business/home_page/air_conditioner/View/AirConditionerAdapter.java#L48-L165

Thailand: Seems to be unsupported?

mschmiedel commented 12 months ago

OK, nice to see, here some parts I found in the Europe Version as reference:

public static final String DEFAULT_EH32_VEHICLE_NAME = "MG4 Electric"; public static final String DEFAULT_EP21_VEHICLE_NAME = "Marvel R Electric"; public static final String DEFAULT_EP22_VEHICLE_NAME = "MG5 Electric";

This is called this way:

if (isEH32()) { getClimateControlDelegate().airConditioning(getTemperatureByteEH32(this.temperature), this.temperature); } else { getClimateControlDelegate().airConditioning(getTemperatureByteEP21(this.temperature), this.temperature); }

Other methods like getTemperatureByte and getTemperatureByteZS11E are dead code, so it is really only handling the MG4 differently.

About the regions, I am assuming from what I saw, that the only difference is the temperature range, but I will check it further. However this mapping seems like the way to go, maybe plus region variations... Good that all the info is in the vinlist...

Edit about regions: Australia and Europe have the same mapping, but Australia seems to only support the ZS (and maybe MG5) with App... India has a completely different mapping, will check that out, maybe we find a way to map according to region / series, and for all others just send the default value...

mschmiedel commented 12 months ago

One more thing I will be trying to cover:

tisoft commented 8 months ago

The base change has been merged, resending AC commands on temperature change is not yet implemented