Skip to content

Commit

Permalink
Merge pull request #202 from MTrab:Send-mower-home-on-party_mode-enable
Browse files Browse the repository at this point in the history
Send device home when enabling party_mode
  • Loading branch information
MTrab authored Apr 8, 2024
2 parents 416b76a + 1edae8f commit 09b2d6c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyworxcloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# pylint: disable=too-many-lines
from __future__ import annotations

from asyncio import sleep
import json
import logging
import sys
Expand Down Expand Up @@ -862,7 +863,7 @@ def set_partymode(self, serial_number: str, state: bool) -> None:
"""Turn on or off the partymode.
Args:
enable (bool): True is enabling partymode, Fasle is disabling partymode.
enable (bool): True is enabling partymode, False is disabling partymode.
Raises:
NoPartymodeError: Raised if the device does not support partymode.
Expand All @@ -873,6 +874,11 @@ def set_partymode(self, serial_number: str, state: bool) -> None:
if mower["online"]:
device = DeviceHandler(self._api, mower)
if device.capabilities.check(DeviceCapability.PARTY_MODE):
if state:
self.safehome(serial_number)
self.home(serial_number)
sleep(1)

if mower["protocol"] == 0:
self.mqtt.publish(
serial_number if mower["protocol"] == 0 else mower["uuid"],
Expand Down

0 comments on commit 09b2d6c

Please sign in to comment.