Skip to content

Commit

Permalink
Fix missing GPS data exception
Browse files Browse the repository at this point in the history
  • Loading branch information
MTrab committed Jun 12, 2024
1 parent 0deabe7 commit 5acc0f9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pyworxcloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,11 @@ def _decode_data(self, device: DeviceHandler) -> None:
# Check for extra module availability
if "modules" in data["dat"]:
if "4G" in data["dat"]["modules"]:
device.gps = Location(
data["dat"]["modules"]["4G"]["gps"]["coo"][0],
data["dat"]["modules"]["4G"]["gps"]["coo"][1],
)
if "gps" in data["dat"]["modules"]["4G"]:
device.gps = Location(
data["dat"]["modules"]["4G"]["gps"]["coo"][0],
data["dat"]["modules"]["4G"]["gps"]["coo"][1],
)

# Get remaining rain delay if available
if "rain" in data["dat"]:
Expand Down Expand Up @@ -921,7 +922,9 @@ def setzone(self, serial_number: str, zone: str | int) -> None:
zone >= len(device.zone["starting_point"])
or device.zone["starting_point"][zone] == 0
):
raise ZoneNotDefined("Cannot request zone {} as it is not defined.".format(zone))
raise ZoneNotDefined(
"Cannot request zone {} as it is not defined.".format(zone)
)

if not zone in device.zone["indicies"]:
raise ZoneNoProbability(
Expand Down

0 comments on commit 5acc0f9

Please sign in to comment.