Skip to content

Commit

Permalink
Better handle when a cars does not support connected services (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
DurgNomis-drol authored Jul 29, 2021
1 parent b230e17 commit 31cd30f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions mytoyota/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,19 @@ def has_connected_services_enabled(self, json_dict) -> bool:
"""Checks if the user has enabled connected services."""
if (
"connectedService" in json_dict
and json_dict["connectedService"]["status"] == "ACTIVE"
and "status" in json_dict["connectedService"]
):
return True

if json_dict["connectedService"]["status"] == "ACTIVE":
return True

_LOGGER.error(
"Please setup Connected Services if you want live data from the car. (%s)",
self.vin,
)
return False
_LOGGER.error(
"Please setup Connected Services if you want live data from the car. (%s)",
"Your vehicle does not support Connected services (%s). You can find out if your "
"vehicle is compatible by checking the manual the comes with your car.",
self.vin,
)
return False
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ httpx~=0.17.1
uuid~=1.30
langcodes~=3.1.0
pendulum~=1.4.2
setuptools~=54.1.2
setuptools~=54.1.2

0 comments on commit 31cd30f

Please sign in to comment.