Open prvakt opened 4 days ago
decided to have a look into decompiled MySkoda.apk and I think we need to rewrite it a little more. Following parameters are allowed for start-auxiliary-heating request
name = "spin"
name = "durationInSeconds"
name = "startMode"
name = "targetTemperature"
and there is one more request structure
name = "spin"
name = "targetTemperature"
name = "heaterSource"
name = "airConditioningWithoutExternalPower"
which is used for most likely AIR_CONDITIONING_HEATING_SOURCE_AUXILIARY capability (the one which is working on my Superb)
Thanks @prvakt for putting your time into this!
Looking at the complexity of your last remark, it may be a good idea to use some model
s to work this out further, combined with
1) A generic method in myskoda
to handle the uniform call to the library which then
2) Splits up into multiple myskoda.rest_api
calls for addressing the specific API calls down the line
Also: If you have any defaults, such as the 600
seconds for the default heater duration, please add them to const.py
and import them, avoid using those directly in code.
Thanks @prvakt for putting your time into this!
Looking at the complexity of your last remark, it may be a good idea to use some
model
s to work this out further, combined with
- A generic method in
myskoda
to handle the uniform call to the library which then- Splits up into multiple
myskoda.rest_api
calls for addressing the specific API calls down the lineAlso: If you have any defaults, such as the
600
seconds for the default heater duration, please add them toconst.py
and import them, avoid using those directly in code.
But there is always only single API call to myskoda just with different parameters ...
I don't know if I believe myself in such intervention in the code with my python knowledge especially If I don't have vehicle where I can test it before publishing to the world 🙈
Will try to figure out something heh
tested everything & works as expected
found something usefull now, need to test it first
class Config(BaseConfig):
serialize_by_alias = True
omit_none = True
checked the decompiled apk one more time and seems like I need to implement 1 additional api request and separate auxiliary class because there are two GET methods
/v2/air-conditioning/{vin}
/v2/air-conditioning/{vin}/auxiliary-heating
the first is already implemented and for my Superb it returns also auxiliary-heating info but the second is probably for combustion vehicles with only auxiliary-heater and structure is slightly different (tried to send this one for my car but it return error 500
just to summarize my findings. There are 2 endpoints for retrieving air-conditioning related data
/v2/air-conditioning/{vin}
/v2/air-conditioning/{vin}/auxiliary-heating
PHEV vehicles (or at least my Superb iV) can retrieve AuxiliaryHeater status only from the first method ICE vehicles (based on the discussion and trace from discord) are using second endpoint to retrieve this data # PHEV vehicles can start auxiliary heating using both POST methods
/v2/air-conditioning/{vin}/start
/v2/air-conditioning/{vin}/auxiliary-heating/start
if I put SPIN to first method and set heaterSource
: AUTOMATIC
car will start AUXILIARY heater (just don't know what will happen in summer when outside temperature will be bigger than targetTemperature - I guess maybe the car will start cooling)
for second method there is no need to set heaterSource
, seems like its chosen automatically
For both methods I can also choose targetTemperature
#
ICE vehicles can start auxiliary heater using only second POST method
/v2/air-conditioning/{vin}/auxiliary-heating/start
additionally there are follwing options depending on the car
durationInSeconds
targetTemperature
startMode
(VENTILATION
or HEATING
)
#I have implemented auxiliary-heater using the /v2/air-conditioning/{vin}/auxiliary-heating/start
endpoint and with the possibility of pass all allowed parameters (source, duration, targetTemp and startMode). Only those which are not None will be serialized and sent inside the request
Retrieval of heating related data can be handled in HA by choosing get_air_conditioning()
or get_auxiliary_heating()
based on the car type / capability.
auxiliary-heater for combustion cars is using different request format so it needs to be handled separately