Commit graph

13 commits

Author SHA1 Message Date
gak 6facc27d8b
change!: vehicle_data now accepts a struct instead of VehicleId
To support "endpoints", e.g. requesting GPS.

From https://developer.tesla.com/docs/fleet-api#vehicle_data

String of URL-encoded, semicolon-separated values. Can be many of 'charge_state',
'climate_state', 'closures_state', 'drive_state', 'gui_settings', 'location_data',
'vehicle_config', 'vehicle_state', 'vehicle_data_combo'.

Before:

let vehicle_data = api.vehicle_data(&vehicle_id).await.unwrap();

After:

let get_vehicle_data = GetVehicleData::new(vehicles_id);
let vehicle_data = api.vehicle_data(&get_vehicle_data).await.unwrap();

Or with a endpoints:

let get_vehicle_data = GetVehicleData::new_with_endpoints(123u64, vec![Endpoint::ChargeState, Endpoint::ClimateState]);
let vehicle_data = api.vehicle_data(&get_vehicle_data).await.unwrap();

CLI:

You can still use vehicle-data without endpoints, but you won't get
location data. To fetch location_data:

teslatte api vehicle 123 vehicle-data location_data
2023-11-11 11:07:24 +11:00
gak 8c059769ee
refactor!: Rename Api to OwnerApi. Remove ResponseData<T>. Add VehicleApi trait.
Significant refactor to progress towards different API access that Tesla
has introduced. See issues #6 and #7.

Removed `ResponseData` because it wasn't very ergonomic, forcing the user
to deref or call data(). Also it had specific fields for JSON output
which was only used for the CLI, so I introduced a field
`print_responses` in OwnerApi that the CLI can use.
2023-10-22 09:17:32 +11:00
gak a8b58e1157
refactor: Api -> OwnerApi 2023-10-20 12:18:38 +11:00
Richard Ulrich 3d583f7e0b
adding commands for doors and hvac
making inside_temp optional
2023-10-19 19:51:20 +02:00
gak 0057ae3be2
feat: honk and flash 2023-08-30 16:19:19 +10:00
gak 8b96ecf3bc
feat: set_scheduled_departure 2023-08-30 16:15:17 +10:00
gak cb8df6019a
feat: added set_scheduled_charging 2023-08-30 15:46:16 +10:00
gak 844583a6b1
refactor: reuse POST request structs for cli 2023-08-30 15:27:17 +10:00
gak 68b835124f
feat: added vehicle charge related apis 2023-08-30 15:14:33 +10:00
gak 900be5aa1f
feat: cli show json on POST and some errors 2023-08-29 16:13:43 +10:00
gak 8881d0fa59
feat: cli only prints json, cli-pretty-json feature 2023-08-29 13:11:28 +10:00
gak e3c1044dd3
refactor: split up cli, more crate version updates 2023-08-29 11:33:03 +10:00
gak 635bd84384
refactor: cli to be a binary with cli feature 2023-08-29 10:49:04 +10:00
Renamed from examples/cli_vehicle.rs (Browse further)