From 5acc0f98c9734c7812da88ef9ef1de83bfbb698f Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Wed, 12 Jun 2024 08:49:42 +0200 Subject: [PATCH] Fix missing GPS data exception --- pyworxcloud/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pyworxcloud/__init__.py b/pyworxcloud/__init__.py index 28f83fd..701e677 100644 --- a/pyworxcloud/__init__.py +++ b/pyworxcloud/__init__.py @@ -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"]: @@ -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(