You can use the FordPass for many models of Ford. Is it possible to use Powershell to get the battery status of a eletric car or PHEV? I found some solutions:
itchannel/fordpass-ha: Fordpass integration for Home Assistant (github.com)
Both solutions are made in Python. I like to use Powershell. So I made a early version of a script to get the battery status with Powershell:
#VIN: | |
$Vin = "<VIN>" | |
#Status URL: | |
$URL = "https://usapi.cv.ford.com/api/vehicles/v4/$Vin/status" | |
# Headers for token request | |
$Data = @{ | |
"client_id" = "9fb503e0-715b-47e8-adfd-ad4b7770f73b" | |
"grant_type"= "password" | |
"username" = "<USERNAME>" | |
"password" = "<PASSWORD>" | |
} | |
$TokenHeader = @{ | |
"Accept" = "*/*" | |
"Accept-Language" = "en-us" | |
"User-Agent" = "fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0" | |
"Accept-Encoding" = "gzip, deflate, br" | |
"Content-Type" = "application/x-www-form-urlencoded" | |
} | |
# Request for token: | |
$Result = Invoke-webrequest -Uri 'https://fcis.ice.ibmcloud.com/v1.0/endpoint/default/token' -Headers $TokenHeader -Body $Data -Method Post | |
$Token = ($Result.Content | convertfrom-json).access_token | |
#Header with token: | |
$StatusHeader = @{ | |
"Application-Id" = "71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592" | |
"Content-Type" = "application/json" | |
"auth-token" = $Token | |
} | |
# Get battery state: | |
$VehicleInfo = Invoke-RestMethod $URL -Headers $StatusHeader | |
$VehicleInfo.vehiclestatus.batteryFillLevel |