Skip to content

Commit

Permalink
Merge pull request #26 from ad-ha/ad-ha-0.4.6
Browse files Browse the repository at this point in the history
Fix generic responses being parsed and not caught in exception
  • Loading branch information
ad-ha authored Nov 12, 2024
2 parents e1bf2ce + c5eabba commit 7585afa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion custom_components/mg_saic/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async def _async_update_data(self):
if vehicle_status is None:
LOGGER.warning("Vehicle status returned None.")
raise UpdateFailed("Vehicle status is None.")

# Check for generic vehicle status response
self._is_generic_response(vehicle_status)
data["status"] = vehicle_status
Expand Down Expand Up @@ -166,6 +167,8 @@ def _is_generic_response(self, status):
"Generic vehicle status response received."
)
return False
except GenericResponseException:
raise
except Exception as e:
LOGGER.error("Error: %s", e)
return False
Expand All @@ -184,8 +187,10 @@ def _is_generic_charging_response(self, charging_info):
"Generic charging response received."
)
return False
except GenericResponseException:
raise
except Exception as e:
LOGGER.error("Error: %s", e)
LOGGER.error("Error:: %s", e)
return False

def _determine_vehicle_type(self, vehicle_info):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mg_saic/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"pycryptodome",
"saic-ismart-client-ng==0.5.2"
],
"version": "0.4.5"
"version": "0.4.6"
}

0 comments on commit 7585afa

Please sign in to comment.