Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Quick test code to check status of 'possible' refresh endpoints #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions mytoyota/models/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,6 @@

return ret

#
# More get functionality depending on what we find
#

async def set_alias(self, value) -> bool:
"""Set the alias for the vehicle.

Expand All @@ -397,6 +393,23 @@
"""
return value

async def force_update(self) -> None:
"""Force update of endpoints

Returns
-------

"""
endpoints_to_test = ["/v1/global/remote/electric/realtime-status", "/v1/global/remote/refresh-status",

Check warning on line 403 in mytoyota/models/vehicle.py

View check run for this annotation

Codecov / codecov/patch

mytoyota/models/vehicle.py#L403

Added line #L403 was not covered by tests
"/v1/global/remote/refresh-climate-status"]

for ep in endpoints_to_test:
try:
resp = await self._api.controller.request_json("POST", ep, vin=self.vin)
print(f"{ep}: {resp}")
except Exception as e:
print(f"{ep}: Threw {e}")

Check warning on line 411 in mytoyota/models/vehicle.py

View check run for this annotation

Codecov / codecov/patch

mytoyota/models/vehicle.py#L406-L411

Added lines #L406 - L411 were not covered by tests

#
# More set functionality depending on what we find
#
Expand Down
8 changes: 5 additions & 3 deletions simple_client_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ async def get_information():
cars = await client.get_vehicles(metric=True)

for car in cars:
await car.force_update()
await car.update()


# Dashboard Information
pp.pprint(f"Dashboard: {car.dashboard}")
# Location Information
Expand All @@ -66,9 +68,9 @@ async def get_information():
# pp.pprint(
# f"Summary: {[[x] for x in await car.get_summary(date.today() - timedelta(days=7 * 4), date.today(), summary_type=SummaryType.WEEKLY)]}" # noqa: E501 # pylint: disable=C0301
# )
pp.pprint(
f"Summary: {[[x] for x in await car.get_summary(date.today() - timedelta(days=6 * 30), date.today(), summary_type=SummaryType.MONTHLY)]}" # noqa: E501
)
#pp.pprint(
# f"Summary: {[[x] for x in await car.get_summary(date.today() - timedelta(days=6 * 30), date.today(), summary_type=SummaryType.MONTHLY)]}" # noqa: E501
#)
# pp.pprint(
# f"Summary: {[[x] for x in await car.get_summary(date.today() - timedelta(days=365), date.today(), summary_type=SummaryType.YEARLY)]}" # noqa: E501 # pylint: disable=C0301
# )
Expand Down
Loading