1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env python
- import os
- import aiohttp
- import asyncio
- from pprint import pprint as pp
- from renault_api.renault_client import RenaultClient
- async def main():
- async with aiohttp.ClientSession() as websession:
- client = RenaultClient(websession=websession, locale="fr_FR")
- await client.session.login(os.environ.get('RENAULT_USERNAME'), os.environ.get('RENAULT_PASSWORD'))
- #print(f"Accounts: {await client.get_person()}") # List available accounts, make a note of kamereon account id
- account = await client.get_api_account(os.environ.get('RENAULT_ACCOUNT_ID'))
- #print(f"Vehicles: {await account.get_vehicles()}") # List available vehicles, make a note of vehicle VIN
- vehicle = await account.get_api_vehicle(os.environ.get('RENAULT_VIN'))
- info_cockpit = await vehicle.get_cockpit()
- info_battery = await vehicle.get_battery_status()
- pp(info_cockpit)
- pp(info_battery)
- loop = asyncio.new_event_loop()
- asyncio.set_event_loop(loop)
- try:
- asyncio.run(main())
- except KeyboardInterrupt:
- pass
|