Skip to content

Commit

Permalink
fixed MQTT endpoint for auxiliary-heating
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Prvak committed Nov 9, 2024
1 parent 144a50a commit 805128b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions myskoda/cli/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async def start_air_conditioning(
@click.option("timeout", "--timeout", type=float, default=300)
@click.argument("vin")
@click.pass_context
@mqtt_required
async def stop_air_conditioning(ctx: Context, timeout: float, vin: str) -> None: # noqa: ASYNC109
"""Stop the air conditioning."""
myskoda: MySkoda = ctx.obj["myskoda"]
Expand All @@ -47,6 +48,7 @@ async def stop_air_conditioning(ctx: Context, timeout: float, vin: str) -> None:
@click.option("timeout", "--timeout", type=float, default=300)
@click.argument("vin")
@click.pass_context
@mqtt_required
async def start_auxiliary_heating(
ctx: Context,
temperature: float,
Expand All @@ -63,6 +65,7 @@ async def start_auxiliary_heating(
@click.option("timeout", "--timeout", type=float, default=300)
@click.argument("vin")
@click.pass_context
@mqtt_required
async def stop_auxiliary_heating(ctx: Context, timeout: float, vin: str) -> None: # noqa: ASYNC109
"""Stop the auxiliary heating."""
myskoda: MySkoda = ctx.obj["myskoda"]
Expand Down
3 changes: 2 additions & 1 deletion myskoda/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"air-conditioning/set-air-conditioning-without-external-power",
"air-conditioning/set-target-temperature",
"air-conditioning/start-stop-air-conditioning",
"air-conditioning/start-stop-auxiliary-heating",
"auxiliary-heating/start-stop-auxiliary-heating",
"air-conditioning/start-stop-window-heating",
"air-conditioning/windows-heating",
"charging/start-stop-charging",
Expand All @@ -37,6 +37,7 @@
MQTT_SERVICE_EVENT_TOPICS = [
"air-conditioning",
"charging",
"departure"
"vehicle-status/access",
"vehicle-status/lights",
]
Expand Down
8 changes: 4 additions & 4 deletions myskoda/myskoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ async def stop_air_conditioning(self, vin: str) -> None:
async def start_auxiliary_heating(self, vin: str, temperature: float, spin: str) -> None:
"""Start the auxiliary heating with the provided target temperature in °C."""
# NOTE: 08/11/2024 - no response is published in MQTT (maybe bug in api?) so we don't wait
# future = self._wait_for_operation(OperationName.START_AUXILIARY_HEATING)
future = self._wait_for_operation(OperationName.START_AUXILIARY_HEATING)
await self.rest_api.start_auxiliary_heating(vin, temperature, spin)
# await future
await future

async def stop_auxiliary_heating(self, vin: str) -> None:
"""Stop the auxiliary heating."""
# NOTE: 08/11/2024 - no response is published in MQTT (maybe bug in api?) so we don't wait
# future = self._wait_for_operation(OperationName.STOP_AUXILIARY_HEATING)
future = self._wait_for_operation(OperationName.STOP_AUXILIARY_HEATING)
await self.rest_api.stop_auxiliary_heating(vin)
# await future
await future

async def lock(self, vin: str, spin: str) -> None:
"""Lock the car."""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ async def test_stop_auxiliary_heater(

future = myskoda.stop_auxiliary_heating(VIN)

topic = f"{USER_ID}/{VIN}/operation-request/air-conditioning/start-stop-auxiliary-heating"
topic = f"{USER_ID}/{VIN}/operation-request/auxiliary-heating/start-stop-auxiliary-heating"
await mqtt_client.publish(topic, create_completed_json("stop-auxiliary-heating"), QOS_2)

await future
Expand Down Expand Up @@ -399,7 +399,7 @@ async def test_start_auxiliary_heater(

future = myskoda.start_auxiliary_heating(VIN, temperature, spin)

topic = f"{USER_ID}/{VIN}/operation-request/air-conditioning/start-stop-auxiliary-heating"
topic = f"{USER_ID}/{VIN}/operation-request/auxiliary-heating/start-stop-auxiliary-heating"
await mqtt_client.publish(topic, create_completed_json("start-auxiliary-heating"), QOS_2)

await future
Expand Down

0 comments on commit 805128b

Please sign in to comment.