Skip to content

Commit

Permalink
rename Timer to AirConditioningTimer + update api_endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
prvakt committed Jan 7, 2025
1 parent ac34104 commit fe5940f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/api_endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
| EnergyX | POST | api/v2/air-conditioning/{vin}/settings/ac-at-unlock || |
| EnergyX | POST | api/v2/air-conditioning/{vin}/settings/seats-heating || |
| EnergyX | POST | api/v2/air-conditioning/{vin}/settings/target-temperature || |
| EnergyX | POST | api/v2/air-conditioning/{vin}/timers | | |
| EnergyX | POST | api/v2/air-conditioning/{vin}/timers | | |
| EnergyX | POST | api/v2/air-conditioning/{vin}/settings/windows-heating || |
| EnergyX | POST | api/v2/air-conditioning/{vin}/settings/ac-without-external-power || |
| EnergyX | POST | api/v2/air-conditioning/{vin}/auxiliary-heating/timers | | |
Expand Down
4 changes: 2 additions & 2 deletions myskoda/models/air_conditioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HeaterSource(StrEnum):


@dataclass
class Timer(DataClassORJSONMixin):
class AirConditioningTimer(DataClassORJSONMixin):
enabled: bool
id: int
time: time
Expand Down Expand Up @@ -148,7 +148,7 @@ class Config(BaseConfig):
class AirConditioning(DataClassORJSONMixin):
"""Information related to air conditioning."""

timers: list[Timer]
timers: list[AirConditioningTimer]
errors: list[Any]
state: AirConditioningState
steering_wheel_position: Side = field(metadata=field_options(alias="steeringWheelPosition"))
Expand Down
9 changes: 7 additions & 2 deletions myskoda/models/auxiliary_heating.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
from mashumaro.config import TO_DICT_ADD_BY_ALIAS_FLAG, TO_DICT_ADD_OMIT_NONE_FLAG, BaseConfig
from mashumaro.mixins.orjson import DataClassORJSONMixin

from .air_conditioning import HeaterSource, OutsideTemperature, TargetTemperature, Timer
from .air_conditioning import (
AirConditioningTimer,
HeaterSource,
OutsideTemperature,
TargetTemperature,
)


class AuxiliaryState(StrEnum):
Expand Down Expand Up @@ -65,7 +70,7 @@ def __pre_serialize__(self) -> "AuxiliaryConfig":
class AuxiliaryHeating(DataClassORJSONMixin):
"""Information related to auxiliary heating."""

timers: list[Timer]
timers: list[AirConditioningTimer]
errors: list[Any]
state: AuxiliaryState | None = field(default=None, metadata=field_options(alias="state"))
start_mode: AuxiliaryStartMode | None = field(
Expand Down
4 changes: 2 additions & 2 deletions myskoda/myskoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
from .models.air_conditioning import (
AirConditioning,
AirConditioningAtUnlock,
AirConditioningTimer,
AirConditioningWithoutExternalPower,
SeatHeating,
Timer,
WindowHeating,
)
from .models.auxiliary_heating import AuxiliaryConfig, AuxiliaryHeating
Expand Down Expand Up @@ -283,7 +283,7 @@ async def stop_auxiliary_heating(self, vin: str) -> None:
await self.rest_api.stop_auxiliary_heating(vin)
await future

async def set_ac_timer(self, vin: str, timer: Timer) -> None:
async def set_ac_timer(self, vin: str, timer: AirConditioningTimer) -> None:
"""Send provided air-conditioning timer to the vehicle."""
future = self._wait_for_operation(OperationName.SET_AIR_CONDITIONING_TIMERS)
await self.rest_api.set_ac_timer(vin, timer)
Expand Down
4 changes: 2 additions & 2 deletions myskoda/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
from .models.air_conditioning import (
AirConditioning,
AirConditioningAtUnlock,
AirConditioningTimer,
AirConditioningWithoutExternalPower,
SeatHeating,
Timer,
WindowHeating,
)
from .models.auxiliary_heating import AuxiliaryConfig, AuxiliaryHeating
Expand Down Expand Up @@ -585,7 +585,7 @@ async def set_departure_timer(self, vin: str, timer: DepartureTimer) -> None:
json=json_data,
)

async def set_ac_timer(self, vin: str, timer: Timer) -> None:
async def set_ac_timer(self, vin: str, timer: AirConditioningTimer) -> None:
"""Set air-conditioning timer."""
_LOGGER.debug(
"Setting air-conditioning timer #%i for vehicle %s to %r", timer.id, vin, timer.enabled
Expand Down

0 comments on commit fe5940f

Please sign in to comment.